aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-07-13 16:41:43 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-13 16:41:43 -0700
commit4a5e727c8c3ec8695e61e5ad040e97e7861dbde9 (patch)
tree130fcefaecf391068c183186a3b5244d360129db /src/Text/Pandoc
parentd0bf7efe95f3b2347073549e83496d9dc636594e (diff)
downloadpandoc-4a5e727c8c3ec8695e61e5ad040e97e7861dbde9.tar.gz
Man writer: Improved definition list term output.
Now we boldface code but not other things. This matches the most common style in man pages (particularly option lists). Also, remove a regression in the last commit in which 'nowrap' was removed.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index e13f46af9..506461fac 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -26,6 +26,7 @@ import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
+import Text.Pandoc.Walk (walk)
import Text.Pandoc.Templates
import Text.Pandoc.Writers.Math
import Text.Pandoc.Writers.Shared
@@ -228,7 +229,9 @@ definitionListItemToMan :: PandocMonad m
-> ([Inline],[[Block]])
-> StateT WriterState m Doc
definitionListItemToMan opts (label, defs) = do
- labelText <- withFontFeature 'B' (inlineListToMan opts label)
+ -- 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
contents <- if null defs
then return empty
else liftM vcat $ forM defs $ \blocks ->
@@ -245,7 +248,12 @@ definitionListItemToMan opts (label, defs) = do
then empty
else text ".RS" $$ rest' $$ text ".RE"
[] -> return empty
- return $ text ".TP" $$ labelText $$ contents
+ return $ text ".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