git.iko.soy/typeable/pandoc
on master help sign in
DocBook reader: Handle blockquote with attribution.
commit8d4680bbfe6cfcfc1890cf23491edc4fcc3bca04 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 21 Apr 2012, 09:27 (15 years ago) parent255897b
1 file changed+11−2
src/Text/Pandoc/Readers/DocBook.hs+11−2
src/Text/Pandoc/Readers/DocBook.hs+11−2
@@ -33,7 +33,7 @@ List of all DocBook tags, with [x] indicating implemented:
3333[ ] article - An article
3434[x] articleinfo - Meta-information for an Article
3535[ ] artpagenums - The page numbers of an article as published
36−[ ] attribution - The source of a block quote or epigraph
36+[x] attribution - The source of a block quote or epigraph
3737[ ] audiodata - Pointer to external audio data
3838[ ] audioobject - A wrapper for audio data and its associated meta-information
3939[x] author - The name of an individual author
@@ -118,6 +118,7 @@ List of all DocBook tags, with [x] indicating implemented:
118118[ ] entrytbl - A subtable appearing in place of an Entry in a table
119119[ ] envar - A software environment variable
120120[ ] epigraph - A short inscription at the beginning of a document or component
121+ note: also handle embedded attribution tag
121122[ ] equation - A displayed mathematical equation
122123[ ] errorcode - An error code
123124[ ] errorname - An error name
@@ -524,7 +525,15 @@ parseBlock (Text (CData _ s _)) = if all isSpace s
524525parseBlock (Elem e) =
525526 case qName (elName e) of
526527 "para" -> para <$> getInlines e
527− "blockquote" -> blockQuote <$> getBlocks e
528+ "blockquote" -> do
529+ attrib <- case filterChild
530+ (\e' -> qName (elName e') == "attribution") e of
531+ Nothing -> return mempty
532+ Just z -> (para . (str "— " <>) . mconcat)
533+ <$> (mapM parseInline $ elContent z)
534+ contents <- getBlocks e
535+ return $ blockQuote (contents <> attrib)
536+ "attribution" -> return mempty
528537 "sect1" -> sect 1
529538 "sect2" -> sect 2
530539 "sect3" -> sect 3