From 5082b5411bdb1acb5b0dba9cbdfa346b96f1e309 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 7 Dec 2009 08:26:53 +0000 Subject: Improved syntax for markdown definition lists. Definition lists are now more compatible with PHP Markdown Extra. Resolves Issue #24. + You can have multiple definitions for a term (but still not multiple terms). + Multi-block definitions no longer need a column before each block (indeed, this will now cause multiple definitions). + The marker no longer needs to be flush with the left margin, but can be indented at or two spaces. Also, ~ as well as : can be used as the marker (this suggestion due to David Wheeler.) + There can now be a blank line between the term and the definitions. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1656 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/Man.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc/Writers/Man.hs') diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 616795e31..3270337d7 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -242,19 +242,19 @@ orderedListItemToMan opts num indent (first:rest) = do -- | Convert definition list item (label, list of blocks) to man. definitionListItemToMan :: WriterOptions - -> ([Inline],[Block]) + -> ([Inline],[[Block]]) -> State WriterState Doc -definitionListItemToMan opts (label, items) = do +definitionListItemToMan opts (label, defs) = do labelText <- inlineListToMan opts label - contents <- if null items + contents <- if null defs then return empty - else do - let (first, rest) = case items of + else liftM vcat $ forM defs $ \blocks -> do + let (first, rest) = case blocks of ((Para x):y) -> (Plain x,y) (x:y) -> (x,y) - [] -> error "items is null" - rest' <- mapM (\item -> blockToMan opts item) - rest >>= (return . vcat) + [] -> error "blocks is null" + rest' <- liftM vcat $ + mapM (\item -> blockToMan opts item) rest first' <- blockToMan opts first return $ first' $$ text ".RS" $$ rest' $$ text ".RE" return $ text ".TP\n.B " <> labelText $+$ contents -- cgit v1.2.3