git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: improve parsing of `\tiny`, `scriptsize`, etc.

Parse as raw, but know that these font changing commands take no arguments.

commit681afbfaac1589dbcd4149c185657b10b7df1d47 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 18 Nov 2018, 23:32 (8 years ago) parent5c643d5
1 file changed+18−4
src/Text/Pandoc/Readers/LaTeX.hs+18−4
src/Text/Pandoc/Readers/LaTeX.hs+18−4
@@ -1297,12 +1297,26 @@ getRawCommand name txt = do
12971297 void $ count 4 braced
12981298 "def" ->
12991299 void $ manyTill anyTok braced
1300− _ -> do
1301− skipopts
1302− option "" (try (optional sp *> dimenarg))
1303− void $ many braced
1300+ _ | isFontSizeCommand name -> return ()
1301+ | otherwise -> do
1302+ skipopts
1303+ option "" (try (optional sp *> dimenarg))
1304+ void $ many braced
13041305 return $ T.unpack (txt <> untokenize rawargs)
13051306
1307+isFontSizeCommand :: Text -> Bool
1308+isFontSizeCommand "tiny" = True
1309+isFontSizeCommand "scriptsize" = True
1310+isFontSizeCommand "footnotesize" = True
1311+isFontSizeCommand "small" = True
1312+isFontSizeCommand "normalsize" = True
1313+isFontSizeCommand "large" = True
1314+isFontSizeCommand "Large" = True
1315+isFontSizeCommand "LARGE" = True
1316+isFontSizeCommand "huge" = True
1317+isFontSizeCommand "Huge" = True
1318+isFontSizeCommand _ = False
1319+
13061320isBlockCommand :: Text -> Bool
13071321isBlockCommand s =
13081322 s `M.member` (blockCommands :: M.Map Text (LP PandocPure Blocks))