@@ -69,9 +69,15 @@ metaToMan :: WriterOptions -- ^ Options, including Man header
69 -> Meta -- ^ Meta with bibliographic information
69 -> Meta -- ^ Meta with bibliographic information
70 -> State WriterState (Doc, Doc)
70 -> State WriterState (Doc, Doc)
71metaToMan options (Meta title authors date) = do
71metaToMan options (Meta title authors date) = do
72− title' <- inlineListToMan options title
72+ titleParts <- mapM (inlineListToMan options) $ map normalizeSpaces $
73+ splitBy (Str "|") title
74+ let titleParts' = map doubleQuotes titleParts
75+ let (title', section, rest) = case titleParts' of
76+ [] -> (text "\"\"", text "\"\"", [])
77+ [x] -> (x, text "\"\"", [])
78+ (x:y:zs) -> (x, y, zs)
73− let head = (text ".TH \"") <> title' <> text ("\" 1 \"" ++ date ++
79+ let head = (text ".TH") <+> title' <+> section <+>
74− "\" \"") <> title' <> text ("\" \"User Manuals\"")
80+ doubleQuotes (text date) <+> hsep rest
75 let foot = case length authors of
81 let foot = case length authors of
76 0 -> text $ ""
82 0 -> text $ ""
77 1 -> text $ ".SH AUTHOR\n" ++ joinWithSep ", " authors
83 1 -> text $ ".SH AUTHOR\n" ++ joinWithSep ", " authors