[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> latex-to-mathml.js (summary)

(no description)

File Size: 13982 lines (455 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 15 classes

ParseError:: (1 method):
  temml_escape()

Settings:: (2 methods):
  defineFunction()
  defineFunctionBuilders()

DocumentFragment:: (0 methods):

Span:: (0 methods):

AnchorNode:: (0 methods):

Img:: (1 method):
  newDocumentFragment()

MathNode:: (0 methods):

TextNode:: (12 methods):
  defineSymbol()
  setLineBreaks()
  isNumberPunctuation()
  buildMathML()
  assertNodeType()
  assertSymbolNodeType()
  checkSymbolNodeType()
  cdArrow()
  parseCD()
  checkDelimiter()
  assertParsed()
  defineEnvironment()

SourceLocation:: (0 methods):

Token:: (11 methods):
  defineMacro()
  recreateArgStr()
  assertNever()
  assertString()
  getHLines()
  getAutoTag()
  parseArray()
  beginRow()
  endRow()
  dCellStyle()
  mathmlBuilder()

Lexer:: (0 methods):

Namespace:: (0 methods):

MacroExpander:: (0 methods):

Parser:: (0 methods):

Style:: (2 methods):
  postProcess()
  latexToMathML()


Class: ParseError  - X-Ref

This is the ParseError class, which is the main error thrown by Temml
functions when something has gone wrong. This is used to distinguish internal
errors from errors in the expression that the user provided.

If possible, a caller should provide a Token or ParseNode with information
about where in the source string the problem occurred.
temml_escape(text)   X-Ref
Escapes text to prevent scripting attacks.


Class: Settings  - X-Ref

The main Settings object

defineFunction({type,names,props,handler,mathmlBuilder})   X-Ref
All MathML builders. Should be only used in the `define*` and the `build*ML`
functions.


defineFunctionBuilders({ type, mathmlBuilder })   X-Ref
Use this to register only the MathML builder for a function(e.g.
if the function's ParseNode is generated in Parser.js rather than via a
stand-alone handler provided to `defineFunction`).


Class: DocumentFragment  - X-Ref

This node represents a document fragment, which contains elements, but when
placed into the DOM doesn't have any representation itself. It only contains
children and doesn't have any DOM node properties.

Class: Span  - X-Ref

This node represents a span node, with a className, a list of children, and
an inline style.

Class: AnchorNode  - X-Ref

Class: Img  - X-Ref

newDocumentFragment(children)   X-Ref
These objects store data about MathML nodes.
The `toNode` and `toMarkup` functions  create namespaced DOM nodes and
HTML text markup respectively.


Class: MathNode  - X-Ref

This node represents a general purpose MathML node of any type,
for example, `"mo"` or `"mspace"`, corresponding to `<mo>` and
`<mspace>` tags).

Class: TextNode  - X-Ref

This node represents a piece of text.

defineSymbol(mode, group, replace, name, acceptUnicodeChar)   X-Ref
No description

setLineBreaks(expression, wrapMode, isDisplayMode)   X-Ref
No description

isNumberPunctuation(group)   X-Ref
Check for <mi>.</mi> which is how a dot renders in MathML,
or <mo separator="true" lspace="0em" rspace="0em">,</mo>
which is how a braced comma {,} renders in MathML


buildMathML(tree, texExpression, style, settings)   X-Ref
Takes a full parse tree and settings and builds a MathML representation of
it.


assertNodeType(node, type)   X-Ref
Asserts that the node is of the given type and returns it with stricter
typing. Throws if the node's type does not match.


assertSymbolNodeType(node)   X-Ref
Returns the node more strictly typed iff it is of the given type. Otherwise,
returns null.


checkSymbolNodeType(node)   X-Ref
Returns the node more strictly typed iff it is of the given type. Otherwise,
returns null.


cdArrow(arrowChar, labels, parser)   X-Ref
No description

parseCD(parser)   X-Ref
No description

checkDelimiter(delim, context)   X-Ref
No description

assertParsed(group)   X-Ref
No description

defineEnvironment({ type, names, props, handler, mathmlBuilder })   X-Ref
All registered environments.
`environments.js` exports this same dictionary again and makes it public.
`Parser.js` requires this dictionary via `environments.js`.


Class: SourceLocation  - X-Ref

Lexing or parsing positional information for error reporting.
This object is immutable.

Class: Token  - X-Ref

The resulting token returned from `lex`.

It consists of the token text plus some position information.
The position information is essentially a range in an input string,
but instead of referencing the bare input string, we refer to the lexer.
That way it is possible to attach extra metadata to the input string,
like for example a file name or similar.

The position information is optional, so it is OK to construct synthetic
tokens if appropriate. Not providing available position information may
lead to degraded error reporting, though.
defineMacro(name, body)   X-Ref
No description

recreateArgStr(context)   X-Ref
No description

assertNever(a)   X-Ref
No description

assertString(a)   X-Ref
No description

getHLines(parser)   X-Ref
No description

getAutoTag(name)   X-Ref
No description

parseArray(parser,{cols, envClasses, )   X-Ref
Parse the body of the environment, with rows delimited by \\ and
columns delimited by &, and create a nested list in row-major order
with one group per cell.  If given an optional argument scriptLevel
("text", "display", etc.), then each cell is cast into that scriptLevel.


beginRow()   X-Ref
No description

endRow()   X-Ref
No description

dCellStyle(envName)   X-Ref
No description

mathmlBuilder(let node;const inner = buildExpression(group.body, style)   X-Ref
No description

Class: Lexer  - X-Ref

Class: Namespace  - X-Ref

A `Namespace` refers to a space of nameable things like macros or lengths,
which can be `set` either globally or local to a nested group, using an
undo stack similar to how TeX implements this functionality.
Performance-wise, `get` and local `set` take constant time, while global
`set` takes time proportional to the depth of group nesting.

Class: MacroExpander  - X-Ref

Class: Parser  - X-Ref

This file contains the parser used to parse out a TeX expression from the
input. Since TeX isn't context-free, standard parsers don't work particularly
well.

The strategy of this parser is as such:

The main functions (the `.parse...` ones) take a position in the current
parse string to parse tokens from. The lexer (found in Lexer.js, stored at
this.gullet.lexer) also supports pulling out tokens at arbitrary places. When
individual tokens are needed at a position, the lexer is called to pull out a
token, which is then used.

The parser has a property called "mode" indicating the mode that
the parser is currently in. Currently it has to be one of "math" or
"text", which denotes whether the current environment is a math-y
one or a text-y one (e.g. inside \text). Currently, this serves to
limit the functions which can be used in text mode.

The main functions then return an object which contains the useful data that
was parsed at its given point, and a new position at the end of the parsed
data. The main functions can call each other and continue the parsing by
using the returned position as a new starting point.

There are also extra `.handle...` functions, which pull out some reused
functionality into self-contained functions.

The functions return ParseNodes.

Class: Style  - X-Ref

This is the main Style class. It contains the current style.level, color, and font.

Style objects should not be modified. To create a new Style with
different properties, call a `.with*` method.
postProcess(block)   X-Ref
No description

latexToMathML(latex, { displayMode = true } = {})   X-Ref
No description



Generated : Wed Oct 22 08:20:04 2025 Cross-referenced by PHPXref