diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Man.hs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 0898b3c6a..e4bf58081 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -396,18 +396,14 @@ mcomment = msatisfy isMComment where parseTitle :: PandocMonad m => ManParser m Blocks parseTitle = do (MMacro _ args) <- mmacro "TH" - if null args - then return mempty - else do - let mantitle = fst $ head args - modifyState (changeTitle mantitle) - return $ header 1 $ text mantitle - where - changeTitle title pst = - let meta = stateMeta pst - metaUp = Meta $ M.insert "title" (MetaString title) (unMeta meta) - in - pst {stateMeta = metaUp} + let adjustMeta = + case map fst args of + (x:y:z:_) -> setMeta "title" x . setMeta "section" y . setMeta "date" z + [x,y] -> setMeta "title" x . setMeta "section" y + [x] -> setMeta "title" x + [] -> id + modifyState $ \st -> st{ stateMeta = adjustMeta $ stateMeta st } + return mempty parseSkippedContent :: PandocMonad m => ManParser m Blocks parseSkippedContent = mempty <$ (mcomment <|> memptyLine) |