From 71c4857464c82f5c9c527d99de43061cda22ef48 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 15 Apr 2020 09:23:04 -0700 Subject: JATS reader: handle "label" element in section title. Closes #6288. --- src/Text/Pandoc/Readers/JATS.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 } -- cgit v1.2.3