diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-05-09 00:47:29 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-05-09 00:47:29 +0000 |
commit | 5454c841a923bc13caa424537a84d24d1c602e40 (patch) | |
tree | a7385d1648b6a960361e11df23f548274e84b722 /src/Text | |
parent | 71cf0a11b37000df1bd9996fbdb65d98c1c30584 (diff) | |
download | pandoc-5454c841a923bc13caa424537a84d24d1c602e40.tar.gz |
Added support for definition lists in Docbook writer.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@595 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Docbook.hs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 9fce1c061..2fa1e8b40 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -152,6 +152,24 @@ elementToDocbook opts (Sec title elements) = blocksToDocbook :: WriterOptions -> [Block] -> Doc blocksToDocbook opts = vcat . map (blockToDocbook opts) +-- | Auxiliary function to convert Plain block to Para. +plainToPara (Plain x) = Para x +plainToPara x = x + +-- | Convert a list of pairs of terms and definitions into a list of +-- Docbook varlistentrys. +deflistItemsToDocbook :: WriterOptions -> [([Inline],[Block])] -> Doc +deflistItemsToDocbook opts items = + vcat $ map (\(term, def) -> deflistItemToDocbook opts term def) items + +-- | Convert a term and a list of blocks into a Docbook varlistentry. +deflistItemToDocbook :: WriterOptions -> [Inline] -> [Block] -> Doc +deflistItemToDocbook opts term def = + let def' = map plainToPara def in + inTagsIndented "varlistentry" $ + inTagsIndented "term" (inlinesToDocbook opts term) $$ + inTagsIndented "listitem" (blocksToDocbook opts def') + -- | Convert a list of lists of blocks to a list of Docbook list items. listItemsToDocbook :: WriterOptions -> [[Block]] -> Doc listItemsToDocbook opts items = @@ -160,8 +178,6 @@ listItemsToDocbook opts items = -- | Convert a list of blocks into a Docbook list item. listItemToDocbook :: WriterOptions -> [Block] -> Doc listItemToDocbook opts item = - let plainToPara (Plain x) = Para x - plainToPara y = y in let item' = map plainToPara item in inTagsIndented "listitem" (blocksToDocbook opts item') @@ -179,6 +195,8 @@ blockToDocbook opts (BulletList lst) = inTagsIndented "itemizedlist" $ listItemsToDocbook opts lst blockToDocbook opts (OrderedList lst) = inTagsIndented "orderedlist" $ listItemsToDocbook opts lst +blockToDocbook opts (DefinitionList lst) = + inTagsIndented "variablelist" $ deflistItemsToDocbook opts lst blockToDocbook opts (RawHtml str) = text str -- raw XML block blockToDocbook opts HorizontalRule = empty -- not semantic blockToDocbook opts (Table caption aligns widths headers rows) = |