File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -662,14 +662,19 @@ cancel c = do
662662 " \\ xcancel" -> ECancel XSlash <$> texToken
663663 _ -> mzero
664664
665+ textContents :: (Text -> Exp ) -> TP [Exp ]
666+ textContents op = char ' {' *> manyTill chunk (char ' }' )
667+ where
668+ chunk = (op . T. concat <$> many1 textual)
669+ <|> (char ' {' *> (asGroup <$> manyTill chunk (char ' }' )))
670+ <|> innermath
671+
665672text :: Text -> TP Exp
666673text c = do
667674 op <- maybe mzero return $ M. lookup c textOps
668- char ' {'
669- let chunk = ((op . T. concat ) <$> many1 textual)
670- <|> (char ' {' *> (asGroup <$> manyTill chunk (char ' }' )))
671- <|> innermath
672- contents <- manyTill chunk (char ' }' )
675+ contents <- textContents op
676+ <|> ((: [] ) . op <$> textCommand)
677+ <|> ((: [] ) . op . T. singleton <$> noneOf " \n\t\r \\ {}" )
673678 spaces
674679 case contents of
675680 [] -> return (op " " )
Original file line number Diff line number Diff line change 1+ <<< tex
2+ x = y\text.x
3+ >>> native
4+ [ EIdentifier "x"
5+ , ESymbol Rel "="
6+ , EIdentifier "y"
7+ , EText TextNormal "."
8+ , EIdentifier "x"
9+ ]
You can’t perform that action at this time.
0 commit comments