From c40727bfbb25d5d072a3523d9d6fb3abb7197b5a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 3 Sep 2021 09:20:28 -0700 Subject: 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. --- src/Text/Pandoc/Writers/Man.hs | 4 ++-- src/Text/Pandoc/Writers/Roff.hs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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] -- cgit v1.2.3