@@ -11,16 +11,16 @@ import {MmlNode} from '#js/core/MmlTree/MmlNode';
1111import { tmpJsonFile } from './constants' ;
1212import * as fs from 'fs' ;
1313
14- let convert : ( tex : string ) => string ;
14+ let convert : ( tex : string , display : boolean ) => string ;
1515
1616export function setupTex ( packages : string [ ] = [ 'base' ] , options = { } ) {
1717 const parserOptions = Object . assign ( { } , { packages : packages } , options ) ;
1818 const tex = new TeX ( parserOptions ) ;
1919 const html = new HTMLDocument ( '' , liteAdaptor ( ) , { InputJax : tex } ) ;
2020 const visitor = new SerializedMmlVisitor ( ) ;
2121 const toMathML = ( ( node : MmlNode ) => visitor . visitTree ( node ) ) ;
22- convert = ( expr : string ) =>
23- toMathML ( html . convert ( expr , { display : true , end : STATE . CONVERT } ) ) ;
22+ convert = ( expr : string , display : boolean ) =>
23+ toMathML ( html . convert ( expr , { display : display , end : STATE . CONVERT } ) ) ;
2424}
2525
2626import { SVG } from '#js/output/svg' ;
@@ -31,12 +31,12 @@ export function setupTexWithOutput(packages: string[] = ['base'], options = {})
3131 const html = new HTMLDocument ( '' , liteAdaptor ( ) , { InputJax : tex , OutputJax : new SVG ( ) } ) ;
3232 const visitor = new SerializedMmlVisitor ( ) ;
3333 const toMathML = ( ( node : MmlNode ) => visitor . visitTree ( node ) ) ;
34- convert = ( expr : string ) =>
35- toMathML ( html . convert ( expr , { display : true , end : STATE . CONVERT } ) ) ;
34+ convert = ( expr : string , display : boolean ) =>
35+ toMathML ( html . convert ( expr , { display : display , end : STATE . CONVERT } ) ) ;
3636}
3737
38- export function tex2mml ( tex : string ) {
39- return convert ( tex ) ;
38+ export function tex2mml ( tex : string , display : boolean = true ) {
39+ return convert ( tex , display ) ;
4040} ;
4141
4242// Machinery for measuring the completeness of our macro tests.
@@ -133,7 +133,7 @@ export function getTokens(configuration: string) {
133133// A prototype extension for the macro table lookups.
134134AbstractParseMap . prototype . lookup = function ( token : string ) {
135135 const result = this . map . get ( token ) ;
136- if ( result && ! token . match ( / ^ \s $ / ) ) {
136+ if ( result ) {
137137 addToken ( this . name , token ) ;
138138 }
139139 return result ;
0 commit comments