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.)
This commit is contained in:
parent
4214218256
commit
253467a549
4 changed files with 16 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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[CB]code\f[B] more bold\f[R] normal.
|
||||
normal \f[B]bold \f[R]\f[C]code\f[R]\f[B] more bold\f[R] normal.
|
||||
.PP
|
||||
normal \f[C]code\f[R] normal.
|
||||
normal \f[B]\f[CB]code\f[B]\f[R] normal.
|
||||
```
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
^D
|
||||
.TP
|
||||
\f[B]\f[CB]-o\f[B]\f[R], \f[B]\f[CB]--output=\f[B]\f[R]\f[I]OUTFILE\f[R]
|
||||
Write output to \f[I]OUTFILE\f[R] instead of \f[C]stdout\f[R](3)
|
||||
Write output to \f[I]OUTFILE\f[R] instead of
|
||||
\f[B]\f[CB]stdout\f[B]\f[R](3)
|
||||
```
|
||||
|
|
|
@ -487,8 +487,9 @@ 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]<html>\f[R].
|
||||
This is code: \f[B]\f[CB]>\f[B]\f[R], \f[B]\f[CB]$\f[B]\f[R],
|
||||
\f[B]\f[CB]\[rs]\f[B]\f[R], \f[B]\f[CB]\[rs]$\f[B]\f[R],
|
||||
\f[B]\f[CB]<html>\f[B]\f[R].
|
||||
.PP
|
||||
[STRIKEOUT:This is \f[I]strikeout\f[R].]
|
||||
.PP
|
||||
|
@ -512,7 +513,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]quoted
|
||||
Here is some quoted `\f[B]\f[CB]code\f[B]\f[R]' and a \[lq]quoted
|
||||
link (http://example.com/?foo=1&bar=2)\[rq].
|
||||
.PP
|
||||
Some dashes: one\[em]two \[em] three\[em]four \[em] five.
|
||||
|
@ -545,7 +546,7 @@ Here\[cq]s one that has a line break in it:
|
|||
.PP
|
||||
These shouldn\[cq]t be math:
|
||||
.IP \[bu] 2
|
||||
To get the famous equation, write \f[C]$e = mc\[ha]2$\f[R].
|
||||
To get the famous equation, write \f[B]\f[CB]$e = mc\[ha]2$\f[B]\f[R].
|
||||
.IP \[bu] 2
|
||||
$22,000 is a \f[I]lot\f[R] of money.
|
||||
So is $34,000.
|
||||
|
@ -553,7 +554,7 @@ So is $34,000.
|
|||
.IP \[bu] 2
|
||||
Shoes ($20) and socks ($5).
|
||||
.IP \[bu] 2
|
||||
Escaped \f[C]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
|
||||
Escaped \f[B]\f[CB]$\f[B]\f[R]: $73 \f[I]this should be emphasized\f[R] 23$.
|
||||
.PP
|
||||
Here\[cq]s a LaTeX table:
|
||||
.PP
|
||||
|
@ -686,7 +687,7 @@ An e-mail address: <nobody@nowhere.net>
|
|||
Blockquoted: <http://example.com/>
|
||||
.RE
|
||||
.PP
|
||||
Auto-links should not occur here: \f[C]<http://example.com/>\f[R]
|
||||
Auto-links should not occur here: \f[B]\f[CB]<http://example.com/>\f[B]\f[R]
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
|
@ -742,8 +743,8 @@ 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[C]]\f[R] verbatim
|
||||
characters, as well as [bracketed text].
|
||||
Inline notes may contain links (http://google.com) and \f[B]\f[CB]]\f[B]\f[R]
|
||||
verbatim characters, as well as [bracketed text].
|
||||
.SS [4]
|
||||
.PP
|
||||
In quote.
|
||||
|
|
Loading…
Add table
Reference in a new issue