Doc

Doc

A class representing a Guppy document. To access this class, use Guppy.Doc. To get the document for a particular guppy instance, say called "guppy1", do Guppy("guppy1").doc().

Constructor

new Doc(docopt)

Source:
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)

Source:

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}

Source:

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}

Source:

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

Source:

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}

Source:

Get the document as a DOM object

Returns:
Type
Element

set_content(xml_data)

Source:

Set the content of the document

Parameters:
Name Type Description
xml_data string

An XML string representing the content of the document