Expand description
The interface module provides functionality both for calling from an API and also running the code from main
.
Constants§
- MATHML_
INSTANCE - The current node being navigated (also spoken and brailled) is stored in
MATHML_INSTANCE
.
Functions§
- copy_
mathml - Copy (recursively) the (MathML) element and return the new one. The Element type does not copy and modifying the structure of an element’s child will modify the element, so we need a copy Convert the returned error from set_mathml, etc., to a useful string for display
- do_
navigate_ command - Given a navigation command, the current node is moved accordingly.
This is a higher level interface than
do_navigate_keypress
for applications that want to interpret the keys themselves. The valid commands are: - do_
navigate_ keypress - Given a key code along with the modifier keys, the current node is moved accordingly (or value reported in some cases).
key
is the keycode for the key (in JavaScript,ev.key_code
) The spoken text for the new current node is returned. - errors_
to_ string - get_
braille - Get the braille associated with the MathML that was set by
set_mathml
. The braille returned depends upon the preference for thecode
preference (defaultNemeth
). If ‘nav_node_id’ is given, it is highlighted based on the value ofBrailleNavHighlight
(default:EndPoints
) - get_
braille_ position - Return the start and end braille character positions associated with the current (navigation) node.
- get_
element - get_
intent - Get the intent after setting the MathML Used in testing
- get_
navigation_ braille - Get the braille associated with the current navigation focus of the MathML that was set by
set_mathml
. The braille returned depends upon the preference for thecode
preference (defaultNemeth
). The returned braille is brailled as if the current navigation focus is the entire expression to be brailled. - get_
navigation_ mathml - Return the MathML associated with the current (navigation) node and the offset (0-based) from that mathml (not yet implemented) The offset is needed for token elements that have multiple characters.
- get_
navigation_ mathml_ id - Return the
id
andoffset
(0-based) associated with the current (navigation) node.offset
(not yet implemented) The offset is needed for token elements that have multiple characters. - get_
navigation_ node_ from_ braille_ position - Given a 0-based braille position, return the smallest MathML node enclosing it. This node might be a leaf with an offset.
- get_
overview_ text - Get the spoken text for an overview of the MathML that was set. The speech takes into account any AT or user preferences. Note: this implementation for is currently minimal and should not be used.
- get_
preference - Get the value of the named preference.
None is returned if
name
is not a known preference. - get_
spoken_ text - Get the spoken text of the MathML that was set. The speech takes into account any AT or user preferences.
- get_
supported_ braille_ codes - get_
supported_ languages - get_
supported_ speech_ styles - get_
version - Returns the version number (from Cargo.toml) of the build
- is_
same_ element - returns Ok() if two Documents are equal or some info where they differ in the Err
- set_
mathml - This will override any previous MathML that was set.
This returns canonical MathML with ’id’s set on any node that doesn’t have an id.
The ids can be used for sync highlighting if the
Bookmark
API preference is true. - set_
navigation_ node - Given an ‘id’ and an offset (for tokens), set the navigation node to that id. An error is returned if the ‘id’ doesn’t exist
- set_
preference - Set a MathCAT preference. The preference name should be a known preference name. The value should either be a string or a number (depending upon the preference being set) The list of known user preferences is in the MathCAT user documentation. Here are common preferences set by programs (not settable by the user):
- set_
rules_ dir - Set the Rules directory IMPORTANT: this should be the very first call to MathCAT. If ‘dir’ is an empty string, the environment var ‘MathCATRulesDir’ is tried.
- trim_
element - Not really meant to be public – used by tests in some packages