git.iko.soy/typeable/pandoc
on master help sign in
JATS reader: include institute metadata.
commit790dc2546b965853dbcaa8db1a36dd05b147ef85 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 23 Dec 2017, 10:20 (9 years ago) parent6b63b63
1 file changed+11−2
src/Text/Pandoc/Readers/JATS.hs+11−2
src/Text/Pandoc/Readers/JATS.hs+11−2
@@ -248,7 +248,13 @@ parseBlock (Elem e) =
248248 authors <- mapM getContrib $ filterChildren
249249 (\x -> named "contrib" x &&
250250 attrValue "contrib-type" x == "author") e
251− unless (null authors) $ addMeta "author" authors
251+ unless (null authors) $
252+ addMeta "author" authors
253+
254+ getAffiliations :: PandocMonad m => Element -> JATS m ()
255+ getAffiliations x = do
256+ affs <- mapM getInlines $ filterChildren (named "aff") x
257+ unless (null affs) $ addMeta "institute" affs
252258
253259 getContrib :: PandocMonad m => Element -> JATS m Inlines
254260 getContrib x = do
@@ -328,7 +334,10 @@ parseBlock (Elem e) =
328334 modify $ \st -> st{ jatsSectionLevel = oldN }
329335 return $ headerWith (ident,[],[]) n' headerText <> b
330336-- lineItems = mapM getInlines $ filterChildren (named "line") e
331− metaBlock = acceptingMetadata (getBlocks e) >> return mempty
337+ metaBlock = do
338+ acceptingMetadata (getBlocks e)
339+ getAffiliations e
340+ return mempty
332341
333342getInlines :: PandocMonad m => Element -> JATS m Inlines
334343getInlines e' = (trimInlines . mconcat) <$>