summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-01-15 12:07:18 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2022-01-15 12:07:18 -0800
commit253467a549dcc22384be96041fd6f886c4a7a935 (patch)
tree5b69e662415fa0e9c9d13f16707e738f3f77a5d0 /src
parent42142182566f64117ad01d324574ee6030878330 (diff)
Man writer: Use boldface for inline code.
Closes #7506. This also allows us to get rid of some special casing on definition lists that ensured that options in code spans would be boldface. (If this change is ever reverted, we'll need that again.)
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 32c2dbd78..391d61752 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -27,7 +27,6 @@ import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.DocLayout
import Text.Pandoc.Shared
-import Text.Pandoc.Walk (walk)
import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.Writers.Math
import Text.Pandoc.Writers.Shared
@@ -229,7 +228,7 @@ definitionListItemToMan :: PandocMonad m
definitionListItemToMan opts (label, defs) = do
-- in most man pages, option and other code in option lists is boldface,
-- but not other things, so we try to reproduce this style:
- labelText <- inlineListToMan opts $ makeCodeBold label
+ labelText <- inlineListToMan opts label
contents <- if null defs
then return empty
else liftM vcat $ forM defs $ \case
@@ -247,11 +246,6 @@ definitionListItemToMan opts (label, defs) = do
[] -> return empty
return $ literal ".TP" $$ nowrap labelText $$ contents
-makeCodeBold :: [Inline] -> [Inline]
-makeCodeBold = walk go
- where go x@Code{} = Strong [x]
- go x = x
-
-- | Convert list of Pandoc block elements to man.
blockListToMan :: PandocMonad m
=> WriterOptions -- ^ Options
@@ -293,7 +287,8 @@ inlineToMan opts (Quoted DoubleQuote lst) = do
inlineToMan opts (Cite _ lst) =
inlineListToMan opts lst
inlineToMan opts (Code _ str) =
- withFontFeature 'C' (return (literal $ escString opts str))
+ withFontFeature 'B' $ withFontFeature 'C' $
+ return (literal $ escString opts str)
inlineToMan opts (Str str@(T.uncons -> Just ('.',_))) =
return $ afterBreak "\\&" <> literal (escString opts str)
inlineToMan opts (Str str) = return $ literal $ escString opts str