From 9d28e6029f71f769756ee6d121822de5b0f2aed6 Mon Sep 17 00:00:00 2001 From: Julia Diaz Date: Mon, 28 Aug 2023 16:15:05 +0200 Subject: [PATCH] Add support for metadata --- src/Text/Pandoc/Readers/JATS.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs index 5a115f99b61b..8e603c29f69b 100644 --- a/src/Text/Pandoc/Readers/JATS.hs +++ b/src/Text/Pandoc/Readers/JATS.hs @@ -393,6 +393,7 @@ parseMetadata e = do getAffiliations e getAbstract e getPubDate e + getPermissions e return mempty getTitle :: PandocMonad m => Element -> JATS m () @@ -457,6 +458,25 @@ getContrib x = do then return $ given <> family else return $ given <> space <> family +getPermissions :: PandocMonad m => Element -> JATS m () +getPermissions e = do + statement <- case filterElement (named "copyright-statement") e of + Just s -> getInlines s + Nothing -> return mempty + year <- case filterElement (named "copyright-year") e of + Just s -> getInlines s + Nothing -> return mempty + holder <- case filterElement (named "copyright-holder") e of + Just s -> getInlines s + Nothing -> return mempty + license <- case filterElement (named "license") e of + Just s -> getBlocks s + Nothing -> return mempty + when (statement /= mempty) $ addMeta "copyright-statement" statement + when (year /= mempty) $ addMeta "copyright-year" year + when (holder /= mempty) $ addMeta "copyright-holder" holder + when (license /= mempty) $ addMeta "license" license + parseRefList :: PandocMonad m => Element -> JATS m Blocks parseRefList e = do refs <- mapM parseRef $ filterChildren (named "ref") e