diff options
| author | John MacFarlane <[email protected]> | 2023-10-26 17:04:55 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-10-26 17:04:55 -0700 |
| commit | 5ed86e69c47c3ac1a9d803ac3e52c8c09a025b4e (patch) | |
| tree | 80c6ba83134bb83428c43a0006482be927af4441 | |
| parent | 88cb8e699a0ebd6557e3d1b360ac74d97db2107c (diff) | |
Make `reference-section-title` work with `jats+element_citations`.
Closes #9021.
| -rw-r--r-- | src/Text/Pandoc/Writers/JATS.hs | 8 | ||||
| -rw-r--r-- | test/command/7042.md | 1 | ||||
| -rw-r--r-- | test/command/9021.md | 61 |
3 files changed, 69 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs index 153dfc133..d6a12b295 100644 --- a/src/Text/Pandoc/Writers/JATS.hs +++ b/src/Text/Pandoc/Writers/JATS.hs @@ -292,7 +292,13 @@ blockToJATS opts (Div ("refs",_,_) xs) = do refs <- asks jatsReferences contents <- if null refs then blocksToJATS opts xs - else referencesToJATS opts refs + else do + titleElement <- case xs of + (Header _ _ title:_) -> + inTagsSimple "title" <$> inlinesToJATS opts title + _ -> return mempty + elementRefs <- referencesToJATS opts refs + return $ titleElement $$ elementRefs return $ inTagsIndented "ref-list" contents blockToJATS opts (Div (ident,[cls],kvs) bs) | cls `elem` ["fig", "caption", "table-wrap"] = do contents <- blocksToJATS opts bs diff --git a/test/command/7042.md b/test/command/7042.md index 6aa229f57..fec3c4b3b 100644 --- a/test/command/7042.md +++ b/test/command/7042.md @@ -81,6 +81,7 @@ references: </body> <back> <ref-list> + <title></title> <ref id="ref-year-month"> <element-citation publication-type="article-journal"> <person-group person-group-type="author"> diff --git a/test/command/9021.md b/test/command/9021.md new file mode 100644 index 000000000..4bb439587 --- /dev/null +++ b/test/command/9021.md @@ -0,0 +1,61 @@ +``` +% pandoc -t jats+element_citations --citeproc -s +--- +references: +- author: DeGroot + id: degroot_probability + title: Probability + issued: 2002 +title: Doc example with single reference +reference-section-title: Ref Title +--- + +# I like + +[@degroot_probability]. +^D +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN" + "JATS-archivearticle1.dtd"> +<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other"> +<front> +<journal-meta> +<journal-id></journal-id> +<journal-title-group> +</journal-title-group> +<issn></issn> +<publisher> +<publisher-name></publisher-name> +</publisher> +</journal-meta> +<article-meta> +<title-group> +<article-title>Doc example with single reference</article-title> +</title-group> +<permissions> +</permissions> +</article-meta> +</front> +<body> +<sec id="i-like"> + <title>I like</title> + <p>(DeGroot 2002).</p> +</sec> +</body> +<back> +<ref-list> + <title>Ref Title</title> + <ref id="ref-degroot_probability"> + <element-citation> + <person-group person-group-type="author"> + <string-name>DeGroot</string-name> + </person-group> + <article-title>Probability</article-title> + <year iso-8601-date="2002">2002</year> + </element-citation> + </ref> +</ref-list> +</back> +</article> + +``` |
