git.iko.soy/typeable/pandoc
on master help sign in
JATS reader: include institute metadata.
790dc25John MacFarlane
src/Text/Pandoc/Readers/JATS.hs+11−2
@@ -248,7 +248,13 @@ parseBlock (Elem e) =
248 authors <- mapM getContrib $ filterChildren
248 authors <- mapM getContrib $ filterChildren
249 (\x -> named "contrib" x &&
249 (\x -> named "contrib" x &&
250 attrValue "contrib-type" x == "author") e
250 attrValue "contrib-type" x == "author") e
251+ unless (null authors) $
251− unless (null authors) $ addMeta "author" 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
252
258
253 getContrib :: PandocMonad m => Element -> JATS m Inlines
259 getContrib :: PandocMonad m => Element -> JATS m Inlines
254 getContrib x = do
260 getContrib x = do
@@ -328,7 +334,10 @@ parseBlock (Elem e) =
328 modify $ \st -> st{ jatsSectionLevel = oldN }
334 modify $ \st -> st{ jatsSectionLevel = oldN }
329 return $ headerWith (ident,[],[]) n' headerText <> b
335 return $ headerWith (ident,[],[]) n' headerText <> b
330-- lineItems = mapM getInlines $ filterChildren (named "line") e
336-- lineItems = mapM getInlines $ filterChildren (named "line") e
337+ metaBlock = do
331− metaBlock = acceptingMetadata (getBlocks e) >> return mempty
338+ acceptingMetadata (getBlocks e)
339+ getAffiliations e
340+ return mempty
332
341
333getInlines :: PandocMonad m => Element -> JATS m Inlines
342getInlines :: PandocMonad m => Element -> JATS m Inlines
334getInlines e' = (trimInlines . mconcat) <$>
343getInlines e' = (trimInlines . mconcat) <$>