aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Man.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-21 21:06:04 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-21 21:06:46 -0700
commit15fa5455e270ccb1c1a8e5a49baadfb9a458c70c (patch)
tree0028afa5ebb1b2a4d46010271dcaf1e68a890f25 /src/Text/Pandoc/Readers/Man.hs
parentfe99001d9f2132f1208da51c4e5716f7b491902c (diff)
downloadpandoc-15fa5455e270ccb1c1a8e5a49baadfb9a458c70c.tar.gz
Man reader: support .SY, .OP macros.
Closes #4994.
Diffstat (limited to 'src/Text/Pandoc/Readers/Man.hs')
-rw-r--r--src/Text/Pandoc/Readers/Man.hs33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs
index 8bc834292..41f9ba8b5 100644
--- a/src/Text/Pandoc/Readers/Man.hs
+++ b/src/Text/Pandoc/Readers/Man.hs
@@ -573,16 +573,29 @@ parseInline = try $ do
tok <- mtoken
case tok of
MLine lparts -> return $ linePartsToInlines lparts
- MMacro "UR" args -> parseLink args
- MMacro "MT" args -> parseEmailLink args
- MMacro "B" args -> parseBold args
- MMacro "I" args -> parseItalic args
- MMacro "BI" args -> parseAlternatingFonts [strong, emph] args
- MMacro "IB" args -> parseAlternatingFonts [emph, strong] args
- MMacro "IR" args -> parseAlternatingFonts [emph, id] args
- MMacro "RI" args -> parseAlternatingFonts [id, emph] args
- MMacro "BR" args -> parseAlternatingFonts [strong, id] args
- MMacro "RB" args -> parseAlternatingFonts [id, strong] args
+ MMacro mname args ->
+ case mname of
+ "UR" -> parseLink args
+ "MT" -> parseEmailLink args
+ "B" -> parseBold args
+ "I" -> parseItalic args
+ "br" -> return linebreak
+ "BI" -> parseAlternatingFonts [strong, emph] args
+ "IB" -> parseAlternatingFonts [emph, strong] args
+ "IR" -> parseAlternatingFonts [emph, id] args
+ "RI" -> parseAlternatingFonts [id, emph] args
+ "BR" -> parseAlternatingFonts [strong, id] args
+ "RB" -> parseAlternatingFonts [id, strong] args
+ "SY" -> return $ strong $ mconcat $ intersperse B.space
+ $ map linePartsToInlines args
+ "YS" -> return mempty
+ "OP" -> case args of
+ (x:ys) -> return $ B.space <> str "[" <> B.space <>
+ mconcat (strong (linePartsToInlines x) :
+ map ((B.space <>) . linePartsToInlines) ys)
+ <> B.space <> str "]"
+ [] -> return mempty
+ _ -> mzero
_ -> mzero
parseBold :: PandocMonad m => [Arg] -> ManParser m Inlines