@@ -63,7 +63,7 @@ List of all DocBook tags, with [x] indicating implemented:
6363[ ] bridgehead - A free-floating heading
6464[ ] callout - A “called out” description of a marked Area
6565[ ] calloutlist - A list of Callouts
66−[ ] caption - A caption
66+[x] caption - A caption
6767[ ] caution - A note of caution
6868[ ] chapter - A chapter, as of a book
6969[ ] chapterinfo - Meta-information for a Chapter
@@ -132,7 +132,7 @@ List of all DocBook tags, with [x] indicating implemented:
132132[ ] filename - The name of a file
133133[ ] firstname - The first name of a person
134134[ ] firstterm - The first occurrence of a term
135−[ ] footnote - A footnote
135+[x] footnote - A footnote
136136[ ] footnoteref - A cross reference to a footnote (a footnote mark)
137137[ ] foreignphrase - A word or phrase in a language other than the primary
138138 language of the document
@@ -177,7 +177,7 @@ List of all DocBook tags, with [x] indicating implemented:
177177[ ] indexentry - An entry in an index
178178[ ] indexinfo - Meta-information for an Index
179179[ ] indexterm - A wrapper for terms to be indexed
180−[ ] info - A wrapper for information about a component or other block. (DocBook v5)
180+[x] info - A wrapper for information about a component or other block. (DocBook v5)
181181[ ] informalequation - A displayed mathematical equation without a title
182182[ ] informalexample - A displayed example without a title
183183[ ] informalfigure - A untitled figure
@@ -186,7 +186,7 @@ List of all DocBook tags, with [x] indicating implemented:
186186[ ] inlineequation - A mathematical equation or expression occurring inline
187187[ ] inlinegraphic - An object containing or pointing to graphical data
188188 that will be rendered inline
189−[ ] inlinemediaobject - An inline media object (video, audio, image, and so on)
189+[x] inlinemediaobject - An inline media object (video, audio, image, and so on)
190190[ ] interface - An element of a GUI
191191[ ] interfacename - The name of an interface
192192[ ] invpartnumber - An inventory part number
@@ -211,7 +211,7 @@ List of all DocBook tags, with [x] indicating implemented:
211211 ancestors
212212[ ] lineannotation - A comment on a line in a verbatim listing
213213[x] link - A hypertext link
214−[ ] listitem - A wrapper for the elements of a list item
214+[x] listitem - A wrapper for the elements of a list item
215215[x] literal - Inline text that is some literal value
216216[ ] literallayout - A block of text in which line breaks and white space are
217217 to be reproduced faithfully
@@ -225,7 +225,7 @@ List of all DocBook tags, with [x] indicating implemented:
225225 with ordinary text and a small amount of markup
226226[ ] medialabel - A name that identifies the physical medium on which some
227227 information resides
228−[ ] mediaobject - A displayed media object (video, audio, image, etc.)
228+[x] mediaobject - A displayed media object (video, audio, image, etc.)
229229[ ] mediaobjectco - A media object that contains callouts
230230[ ] member - An element of a simple list
231231[ ] menuchoice - A selection or series of selections from a menu
@@ -308,7 +308,7 @@ List of all DocBook tags, with [x] indicating implemented:
308308[ ] qandaentry - A question/answer set within a QandASet
309309[ ] qandaset - A question-and-answer set
310310[ ] question - A question in a QandASet
311−[ ] quote - An inline quotation
311+[x] quote - An inline quotation
312312[ ] refclass - The scope or other indication of applicability of a
313313 reference entry
314314[ ] refdescriptor - A description of the topic of a reference page
@@ -517,6 +517,23 @@ attrValue attr elt =
517517 Just z -> z
518518 Nothing -> ""
519519
520+-- function that is used by both mediaobject (in parseBlock)
521+-- and inlinemediaobject (in parseInline)
522+getImage :: Element -> DB Inlines
523+getImage e = do
524+ imageUrl <- case filterChild
525+ (\e' -> qName (elName e') == "imageobject") e of
526+ Nothing -> return mempty
527+ Just z -> case filterChild
528+ (\e' -> qName (elName e') == "imagedata") z of
529+ Nothing -> return mempty
530+ Just i -> return $ attrValue "fileref" i
531+ caption <- case filterChild
532+ (\e' -> qName (elName e') == "caption") e of
533+ Nothing -> return mempty
534+ Just z -> mconcat <$> (mapM parseInline $ elContent z)
535+ return $ image imageUrl "" caption
536+
520537parseBlock :: Content -> DB Blocks
521538parseBlock (Text (CData CDataRaw _ _)) = return mempty -- DOCTYPE
522539parseBlock (Text (CData _ s _)) = if all isSpace s
@@ -543,6 +560,8 @@ parseBlock (Elem e) =
543560 "abstract" -> blockQuote <$> getBlocks e
544561 "itemizedlist" -> bulletList <$> listitems
545562 "orderedlist" -> orderedList <$> listitems -- TODO list attributes
563+ "mediaobject" -> para <$> (getImage e)
564+ "caption" -> return mempty
546565 "info" -> getTitle >> getAuthors >> getDate >> return mempty
547566 "articleinfo" -> getTitle >> getAuthors >> getDate >> return mempty
548567 "programlisting" -> return $ codeBlock $ strContent e -- TODO attrs
@@ -555,7 +574,7 @@ parseBlock (Elem e) =
555574 skipWhite (Text (CData _ s _):xs) | all isSpace s = skipWhite xs
556575 | otherwise = xs
557576 skipWhite xs = xs
558− listitems = mapM getBlocks $ findChildren (unqual "listitem") e
577+ listitems = mapM getBlocks $ filterChildren (\e' -> qName (elName e') == "listitem") e
559578 getTitle = case findChild (unqual "title") e of
560579 Just t -> do
561580 tit <- getInlines t
@@ -592,6 +611,7 @@ parseInline (Elem e) =
592611 case qName (elName e) of
593612 "subscript" -> subscript <$> innerInlines
594613 "superscript" -> superscript <$> innerInlines
614+ "inlinemediaobject" -> getImage e
595615 "quote" -> do
596616 qt <- gets dbQuoteType
597617 let qt' = if qt == SingleQuote then DoubleQuote else SingleQuote
@@ -611,7 +631,7 @@ parseInline (Elem e) =
611631 "userinput" -> return $ codeWith ("",["userinput"],[]) $ strContent e
612632 "varargs" -> return $ str "(…)"
613633 "ulink" -> link (attrValue "url" e) "" <$> innerInlines
614− "link" -> case findAttr (QName "href" Nothing $ Just "xlink") e of
634+ "link" -> case findAttr (QName "href" (Just "http://www.w3.org/1999/xlink") Nothing) e of
615635 Just href -> link href "" <$> innerInlines
616636 _ -> link ('#' : attrValue "linkend" e) ""
617637 <$> innerInlines