diff --git a/data/templates/default.man b/data/templates/default.man index 342a09e4d080..84aa37d731b2 100644 --- a/data/templates/default.man +++ b/data/templates/default.man @@ -5,20 +5,6 @@ $if(pandoc-version)$ .\" Automatically generated by Pandoc $pandoc-version$ .\" $endif$ -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} $if(adjusting)$ .ad $adjusting$ $endif$ diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 794c5518a86d..fb05df1f758f 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -131,14 +131,12 @@ blockToMan opts (Header level _ inlines) = do return $ nowrap $ literal heading <> contents blockToMan opts (CodeBlock _ str) = return $ literal ".IP" $$ - literal ".nf" $$ - literal "\\f[C]" $$ + literal ".EX" $$ ((case T.uncons str of Just ('.',_) -> literal "\\&" _ -> mempty) <> literal (escString opts str)) $$ - literal "\\f[R]" $$ - literal ".fi" + literal ".EE" blockToMan opts (BlockQuote blocks) = do contents <- blockListToMan opts blocks return $ literal ".RS" $$ contents $$ literal ".RE" @@ -291,8 +289,7 @@ inlineToMan opts (Quoted DoubleQuote lst) = do inlineToMan opts (Cite _ lst) = inlineListToMan opts lst inlineToMan opts (Code _ str) = - -- note that the V font is specially defined in the default man template - withFontFeature 'V' (return (literal $ escString opts str)) + 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 diff --git a/src/Text/Pandoc/Writers/Roff.hs b/src/Text/Pandoc/Writers/Roff.hs index d5602ebfb101..7214e32f018f 100644 --- a/src/Text/Pandoc/Writers/Roff.hs +++ b/src/Text/Pandoc/Writers/Roff.hs @@ -112,9 +112,11 @@ fontChange = do fromMaybe False (Map.lookup 'B' features)] ++ ['I' | fromMaybe False $ Map.lookup 'I' features] return $ - if null filling - then text "\\f[R]" - else text $ "\\f[" ++ filling ++ "]" + case filling of + [] -> text "\\f[R]" + -- see #9020. C is not a font, use CR. + ['C'] -> text "\\f[CR]" + _ -> text $ "\\f[" ++ filling ++ "]" withFontFeature :: (HasChars a, IsString a, PandocMonad m) => Char -> MS m (Doc a) -> MS m (Doc a) diff --git a/test/command/3568.md b/test/command/3568.md index a6817f4c6d28..ffc1daada923 100644 --- a/test/command/3568.md +++ b/test/command/3568.md @@ -10,7 +10,7 @@ normal `code` normal. normal \f[I]italic \f[BI]bold in the middle\f[I] only italic\f[R] normal. .PP -normal \f[B]bold \f[VB]code\f[B] more bold\f[R] normal. +normal \f[B]bold \f[CB]code\f[B] more bold\f[R] normal. .PP -normal \f[V]code\f[R] normal. +normal \f[CR]code\f[R] normal. ``` diff --git a/test/command/5620.md b/test/command/5620.md index cb2635bf033b..371a64864627 100644 --- a/test/command/5620.md +++ b/test/command/5620.md @@ -4,6 +4,6 @@ : Write output to *OUTFILE* instead of `stdout`(3) ^D .TP -\f[V]-o\f[R], \f[V]--output=\f[R]\f[I]OUTFILE\f[R] -Write output to \f[I]OUTFILE\f[R] instead of \f[V]stdout\f[R](3) +\f[CR]-o\f[R], \f[CR]--output=\f[R]\f[I]OUTFILE\f[R] +Write output to \f[I]OUTFILE\f[R] instead of \f[CR]stdout\f[R](3) ``` diff --git a/test/writer.man b/test/writer.man index 5b53a0291732..126bf35013ba 100644 --- a/test/writer.man +++ b/test/writer.man @@ -1,17 +1,3 @@ -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "Pandoc Test Suite" "" "July 17, 2006" "" "" .PP This is a set of tests for pandoc. @@ -65,13 +51,11 @@ It is pretty short. .PP Code in a block quote: .IP -.nf -\f[C] +.EX sub status { print \[dq]working\[dq]; } -\f[R] -.fi +.EE .PP A list: .IP "1." 3 @@ -99,8 +83,7 @@ And a following paragraph. .PP Code: .IP -.nf -\f[C] +.EX ---- (should be four hyphens) sub status { @@ -108,18 +91,15 @@ sub status { } this code block is indented by one tab -\f[R] -.fi +.EE .PP And: .IP -.nf -\f[C] +.EX this code block is indented by two tabs These should not be escaped: \[rs]$ \[rs]\[rs] \[rs]> \[rs][ \[rs]{ -\f[R] -.fi +.EE .PP * * * * * .SH Lists @@ -375,11 +355,9 @@ contains seeds, crisp, pleasant to taste orange fruit .RS .IP -.nf -\f[C] +.EX { orange code block } -\f[R] -.fi +.EE .RS .PP orange block quote @@ -440,21 +418,17 @@ foo .PP This should be a code block, though: .IP -.nf -\f[C] +.EX
}
-\f[R]
-.fi
+.EE
.PP
If you want, you can indent every line, but you can also be lazy and just indent
the first line of each block.
.SS [3]
.PP
This is \f[I]easier\f[R] to type.
-Inline notes may contain links (http://google.com) and \f[V]]\f[R] verbatim
+Inline notes may contain links (http://google.com) and \f[CR]]\f[R] verbatim
characters, as well as [bracketed text].
.SS [4]
.PP
diff --git a/test/writer.ms b/test/writer.ms
index 32d7c1670259..4b9b4d2516d0 100644
--- a/test/writer.ms
+++ b/test/writer.ms
@@ -644,8 +644,8 @@ So is \f[B]\f[BI]this\f[B]\f[R] word.
.PP
So is \f[B]\f[BI]this\f[B]\f[R] word.
.PP
-This is code: \f[C]>\f[R], \f[C]$\f[R], \f[C]\[rs]\f[R], \f[C]\[rs]$\f[R],
-\f[C]\f[R].
+This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\[rs]\f[R], \f[CR]\[rs]$\f[R],
+\f[CR]\f[R].
.PP
\m[strikecolor]This is \f[I]strikeout\f[R].\m[]
.PP
@@ -671,7 +671,7 @@ So is `pine.'
.PP
`He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s?
.PP
-Here is some quoted `\f[C]code\f[R]' and a \[lq]\c
+Here is some quoted `\f[CR]code\f[R]' and a \[lq]\c
.pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \
-- "quoted link"
\&\[rq].
@@ -707,7 +707,7 @@ Here\[cq]s one that has a line break in it: @alpha + omega times x sup 2@.
.LP
These shouldn\[cq]t be math:
.IP \[bu] 3
-To get the famous equation, write \f[C]$e = mc\[ha]2$\f[R].
+To get the famous equation, write \f[CR]$e = mc\[ha]2$\f[R].
.IP \[bu] 3
$22,000 is a \f[I]lot\f[R] of money.
So is $34,000.
@@ -715,7 +715,7 @@ So is $34,000.
.IP \[bu] 3
Shoes ($20) and socks ($5).
.IP \[bu] 3
-Escaped \f[C]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
+Escaped \f[CR]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
.LP
Here\[cq]s a LaTeX table:
.HLINE
@@ -938,7 +938,7 @@ Blockquoted: \c
\&
.QE
.LP
-Auto-links should not occur here: \f[C] \f[R]
+Auto-links should not occur here: \f[CR] \f[R]
.IP
.nf
\f[C]
@@ -991,7 +991,7 @@ This is \f[I]easier\f[R] to type.
Inline notes may contain \c
.pdfhref W -D "http://google.com" -A "\c" \
-- "links"
-\& and \f[C]]\f[R] verbatim characters, as well as [bracketed text].
+\& and \f[CR]]\f[R] verbatim characters, as well as [bracketed text].
.FE
.QS
.LP