git.iko.soy/typeable/pandoc
on master help sign in
Added support for definition lists to RST writer.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@592 788f1e2b-df1e-0410-8736-df70ead52e1b

commit09fa7e6f63f595d0921e8c1eb11225fee5ebd580 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 3 May 2007, 14:44 (19 years ago) parent292d2bd
1 file changed+10
src/Text/Pandoc/Writers/RST.hs+10
src/Text/Pandoc/Writers/RST.hs+10
@@ -185,6 +185,9 @@ blockToRST opts (OrderedList items) = do
185185 contents <- mapM (\(item, num) -> orderedListItemToRST opts item num) $
186186 zip [1..] items
187187 return $ (vcat contents) <> text "\n"
188+blockToRST opts (DefinitionList items) = do
189+ contents <- mapM (definitionListItemToRST opts) items
190+ return $ (vcat contents) <> text "\n"
188191
189192-- | Convert bullet list item (list of blocks) to RST.
190193bulletListItemToRST :: WriterOptions -> [Block] -> State WriterState Doc
@@ -203,6 +206,13 @@ orderedListItemToRST opts num items = do
203206 return $ hang (text ((show num) ++ "." ++ spacer)) (writerTabStop opts)
204207 contents
205208
209+-- | Convert defintion list item (label, list of blocks) to RST.
210+definitionListItemToRST :: WriterOptions -> ([Inline], [Block]) -> State WriterState Doc
211+definitionListItemToRST opts (label, items) = do
212+ label <- inlineListToRST opts label
213+ contents <- blockListToRST opts items
214+ return $ label $+$ nest (writerTabStop opts) contents
215+
206216-- | Convert list of Pandoc block elements to RST.
207217blockListToRST :: WriterOptions -- ^ Options
208218 -> [Block] -- ^ List of block elements