Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add <title>References to <ref-list> for references in JATS output #8364

Closed
castedo opened this issue Oct 9, 2022 · 11 comments
Closed

Add <title>References to <ref-list> for references in JATS output #8364

castedo opened this issue Oct 9, 2022 · 11 comments

Comments

@castedo
Copy link
Contributor

castedo commented Oct 9, 2022

This feature request is to include a <title> in the <ref-list> that is generated for references. As of 2.19.2 it is not output.

For example, here's what pandoc generates:

<back>
  <ref-list>
    <ref id="ref-shannon_mathematical_1998">
      <element-citation publication-type="book">
      ...
      </element-citation>
    </ref>
  </ref-list>
</back>

whereas this is what an eLife XML file (#63435-v3) looks like:

<back>
  ...
  <ref-list>
    <title>References</title>
    <ref id="bib1">
      <element-citation publication-type="journal">
      ...
      </element-citation>
    </ref>
...
</back>

The pandoc command is the following:

pandoc input.md -s --to=jats+element_citations --citeproc --metadata link-citations=true

with the attached input.md.

In addition to producing JATS XML that is more compatible with other JATS readers, I suspect this feature will also be useful for a separate pandoc JATS reading feature I'll submit separately.

I would tweak the JATS template if I could to get this functionality but the entire <back> element is generated from one $back$ template variable.

@jgm
Copy link
Owner

jgm commented Oct 9, 2022

Does it help if you put reference-section-title in your metadata?
(see the manual)

@castedo
Copy link
Contributor Author

castedo commented Oct 10, 2022

Good idea! I didn't know about that. But sadly it does not add the title into the <back><ref-list>, only the body.

@jgm
Copy link
Owner

jgm commented Oct 10, 2022

Can you quote the xml more fully so I can see where it adds the title?

@castedo
Copy link
Contributor Author

castedo commented Oct 10, 2022

My pleasure!

...
<article ... >
...
  <body>
...
  </body>
  <back>
...
    <ref-list>
      <title>References</title>
      <ref id="bib1">
...
      </ref>
...
    </ref-list>
  </back>
...
</article>

The full XML in all its glory is here:
https://raw.githubusercontent.com/elifesciences/elife-article-xml/master/articles/elife-63435-v3.xml

@jgm
Copy link
Owner

jgm commented Oct 10, 2022

I meant, where does pandoc currently add the title when you use reference-section-title?

@castedo
Copy link
Contributor Author

castedo commented Oct 10, 2022

With reference-section-title: Referencias added to input.md meta I get:

<article ... >
...
<body>
...
<sec id="bibliography">
  <title>Referencias</title>
</sec>
</body>
<back>
<ref-list>
  <ref id="ref-shannon_mathematical_1998">
    <element-citation publication-type="book">
...
      <isbn>978-0-252-72548-7 978-0-252-72546-3</isbn>
    </element-citation>
  </ref>
</ref-list>
</back>
</article>

@jgm
Copy link
Owner

jgm commented Oct 10, 2022

Oh, yes, that's no good at all.

@castedo
Copy link
Contributor Author

castedo commented Apr 28, 2023

A quick update: I hack around this limitation in wrapper utilities of pandoc for generating JATS XML. After calling pandoc, I string replace <ref-list> in pandoc's XML output with <ref-list><title>References</title> An example of this hack in this this utility:

https://gitlab.com/castedo/jatex/-/blob/7b90d1eebf44e976d54d26c07437fc20fa6a87aa/jatex/__init__.py#L31

@jgm
Copy link
Owner

jgm commented Jun 7, 2023

I've made some changes that yield this output:

<?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>
<permissions>
</permissions>
</article-meta>
</front>
<body>
<p>Doe (2006)</p>
</body>
<back>
<ref-list>
  <title>References</title>
  <ref id="ref-test">
    <mixed-citation>Doe, J. (2006). Test,
    <italic>81</italic>.</mixed-citation>
  </ref>
</ref-list>
</back>
</article>

I think that's desired.

@jgm jgm closed this as completed in 4f44058 Jun 7, 2023
@castedo
Copy link
Contributor Author

castedo commented Aug 23, 2023

Oh bummer. @jgm That test case is beautiful, but it missed a regression bug with a heading in the input document: #9017 Sorry!

@castedo
Copy link
Contributor Author

castedo commented Aug 24, 2023

This enhancement does not appear to be working for element citations, see #9021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants