From 8d4680bbfe6cfcfc1890cf23491edc4fcc3bca04 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 21 Apr 2012 09:27:38 -0700 Subject: DocBook reader: Handle blockquote with attribution. --- src/Text/Pandoc/Readers/DocBook.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index 826fed8b8..c69cdee10 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -33,7 +33,7 @@ List of all DocBook tags, with [x] indicating implemented: [ ] article - An article [x] articleinfo - Meta-information for an Article [ ] artpagenums - The page numbers of an article as published -[ ] attribution - The source of a block quote or epigraph +[x] attribution - The source of a block quote or epigraph [ ] audiodata - Pointer to external audio data [ ] audioobject - A wrapper for audio data and its associated meta-information [x] author - The name of an individual author @@ -118,6 +118,7 @@ List of all DocBook tags, with [x] indicating implemented: [ ] entrytbl - A subtable appearing in place of an Entry in a table [ ] envar - A software environment variable [ ] epigraph - A short inscription at the beginning of a document or component + note: also handle embedded attribution tag [ ] equation - A displayed mathematical equation [ ] errorcode - An error code [ ] errorname - An error name @@ -524,7 +525,15 @@ parseBlock (Text (CData _ s _)) = if all isSpace s parseBlock (Elem e) = case qName (elName e) of "para" -> para <$> getInlines e - "blockquote" -> blockQuote <$> getBlocks e + "blockquote" -> do + attrib <- case filterChild + (\e' -> qName (elName e') == "attribution") e of + Nothing -> return mempty + Just z -> (para . (str "— " <>) . mconcat) + <$> (mapM parseInline $ elContent z) + contents <- getBlocks e + return $ blockQuote (contents <> attrib) + "attribution" -> return mempty "sect1" -> sect 1 "sect2" -> sect 2 "sect3" -> sect 3 -- cgit v1.2.3