diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-21 21:27:05 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-21 21:27:05 -0700 |
commit | 00f1f4a220f870046ca4d257baf0e8f8e0e221e0 (patch) | |
tree | eb6bbd786273bc1b933a6b7a201f67f4c4f05900 /src/Text | |
parent | 8523662f2fea7462ae33b75feaa3bf1dd3137b82 (diff) | |
download | pandoc-00f1f4a220f870046ca4d257baf0e8f8e0e221e0.tar.gz |
Man reader: add predefined strings (e.g. `\*[R]`).
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Man.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 3785e783d..30e66acf1 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -95,7 +95,14 @@ data RoffState = RoffState { fontKind :: Font } deriving Show instance Default RoffState where - def = RoffState { customMacros = mempty + def = RoffState { customMacros = M.fromList + $ map (\(n, s) -> + (n, singleTok + (MLine [RoffStr (s, mempty)]))) + [ ("Tm", "\x2122") + , ("lq", "\x201C") + , ("rq", "\x201D") + , ("R", "\x00AE") ] , fontKind = S.singleton Regular } data ManState = ManState { readerOptions :: ReaderOptions @@ -366,22 +373,15 @@ escStar :: PandocMonad m => ManLexer m [LinePart] escStar = try $ do char '\\' char '*' - font <- currentFont - let retstr s = return [RoffStr (s, font)] c <- anyChar case c of '(' -> do cs <- count 2 anyChar - case cs of - "Tm" -> retstr "\x2122" - "lq" -> retstr "\x201c" - "rq" -> retstr "\x201d" - _ -> resolveString cs + resolveString cs '[' -> do - cs <- many (noneOf "\t\n\r ]") - char ']' - resolveString cs - 'R' -> retstr "\xae" + cs <- many (noneOf "\t\n\r ]") + char ']' + resolveString cs 'S' -> return mempty -- switch back to default font size _ -> resolveString [c] |