diff options
-rw-r--r-- | src/Text/Pandoc/Readers/JATS.hs | 8 | ||||
-rw-r--r-- | test/command/6288.md | 8 |
2 files changed, 15 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 } diff --git a/test/command/6288.md b/test/command/6288.md new file mode 100644 index 000000000..29aff0fb9 --- /dev/null +++ b/test/command/6288.md @@ -0,0 +1,8 @@ +``` +% pandoc -f jats -t native +<sec> +<label>I</label><title>Introduction</title> +</sec> +^D +[Header 1 ("",[],[]) [Str "I.",Space,Str "Introduction"]] +``` |