diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Man.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 23728a77e..2c3fc00bd 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -69,9 +69,15 @@ metaToMan :: WriterOptions -- ^ Options, including Man header -> Meta -- ^ Meta with bibliographic information -> State WriterState (Doc, Doc) metaToMan options (Meta title authors date) = do - title' <- inlineListToMan options title - let head = (text ".TH \"") <> title' <> text ("\" 1 \"" ++ date ++ - "\" \"") <> title' <> text ("\" \"User Manuals\"") + titleParts <- mapM (inlineListToMan options) $ map normalizeSpaces $ + splitBy (Str "|") title + let titleParts' = map doubleQuotes titleParts + let (title', section, rest) = case titleParts' of + [] -> (text "\"\"", text "\"\"", []) + [x] -> (x, text "\"\"", []) + (x:y:zs) -> (x, y, zs) + let head = (text ".TH") <+> title' <+> section <+> + doubleQuotes (text date) <+> hsep rest let foot = case length authors of 0 -> text $ "" 1 -> text $ ".SH AUTHOR\n" ++ joinWithSep ", " authors |