aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2021-09-03 09:20:28 -0700
committerJohn MacFarlane <[email protected]>2022-01-15 12:39:19 -0800
commitc40727bfbb25d5d072a3523d9d6fb3abb7197b5a (patch)
treeaefd729d1856ac4d8bcf9f8c45ab6a050945614c /src
parenta1cfe04a26309b9bbbc48ee5f816530746d9bc6c (diff)
Man writer: use custom font V for inline code.
The V font is defined conditionally, so that it renders like CB in output formats that support that, and like B in those that don't (e.g. the terminal). We could just redefine C, but this would affect code blocks, too, and putting them all in boldface looks ugly, I think. Possible drawback: fragments created by pandoc's man writer will presuppose a nonstandard V font. Closes #7506. Supersedes 253467a549dcc22384be96041fd6f886c4a7a935.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Man.hs4
-rw-r--r--src/Text/Pandoc/Writers/Roff.hs2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 391d61752..9371c2541 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -287,8 +287,8 @@ inlineToMan opts (Quoted DoubleQuote lst) = do
inlineToMan opts (Cite _ lst) =
inlineListToMan opts lst
inlineToMan opts (Code _ str) =
- withFontFeature 'B' $ withFontFeature 'C' $
- return (literal $ escString opts str)
+ -- note that the V font is specially defined in the default man template
+ withFontFeature 'V' (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
diff --git a/src/Text/Pandoc/Writers/Roff.hs b/src/Text/Pandoc/Writers/Roff.hs
index 7a951d7fe..b1978204c 100644
--- a/src/Text/Pandoc/Writers/Roff.hs
+++ b/src/Text/Pandoc/Writers/Roff.hs
@@ -55,6 +55,7 @@ defaultWriterState = WriterState{ stHasInlineMath = False
('I',False)
, ('B',False)
, ('C',False)
+ , ('V',False)
]
, stHasTables = False
}
@@ -106,6 +107,7 @@ fontChange = do
features <- gets stFontFeatures
inHeader <- gets stInHeader
let filling = ['C' | fromMaybe False $ Map.lookup 'C' features] ++
+ ['V' | fromMaybe False $ Map.lookup 'V' features] ++
['B' | inHeader ||
fromMaybe False (Map.lookup 'B' features)] ++
['I' | fromMaybe False $ Map.lookup 'I' features]