Constructor
new Doc(docopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
doc |
string |
<optional> |
<m><e></e></m>
|
An XML string representing the document |
Methods
(static) render(doc, target_id)
Render a given document into a specified HTML element.
Parameters:
Name | Type | Description |
---|---|---|
doc |
string | A GuppyXML string to be rendered |
target_id |
string | The ID of the HTML element to render into |
evaluate(evaluators) → {Object}
Evaluate the document using user-supplied functions to interpret symbols
Parameters:
Name | Type | Description |
---|---|---|
evaluators |
Object | A dictionary where each key is a node type in the AST ("var", "val", "sin", "cos", etc.) and the corresponding value is a function that takes a list of argument (the results of evaluating that AST node's arguments) as well as, optionally, a second argument for the parent AST node to the one currently being evaluated. |
Returns:
- Type
- Object
get_content(t) → {string}
Get the content of the document as a string
Parameters:
Name | Type | Description |
---|---|---|
t |
string | The rendering method to use ("latex", "text", "ast" (for syntax tree), or "xml" (for internal XML representation)) |
Returns:
- Type
- string
get_symbols(groupsopt) → {Array.<string>}
Get the names of symbols used in this document
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
groups |
Array.<string> |
<optional> |
A list of groups you want strings for |
Returns:
- Type
- Array.<string>
root() → {Element}
Get the document as a DOM object
Returns:
- Type
- Element
set_content(xml_data)
Set the content of the document
Parameters:
Name | Type | Description |
---|---|---|
xml_data |
string | An XML string representing the content of the document |