1.5.64 • Published 2 years ago

@concepto/dsl_parser v1.5.64

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.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

ParamTypeDefaultDescription
textStringFinds all nodes that contain its text with this value
attributeStringFinds all nodes that contain an attribute with this name
attribute_valueStringFinds all nodes that contain an attribute with this value
iconStringFinds all nodes that contain these icons
levelIntFinds all nodes that are on this level
linkStringFinds all nodes that contains this link
recurseBooleantrueinclude its children
nodes_rawBooleanfalseif 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

ParamTypeDescription
parent_idStringID of parent node
nodeNodeDSLNodeDSL object to add

dsl_parser.editNode(node_id, data)

Edits the given node ID data keys

Kind: instance method of dsl_parser

ParamTypeDescription
node_idStringID of node to edit
dataNodeDSLNodeDSL 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

ParamTypeDescription
nodeNodeDSLNodeDSL 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

ParamTypeDefaultDescription
idStringID of node to request
recurseBooleantrueinclude its children
datesBooleantrueinclude parsing creation/modification dates
$Booleanfalseinclude cheerio reference
nodes_rawBooleanfalseif 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

ParamTypeDefaultDescription
idStringID of node to request
recurseBooleanfalseinclude 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

ParamTypeDefaultDescription
idStringnode id to query
arrayBooleanfalseget 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

ParamTypeDefaultDescription
idStringnode id to query
arrayBooleanfalseget 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

ParamTypeDefaultDescription
idStringnode id to query
beforeBooleantrueconsider brothers before the queried node
afterBooleantrueconsider brothers after the queried node
arrayBooleanfalseget 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

ParamTypeDefaultDescription
removeBooleantrueRemove modified dates? (default:true)
extrastepfunctionOptional 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

ParamTypeDefaultDescription
textStringString from where to parse variables
symbolString**Wrapper symbol used as variable openning definition.
symbol_closingString**Wrapper symbol used as variable closing definition.
arrayBooleanfalseget 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

ParamTypeDescription
textStringString from where to parse variables
fromObjectObject to identify source variables symbols (keys: open and close)
toObjectObject 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

ParamTypeDescription
fromStringFrom source DSL content (before code)
toStringTo 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

NameTypeDescription
idstringNode unique ID.
levelnumberIndicates the depth level from the center of the dsl map.
textstringIndicates the text defined in the node itself.
text_richstringIndicates the html defined in the node itself.
text_notestringIndicates the text/html defined in the notes view of the node (if any).
imagestringImage link defined as an image within the node.
cloudObjectCloud information of the node.
cloud.bgcolorstringBackground color of cloud.
cloud.usedbooleanTrue if cloud is used, false otherwise.
arrowsArray.<Arrow>Visual connections of this node with other nodes #module_dsl_parser..Arrow.
nodesArray.<NodeDSL>Children nodes of current node.
fontObjectDefine font, size and styles of node texts.
font.faceObjectFont face type used on node.
font.sizeObjectFont size used on node.
font.boldObjectTrue if node text is in bold.
font.italicObjectTrue if node text is in italics.
stylestringStyle applied to the node.
colorstringText color of node.
bgcolorstringBackground color of node.
linkstringLink defined on node.
positionstringPosition in relation of central node (left,right).
attributesObjectObject with each attribute (key is attribute name, value is attribute value).
iconsArray.<string>Array with icon names used in the node.
date_modifieddateDate of node when it was last modified.
date_createddateDate 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

NameTypeDescription
targetstringTarget node ID of connection.
colorstringColor of visual connection.
stylestringGraphical representation type of link (source-to-target, target-to-source, both-ways).

© 2020-2022 Pablo Schaffner <pablo@puntorigen.com>.