aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-11-18 23:32:02 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2018-11-18 23:32:02 -0800
commit681afbfaac1589dbcd4149c185657b10b7df1d47 (patch)
treeeb43609645bbbd0f6bbeb664b5d6f0e57cdaa906 /src
parent5c643d535bf015d533716d4b34a767d3b7ae65af (diff)
downloadpandoc-681afbfaac1589dbcd4149c185657b10b7df1d47.tar.gz
LaTeX reader: improve parsing of `\tiny`, `scriptsize`, etc.
Parse as raw, but know that these font changing commands take no arguments.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 1d35cd662..7d2d62762 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -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))