aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-05-12 18:34:15 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-05-12 18:34:15 -0700
commita5f71e5fad45e2daaae8e8dcf509a937bdb8ed73 (patch)
tree9816c240029ede48e5e7a532859c897e6f635bbb /src/Text/Pandoc
parent6dfaf43f3e17ffbb36ed08a20adf26bf3af09b88 (diff)
downloadpandoc-a5f71e5fad45e2daaae8e8dcf509a937bdb8ed73.tar.gz
DocBook: support segmentedlist.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 30f814ea4..93c409918 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -378,10 +378,10 @@ List of all DocBook tags, with [x] indicating implemented,
in the index
[ ] seealsoie - A See also entry in an index, rather than in the text
[ ] seeie - A See entry in an index, rather than in the text
-[ ] seg - An element of a list item in a segmented list
-[ ] seglistitem - A list item in a segmented list
-[ ] segmentedlist - A segmented list, a list of sets of elements
-[ ] segtitle - The title of an element of a list item in a segmented list
+[x] seg - An element of a list item in a segmented list
+[x] seglistitem - A list item in a segmented list
+[x] segmentedlist - A segmented list, a list of sets of elements
+[x] segtitle - The title of an element of a list item in a segmented list
[ ] seriesvolnums - Numbers of the volumes in a series of books
[ ] set - A collection of books
[ ] setindex - An index to a set of books
@@ -840,6 +840,7 @@ parseInline (Elem e) =
then singleQuoted contents
else doubleQuoted contents
"simplelist" -> simpleList
+ "segmentedlist" -> segmentedList
"code" -> codeWithLang
"filename" -> codeWithLang
"literal" -> codeWithLang
@@ -888,3 +889,15 @@ parseInline (Elem e) =
return $ codeWith (attrValue "id" e,classes',[]) $ strContent e
simpleList = (mconcat . intersperse (str "," <> space)) <$> mapM getInlines
(filterChildren (named "member") e)
+ segmentedList = do
+ tit <- maybe (return mempty) getInlines $ filterChild (named "title") e
+ segtits <- mapM getInlines $ filterChildren (named "segtitle") e
+ segitems <- mapM (mapM getInlines . filterChildren (named "seg"))
+ $ filterChildren (named "seglistitem") e
+ let toSeg = mconcat . zipWith (\x y -> strong (x <> str ":") <> space <>
+ y <> linebreak) segtits
+ let segs = mconcat $ map toSeg segitems
+ let tit' = if tit == mempty
+ then mempty
+ else strong tit <> linebreak
+ return $ linebreak <> tit' <> segs