aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-05-03 14:44:28 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-05-03 14:44:28 +0000
commit09fa7e6f63f595d0921e8c1eb11225fee5ebd580 (patch)
treedb3d49e540782e0bbf076f29a9a2a549004d083c /src/Text
parent292d2bd38dafdfb4a8837b334adc2174c9501169 (diff)
downloadpandoc-09fa7e6f63f595d0921e8c1eb11225fee5ebd580.tar.gz
Added support for definition lists to RST writer.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@592 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index a00ab1cc6..a46520fbd 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -185,6 +185,9 @@ blockToRST opts (OrderedList items) = do
contents <- mapM (\(item, num) -> orderedListItemToRST opts item num) $
zip [1..] items
return $ (vcat contents) <> text "\n"
+blockToRST opts (DefinitionList items) = do
+ contents <- mapM (definitionListItemToRST opts) items
+ return $ (vcat contents) <> text "\n"
-- | Convert bullet list item (list of blocks) to RST.
bulletListItemToRST :: WriterOptions -> [Block] -> State WriterState Doc
@@ -203,6 +206,13 @@ orderedListItemToRST opts num items = do
return $ hang (text ((show num) ++ "." ++ spacer)) (writerTabStop opts)
contents
+-- | Convert defintion list item (label, list of blocks) to RST.
+definitionListItemToRST :: WriterOptions -> ([Inline], [Block]) -> State WriterState Doc
+definitionListItemToRST opts (label, items) = do
+ label <- inlineListToRST opts label
+ contents <- blockListToRST opts items
+ return $ label $+$ nest (writerTabStop opts) contents
+
-- | Convert list of Pandoc block elements to RST.
blockListToRST :: WriterOptions -- ^ Options
-> [Block] -- ^ List of block elements