From 19175af811b7a95c4e732466cddac04947c01917 Mon Sep 17 00:00:00 2001
From: Albert Krewinkel <albert@zeitkraut.de>
Date: Sun, 28 Jun 2020 19:35:50 +0200
Subject: JATS reader: parse abstract element into metadata field of same name
 (#6482)

Closes: #6480
---
 src/Text/Pandoc/Readers/JATS.hs | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'src')

diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index d7f87f695..d3d742de3 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -317,6 +317,7 @@ parseMetadata e = do
   getTitle e
   getAuthors e
   getAffiliations e
+  getAbstract e
   return mempty
 
 getTitle :: PandocMonad m => Element -> JATS m ()
@@ -348,6 +349,14 @@ getAffiliations x = do
   affs <- mapM getInlines $ filterChildren (named "aff") x
   unless (null affs) $ addMeta "institute" affs
 
+getAbstract :: PandocMonad m => Element -> JATS m ()
+getAbstract e =
+  case filterElement (named "abstract") e of
+    Just s -> do
+      blks <- getBlocks s
+      addMeta "abstract" blks
+    Nothing -> pure ()
+
 getContrib :: PandocMonad m => Element -> JATS m Inlines
 getContrib x = do
   given <- maybe (return mempty) getInlines
-- 
cgit v1.2.3