Method: Ritex::Parser#parse
- Defined in:
- lib/ritex.rb
#parse(s, wrap = true, inline = true) ⇒ Object
Parse a string. Returns the MathML output in string form. Note that macro definitios are cumulative and persistent across calls to #parse. If you don’t want this behavior, you must explicitly call #flush_macros after every #parse call.
wrap denotes whether you want the output wrapped in the top-level XML math tag. Unless you’re generating these tags yourself, you want this.
inline denotes whether you want inline markup versus block or “display” markup. For mathml output this only has an effect if wrap is true.
69 70 71 72 73 74 |
# File 'lib/ritex.rb', line 69 def parse s, wrap = true, inline = true @lex = Lexer.new(self, s) r = yyparse @lex, :lex r = markup r, (inline ? :math : :displaymath) if wrap r end |