aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Groff.hs11
-rw-r--r--src/Text/Pandoc/Readers/Man.hs1
2 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Groff.hs b/src/Text/Pandoc/Readers/Groff.hs
index e63272682..4b92bd85a 100644
--- a/src/Text/Pandoc/Readers/Groff.hs
+++ b/src/Text/Pandoc/Readers/Groff.hs
@@ -105,7 +105,8 @@ singleTok :: ManToken -> ManTokens
singleTok t = ManTokens (Seq.singleton t)
data RoffState = RoffState { customMacros :: M.Map String ManTokens
- , lastFont :: FontSpec
+ , prevFont :: FontSpec
+ , currentFont :: FontSpec
} deriving Show
instance Default RoffState where
@@ -117,7 +118,8 @@ instance Default RoffState where
, ("lq", "\x201C")
, ("rq", "\x201D")
, ("R", "\x00AE") ]
- , lastFont = defaultFontSpec
+ , prevFont = defaultFontSpec
+ , currentFont = defaultFontSpec
}
type ManLexer m = ParserT [Char] RoffState m
@@ -261,7 +263,8 @@ escFont = do
, ($ defaultFontSpec) <$> letterFontKind
, lettersFont
]
- modifyState $ \st -> st{ lastFont = font }
+ modifyState $ \st -> st{ prevFont = currentFont st
+ , currentFont = font }
return [Font font]
lettersFont :: PandocMonad m => ManLexer m FontSpec
@@ -271,7 +274,7 @@ lettersFont = try $ do
skipMany letter
char ']'
if null fs
- then lastFont <$> getState
+ then prevFont <$> getState
else return $ foldr ($) defaultFontSpec fs
letterFontKind :: PandocMonad m => ManLexer m (FontSpec -> FontSpec)
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs
index 6fa9e4f94..8dda237ba 100644
--- a/src/Text/Pandoc/Readers/Man.hs
+++ b/src/Text/Pandoc/Readers/Man.hs
@@ -180,6 +180,7 @@ linePartsToInlines = go False
go :: Bool -> [LinePart] -> Inlines
go _ [] = mempty
go mono (MacroArg _:xs) = go mono xs -- shouldn't happen
+ go mono (RoffStr s : RoffStr t : xs) = go mono (RoffStr (s <> t):xs)
go mono (RoffStr s : xs)
| mono = code s <> go mono xs
| otherwise = text s <> go mono xs