git.iko.soy/typeable/pandoc
on master help sign in
Added recognition of authorgroup element and releaseinfo element to DocBook reader.

Closes #1214

commit1b930a9670403f9c6ceadbc067fb3ac7400bd042 authorMatthew Pickering <matthewtpickering@gmail.com> dateFri 4 Apr 2014, 16:21 (13 years ago) parentb1c865c
1 file changed+16−9
src/Text/Pandoc/Readers/DocBook.hs+16−9
src/Text/Pandoc/Readers/DocBook.hs+16−9
@@ -45,7 +45,7 @@ List of all DocBook tags, with [x] indicating implemented,
4545[ ] audioobject - A wrapper for audio data and its associated meta-information
4646[x] author - The name of an individual author
4747[ ] authorblurb - A short description or note about an author
48−[ ] authorgroup - Wrapper for author information when a document has
48+[x] authorgroup - Wrapper for author information when a document has
4949 multiple authors or collabarators
5050[x] authorinitials - The initials or other short identifier for an author
5151[o] beginpage - The location of a page break in a print version of the document
@@ -341,7 +341,7 @@ List of all DocBook tags, with [x] indicating implemented,
341341[x] refsectioninfo - Meta-information for a refsection
342342[ ] refsynopsisdiv - A syntactic synopsis of the subject of the reference page
343343[ ] refsynopsisdivinfo - Meta-information for a RefSynopsisDiv
344−[ ] releaseinfo - Information about a particular release of a document
344+[x] releaseinfo - Information about a particular release of a document
345345[ ] remark - A remark (or comment) intended for presentation in a draft
346346 manuscript
347347[ ] replaceable - Content that may or must be replaced by the user
@@ -564,10 +564,11 @@ acceptingMetadata p = do
564564 modify (\s -> s { dbAcceptsMeta = False })
565565 return res
566566
567−checkInMeta :: Monoid a => DB a -> DB a
567+checkInMeta :: Monoid a => DB () -> DB a
568568checkInMeta p = do
569569 accepts <- dbAcceptsMeta <$> get
570− if accepts then p else return mempty
570+ when accepts p
571+ return mempty
571572
572573
573574
@@ -649,9 +650,11 @@ parseBlock (Elem e) =
649650 "attribution" -> return mempty
650651 "titleabbrev" -> return mempty
651652 "authorinitials" -> return mempty
652− "title" -> checkInMeta getTitle >> return mempty -- handled by getTitle or sect or figure
653− "author" -> checkInMeta getAuthor >> return mempty
654− "date" -> checkInMeta getDate >> return mempty
653+ "title" -> checkInMeta getTitle
654+ "author" -> checkInMeta getAuthor
655+ "authorgroup" -> checkInMeta getAuthorGroup
656+ "releaseinfo" -> checkInMeta (getInlines e >>= addMeta "release")
657+ "date" -> checkInMeta getDate
655658 "bibliography" -> sect 0
656659 "bibliodiv" -> sect 1
657660 "biblioentry" -> parseMixed para (elContent e)
@@ -786,7 +789,10 @@ parseBlock (Elem e) =
786789 Nothing -> return mempty
787790 addMeta "title" (tit <> subtit)
788791
789− getAuthor = getInlines e >>= addMeta "author"
792+ getAuthor = (:[]) <$> getInlines e >>= addMeta "authors"
793+ getAuthorGroup = do
794+ let terms = filterChildren (named "author") e
795+ mapM getInlines terms >>= addMeta "authors"
790796 getDate = getInlines e >>= addMeta "date"
791797 parseTable = do
792798 let isCaption x = named "title" x || named "caption" x
@@ -849,7 +855,7 @@ parseBlock (Elem e) =
849855 b <- getBlocks e
850856 modify $ \st -> st{ dbSectionLevel = n - 1 }
851857 return $ header n' headerText <> b
852− metaBlock = acceptingMetadata (getBlocks e)
858+ metaBlock = acceptingMetadata (getBlocks e) >> return mempty
853859
854860getInlines :: Element -> DB Inlines
855861getInlines e' = (trimInlines . mconcat) <$> (mapM parseInline $ elContent e')
@@ -913,6 +919,7 @@ parseInline (Elem e) =
913919 _ -> emph <$> innerInlines
914920 "footnote" -> (note . mconcat) <$> (mapM parseBlock $ elContent e)
915921 "title" -> return mempty
922+ "affiliation" -> return mempty
916923 _ -> innerInlines
917924 where innerInlines = (trimInlines . mconcat) <$>
918925 (mapM parseInline $ elContent e)