LaTeX reader: improve parsing of \tiny, scriptsize, etc.

Parse as raw, but know that these font changing commands
take no arguments.
This commit is contained in:
John MacFarlane 2018-11-18 23:32:02 -08:00
parent 5c643d535b
commit 681afbfaac

View file

@ -1297,12 +1297,26 @@ getRawCommand name txt = do
void $ count 4 braced
"def" ->
void $ manyTill anyTok braced
_ -> do
skipopts
option "" (try (optional sp *> dimenarg))
void $ many braced
_ | isFontSizeCommand name -> return ()
| otherwise -> do
skipopts
option "" (try (optional sp *> dimenarg))
void $ many braced
return $ T.unpack (txt <> untokenize rawargs)
isFontSizeCommand :: Text -> Bool
isFontSizeCommand "tiny" = True
isFontSizeCommand "scriptsize" = True
isFontSizeCommand "footnotesize" = True
isFontSizeCommand "small" = True
isFontSizeCommand "normalsize" = True
isFontSizeCommand "large" = True
isFontSizeCommand "Large" = True
isFontSizeCommand "LARGE" = True
isFontSizeCommand "huge" = True
isFontSizeCommand "Huge" = True
isFontSizeCommand _ = False
isBlockCommand :: Text -> Bool
isBlockCommand s =
s `M.member` (blockCommands :: M.Map Text (LP PandocPure Blocks))