aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-04-15 09:23:04 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-04-15 09:23:04 -0700
commit71c4857464c82f5c9c527d99de43061cda22ef48 (patch)
tree8e0037e7302a22b3cdf6e9e253c269e0143f448b /src/Text/Pandoc/Readers
parent20c1c297b295e5da4433e6fe59d03ef8ac109337 (diff)
downloadpandoc-71c4857464c82f5c9c527d99de43061cda22ef48.tar.gz
JATS reader: handle "label" element in section title.
Closes #6288.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 597e798ab..3672b05f6 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -176,6 +176,7 @@ parseBlock (Elem e) =
"article-meta" -> parseMetadata e
"custom-meta" -> parseMetadata e
"title" -> return mempty -- processed by header
+ "label" -> return mempty -- processed by header
"table" -> parseTable
"fig" -> parseFigure
"fig-group" -> divWith (attrValue "id" e, ["fig-group"], [])
@@ -289,10 +290,15 @@ parseBlock (Elem e) =
parseRow = mapM (parseMixed plain . elContent) . filterChildren isEntry
sect n = do isbook <- gets jatsBook
let n' = if isbook || n == 0 then n + 1 else n
+ labelText <- case filterChild (named "label") e of
+ Just t -> (<> ("." <> space)) <$>
+ getInlines t
+ Nothing -> return mempty
headerText <- case filterChild (named "title") e `mplus`
(filterChild (named "info") e >>=
filterChild (named "title")) of
- Just t -> getInlines t
+ Just t -> (labelText <>) <$>
+ getInlines t
Nothing -> return mempty
oldN <- gets jatsSectionLevel
modify $ \st -> st{ jatsSectionLevel = n }