aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-26 22:46:04 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-26 22:46:04 -0700
commitdc7f41bb64e4e9a375f8aac4aaee083da643c2b3 (patch)
tree867ec3d340cd5bb01d161db19cb739f5422086fd /src/Text/Pandoc/Readers
parent9defc2545dfc8246f7bc24292f1274ef51dbdd87 (diff)
downloadpandoc-dc7f41bb64e4e9a375f8aac4aaee083da643c2b3.tar.gz
Roff tokenizer: better handling of font inlines `\f`....
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Roff.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs
index 183580fce..c12f6df83 100644
--- a/src/Text/Pandoc/Readers/Roff.hs
+++ b/src/Text/Pandoc/Readers/Roff.hs
@@ -271,9 +271,7 @@ escFontSize = do
escFont :: PandocMonad m => RoffLexer m [LinePart]
escFont = do
font <- choice
- [ char 'S' >> return defaultFontSpec
- , digit >> return defaultFontSpec
- , char '(' >> anyChar >> anyChar >> return defaultFontSpec
+ [ digit >> return defaultFontSpec
, digit >> return defaultFontSpec
, ($ defaultFontSpec) <$> letterFontKind
, lettersFont
@@ -284,10 +282,8 @@ escFont = do
lettersFont :: PandocMonad m => RoffLexer m FontSpec
lettersFont = try $ do
- char '['
- fs <- many letterFontKind
- skipMany letter
- char ']'
+ fs <- (char '[' *> many letterFontKind <* char ']')
+ <|> (char '(' *> count 2 letterFontKind)
if null fs
then prevFont <$> getState
else return $ foldr ($) defaultFontSpec fs
@@ -298,6 +294,7 @@ letterFontKind = choice [
, oneOf ['I','i'] >> return (\fs -> fs { fontItalic = True })
, oneOf ['C','c'] >> return (\fs -> fs { fontMonospace = True })
, oneOf ['P','p','R','r'] >> return id
+ , letter >> return id -- L, S, etc.
]