@concepto/dsl_parser v1.5.64
Description
ES6 Class for creating and parsing Concepto DSL files. Note you need to pass all arguments as an object with keys.
API Reference
dsl_parser: A class for parsing Concepto DSL files, and compile them with the OPEN Framework.
- dsl_parser
- instance
- .process()
- .getParser() ⇒ Object
- .getNodes([text], [attribute], [attribute_value], [icon], [level], [link], [recurse], [nodes_raw]) ⇒ Array.<NodeDSL>
- .addNode(parent_id, node)
- .editNode(node_id, data)
- .nodeToXML(node)
- .getNode(id, [recurse], [dates], [$], [nodes_raw]) ⇒ Array.<NodeDSL>
- .getParentNode(id, [recurse]) ⇒ NodeDSL
- .getParentNodesIDs(id, [array]) ⇒ String | Array
- .getChildrenNodesIDs(id, [array]) ⇒ String | Array
- .getBrotherNodesIDs(id, [before], [after], [array]) ⇒ String
- .createGitVersion([remove], [extrastep]) ⇒ String
- .findVariables(text, [symbol], [symbol_closing], [array]) ⇒ String
- .replaceVarsSymbol(text, from, to) ⇒ String
- .getDifferences(from, to)
- inner
- instance
dsl_parser.process()
Executes initial processing for parser
Kind: instance method of dsl_parser
dsl_parser.getParser() ⇒ Object
Gets a reference to the internal parser
Kind: instance method of dsl_parser
dsl_parser.getNodes(text, attribute, attribute_value, icon, level, link, recurse, nodes_raw) ⇒ Array.<NodeDSL>
Get all nodes that contain the given arguments (all optional)
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
text | String | Finds all nodes that contain its text with this value | |
attribute | String | Finds all nodes that contain an attribute with this name | |
attribute_value | String | Finds all nodes that contain an attribute with this value | |
icon | String | Finds all nodes that contain these icons | |
level | Int | Finds all nodes that are on this level | |
link | String | Finds all nodes that contains this link | |
recurse | Boolean | true | include its children |
nodes_raw | Boolean | false | if this is true, includes key nodes_raw (children nodes) in result with a cheerio reference instead of processing them. |
dsl_parser.addNode(parent_id, node)
Adds a node as an xml child of the given parent node ID
Kind: instance method of dsl_parser
Param | Type | Description |
---|---|---|
parent_id | String | ID of parent node |
node | NodeDSL | NodeDSL object to add |
dsl_parser.editNode(node_id, data)
Edits the given node ID data keys
Kind: instance method of dsl_parser
Param | Type | Description |
---|---|---|
node_id | String | ID of node to edit |
data | NodeDSL | NodeDSL object properties to modify or method(existing_properties_of_node) that returns object data to modify |
dsl_parser.nodeToXML(node)
Converts a NodeDSL into an XML of ConceptoDSL node child
Kind: instance method of dsl_parser
Param | Type | Description |
---|---|---|
node | NodeDSL | NodeDSL origin object |
dsl_parser.getNode(id, recurse, dates, $, nodes_raw) ⇒ Array.<NodeDSL>
Get node data for the given id
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
id | String | ID of node to request | |
recurse | Boolean | true | include its children |
dates | Boolean | true | include parsing creation/modification dates |
$ | Boolean | false | include cheerio reference |
nodes_raw | Boolean | false | if recurse is false and this is true, includes key nodes_raw (children nodes) in result with a cheerio reference instead of processing them. |
dsl_parser.getParentNode(id, recurse) ⇒ NodeDSL
Returns the parent node of the given node id
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
id | String | ID of node to request | |
recurse | Boolean | false | include its children |
dsl_parser.getParentNodesIDs(id, array) ⇒ String | Array
Returns the parent nodes ids of the given node id
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
id | String | node id to query | |
array | Boolean | false | get results as array, or as a string |
dsl_parser.getChildrenNodesIDs(id, array) ⇒ String | Array
Returns the children nodes ids of the given node id
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
id | String | node id to query | |
array | Boolean | false | get results as array, or as a string |
dsl_parser.getBrotherNodesIDs(id, before, after, array) ⇒ String
Returns the brother nodes ids of the given node id
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
id | String | node id to query | |
before | Boolean | true | consider brothers before the queried node |
after | Boolean | true | consider brothers after the queried node |
array | Boolean | false | get results as array of objects, or as a string |
dsl_parser.createGitVersion(remove, extrastep) ⇒ String
Returns a modified version of the current loaded DSL, ready to be push to a version control (like github)
Kind: instance method of dsl_parser
Returns: String - Modified DSL source ready to be saved and pushed to a version control
Param | Type | Default | Description |
---|---|---|---|
remove | Boolean | true | Remove modified dates? (default:true) |
extrastep | function | Optional method to return make additional cleansing and return the xml |
dsl_parser.findVariables(text, symbol, symbol_closing, array) ⇒ String
Finds variables within given text
Kind: instance method of dsl_parser
Param | Type | Default | Description |
---|---|---|---|
text | String | String from where to parse variables | |
symbol | String | ** | Wrapper symbol used as variable openning definition. |
symbol_closing | String | ** | Wrapper symbol used as variable closing definition. |
array | Boolean | false | get results as array, or as a string |
dsl_parser.replaceVarsSymbol(text, from, to) ⇒ String
Finds and transform variables wrapping/handlebars symbols given a 'from' symbol object and a 'to' symbol object within the given text
Kind: instance method of dsl_parser
Param | Type | Description |
---|---|---|
text | String | String from where to parse variables |
from | Object | Object to identify source variables symbols (keys: open and close) |
to | Object | Object to identify target variables symbols (keys: open and close) |
dsl_parser.getDifferences(from, to)
Finds all differences 'from' given dsl 'to' given dsl (for CLI arg --diff-from file.dsl) and returns an object with 'deleted', 'added', and 'modified' IDs keys
Kind: instance method of dsl_parser
Param | Type | Description |
---|---|---|
from | String | From source DSL content (before code) |
to | String | To source DSL content (after code, to compare) |
dsl_parser~NodeDSL : Object
A node object representation of a DSL node.
Kind: inner typedef of dsl_parser
Properties
Name | Type | Description |
---|---|---|
id | string | Node unique ID. |
level | number | Indicates the depth level from the center of the dsl map. |
text | string | Indicates the text defined in the node itself. |
text_rich | string | Indicates the html defined in the node itself. |
text_note | string | Indicates the text/html defined in the notes view of the node (if any). |
image | string | Image link defined as an image within the node. |
cloud | Object | Cloud information of the node. |
cloud.bgcolor | string | Background color of cloud. |
cloud.used | boolean | True if cloud is used, false otherwise. |
arrows | Array.<Arrow> | Visual connections of this node with other nodes #module_dsl_parser..Arrow. |
nodes | Array.<NodeDSL> | Children nodes of current node. |
font | Object | Define font, size and styles of node texts. |
font.face | Object | Font face type used on node. |
font.size | Object | Font size used on node. |
font.bold | Object | True if node text is in bold. |
font.italic | Object | True if node text is in italics. |
style | string | Style applied to the node. |
color | string | Text color of node. |
bgcolor | string | Background color of node. |
link | string | Link defined on node. |
position | string | Position in relation of central node (left,right). |
attributes | Object | Object with each attribute (key is attribute name, value is attribute value). |
icons | Array.<string> | Array with icon names used in the node. |
date_modified | date | Date of node when it was last modified. |
date_created | date | Date of node when it was created. |
dsl_parser~Arrow : Object
Arrow object definition, for connections to other nodes within a DSL.
Kind: inner typedef of dsl_parser
Properties
Name | Type | Description |
---|---|---|
target | string | Target node ID of connection. |
color | string | Color of visual connection. |
style | string | Graphical representation type of link (source-to-target, target-to-source, both-ways). |
© 2020-2022 Pablo Schaffner <pablo@puntorigen.com>.