File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ singleTok :: ManToken -> ManTokens
105105singleTok t = ManTokens (Seq. singleton t)
106106
107107data RoffState = RoffState { customMacros :: M. Map String ManTokens
108- , lastFont :: FontSpec
108+ , prevFont :: FontSpec
109+ , currentFont :: FontSpec
109110 } deriving Show
110111
111112instance Default RoffState where
@@ -117,7 +118,8 @@ instance Default RoffState where
117118 , (" lq" , " \x201C " )
118119 , (" rq" , " \x201D " )
119120 , (" R" , " \x00AE " ) ]
120- , lastFont = defaultFontSpec
121+ , prevFont = defaultFontSpec
122+ , currentFont = defaultFontSpec
121123 }
122124
123125type ManLexer m = ParserT [Char ] RoffState m
@@ -261,7 +263,8 @@ escFont = do
261263 , ($ defaultFontSpec) <$> letterFontKind
262264 , lettersFont
263265 ]
264- modifyState $ \ st -> st{ lastFont = font }
266+ modifyState $ \ st -> st{ prevFont = currentFont st
267+ , currentFont = font }
265268 return [Font font]
266269
267270lettersFont :: PandocMonad m => ManLexer m FontSpec
@@ -271,7 +274,7 @@ lettersFont = try $ do
271274 skipMany letter
272275 char ' ]'
273276 if null fs
274- then lastFont <$> getState
277+ then prevFont <$> getState
275278 else return $ foldr ($) defaultFontSpec fs
276279
277280letterFontKind :: PandocMonad m => ManLexer m (FontSpec -> FontSpec )
Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ linePartsToInlines = go False
180180 go :: Bool -> [LinePart ] -> Inlines
181181 go _ [] = mempty
182182 go mono (MacroArg _: xs) = go mono xs -- shouldn't happen
183+ go mono (RoffStr s : RoffStr t : xs) = go mono (RoffStr (s <> t): xs)
183184 go mono (RoffStr s : xs)
184185 | mono = code s <> go mono xs
185186 | otherwise = text s <> go mono xs
You can’t perform that action at this time.
0 commit comments