-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Compile to JATS #50
Comments
Hi @bokamm, it would be easy to add the lua converter (it is a pandoc writer plugin), but pandoc does offer several native outputs already:
https://pandoc.org/MANUAL.html#option--to The real problem is how to read the metadata. Scrivomatic uses my own filter to read academic metadata (author affiliations etc.) and I don't see how Pandoc will understand these, so we need to convert them to whatever JATs uses: I don't yet understand if this is for read and/or write. Here is how we can test:
---
title: A JATS Test
date: 2024-01-02
author:
- surname: Doe
given-names: Jane
orcid: XXXXXXXXXXXXX
affiliation: ioa
affiliation:
- id: ioa
organization: Inst. of Allopecia
country: Indonesia
article:
- doi: 10.234/23222.54
pmid: 3244343333
heading: testing
funding: Dept. of Thin Air
journal:
- publisher-id: JOHTEST
title: Journal of Hair
abstract: |
This is the abstract of the article. Blah blah blah.
tags: jats, pandoc, test
---
# Intro
Blah blah blah.
# Conclusion
Blah blah blah.
<?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>A JATS Test</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">XXXXXXXXXXXXX</contrib-id>
<name>
<surname>Doe</surname>
<given-names>Jane</given-names>
</name>
<xref ref-type="aff" rid="aff-ioa"/>
</contrib>
<aff id="aff-ioa">
<institution-wrap>
<institution>Inst. of Allopecia</institution>
</institution-wrap>,
<country>Indonesia</country>
</aff>
</contrib-group>
<pub-date date-type="pub" publication-format="electronic" iso-8601-date="2024-01-02">
<day>2</day>
<month>1</month>
<year>2024</year>
</pub-date>
<permissions>
</permissions>
<abstract>
<p>This is the abstract of the article. Blah blah blah.</p>
</abstract>
<kwd-group kwd-group-type="author">
<kwd>jats, pandoc, test</kwd>
</kwd-group>
</article-meta>
</front>
<body>
<sec id="intro">
<title>Intro</title>
<p>Blah blah blah.</p>
</sec>
<sec id="conclusion">
<title>Conclusion</title>
<p>Blah blah blah.</p>
</sec>
</body>
<back>
</back>
</article> It seems Pandoc can read the YAML metadata we can store in Scrivener, and output to XML -- looks promising! The journal output is wrong, not sure why... I am totally ignorant of what JATS is supposed to look like. If you can get this to work manually (running the pandoc command directly) it will be easy for me to adapt to scrivomatic. The problem is that my metadata is not compatible with JATS so we may need some preprocessing to convert the metadata I use into the one JATS needs... Do you need this for existing projects or you are starting a new one? |
Wow, you are fast! Thank you! I thought about using this for a future project but have a couple of previous ones, which I would love to convert to JATS XML if this works. I will try this on an existing md-compile to see what happens. It's late over here, so please excuse if I will post the results tomorrow! |
OK, I used an existing project and compiled it for HTML. Then used the md-file and converted it to JATS XML. |
OK, so we know at present the scrivomatic pipeline will not produce working authors, and I can't get journal name to work so something wrong there. For footnotes, citations and images, are they supposed to be supported? There are several jats variants, some for archiving, lets see if those support footnotes, citations and images: ---
title: A JATS Test
date: 2024-01-02
author:
- surname: Doe
given-names: Jane
orcid: XXXXXXXXXXXXX
affiliation: ioa
affiliation:
- id: ioa
organization: Inst. of Allopecia
country: Indonesia
article:
- doi: 10.234/23222.54
pmid: 3244343333
heading: testing
funding: Dept. of Thin Air
journal:
- publisher-id: JOHTEST
title: Journal of Hair
abstract: |
This is the abstract of the article. Blah blah blah.
tags: jats, pandoc, test
---
# Intro
Blah blah blah[^fn1].
![**Figure 1** — This is a fascinating caption.][image]
# Conclusion
Blah blah blah [@shipp2013].
# Bibliography
::: {#refs}
:::
[image]: placeholder.png
[^fn1]: Test footnote Outputs:
<h1 id="intro">Intro</h1>
<p>Blah blah blah<a href="#fn1" class="footnote-ref" id="fnref1"
role="doc-noteref"><sup>1</sup></a>.</p>
<figure>
<img src="placeholder.png"
alt="Figure 1 — This is a fascinating caption." />
<figcaption aria-hidden="true"><strong>Figure 1</strong> — This is a
fascinating caption.</figcaption>
</figure>
<h1 id="conclusion">Conclusion</h1>
<p>Blah blah blah <span class="citation" data-cites="shipp2013">(Shipp,
Adams, and Friston 2013)</span>.</p>
<h1 id="bibliography">Bibliography</h1>
<div id="refs" class="references csl-bib-body hanging-indent"
data-entry-spacing="0" role="list">
<div id="ref-shipp2013" class="csl-entry" role="listitem">
Shipp, S, Rick A. Adams, and KJ Friston. 2013. <span>“Reflections on
Agranular Architecture: Predictive Coding in the Motor Cortex.”</span>
<em>Trends in Neurosciences</em> 36 (12): 706–16. <a
href="https://doi.org/10.1016/j.tins.2013.09.004">https://doi.org/10.1016/j.tins.2013.09.004</a>.
</div>
</div>
<section id="footnotes" class="footnotes footnotes-end-of-document"
role="doc-endnotes">
<hr />
<ol>
<li id="fn1"><p>Test footnote<a href="#fnref1" class="footnote-back"
role="doc-backlink">↩︎</a></p></li>
</ol>
</section> Standard jats:
Interestingly, the citation is rendered, the footnote is formatted but they don't link to any content. The Bibliography section is missing!? I tried the other two jats options with the same result... In fact this is because they exist outside the body, if I add
<?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>A JATS Test</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<contrib-id contrib-id-type="orcid">XXXXXXXXXXXXX</contrib-id>
<name>
<surname>Doe</surname>
<given-names>Jane</given-names>
</name>
<xref ref-type="aff" rid="aff-ioa"/>
</contrib>
<aff id="aff-ioa">
<institution-wrap>
<institution>Inst. of Allopecia</institution>
</institution-wrap>,
<country>Indonesia</country>
</aff>
</contrib-group>
<pub-date date-type="pub" publication-format="electronic" iso-8601-date="2024-01-02">
<day>2</day>
<month>1</month>
<year>2024</year>
</pub-date>
<permissions>
</permissions>
<abstract>
<p>This is the abstract of the article. Blah blah blah.</p>
</abstract>
<kwd-group kwd-group-type="author">
<kwd>jats, pandoc, test</kwd>
</kwd-group>
</article-meta>
</front>
<body>
<sec id="intro">
<title>Intro</title>
<p>Blah blah blah<xref ref-type="fn" rid="fn1">1</xref>.</p>
<fig>
<caption><p><bold>Figure 1</bold> — This is a fascinating
caption.</p></caption>
<graphic mimetype="image" mime-subtype="png" xlink:href="placeholder.png" />
</fig>
</sec>
<sec id="conclusion">
<title>Conclusion</title>
<p>Blah blah blah (Shipp, Adams, and Friston 2013).</p>
</sec>
</body>
<back>
<ref-list>
<title>Bibliography</title>
<ref id="ref-shipp2013">
<mixed-citation>Shipp, S, Rick A. Adams, and KJ Friston. 2013.
“Reflections on Agranular Architecture: Predictive Coding in the
Motor Cortex.” <italic>Trends in Neurosciences</italic> 36 (12):
706–16.
<ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1016/j.tins.2013.09.004">https://doi.org/10.1016/j.tins.2013.09.004</ext-link>.</mixed-citation>
</ref>
</ref-list>
<fn-group>
<fn id="fn1">
<label>1</label><p>Test footnote</p>
</fn>
</fn-group>
</back>
</article> The bibliography and footnotes are back matter. In fact in your JARP xml the footnotes are all there, the images are linked, only the references failed but that may be another problem? The point is footnotes/citation/images are working as far as getting into the XML... I do not know how JATS is supposed to render the backmatter, or if the backmatter is supposed to be separate from the body. I don't use JATS and don't have time to explore, you'll need to work out what pandoc is supposed to output if it is doing something wrong, we can then post a bug report which they tend to fix quickly. |
Refs at least are stored in back matter in the JATS examples: https://jats.nlm.nih.gov/publishing/tag-library/1.3/chapter/samples.html |
Thank you for looking into this! I will keep looking into this (after grad student grading is over...). But thank you so much for your time and checking this! |
Hi, some good news is that scrivomatic metadata and JATS are very similar, so by duplicating just a few keys we can get most output working in both with the same document (here I output to jats, pdf, html, and odt): ---
title: A JATS Test
date: 2024-01-02
author:
- surname: Doe
given-names: Jane
name: Jane Doe
email: [email protected]
correspondence: [email protected]
orcid: XXXXXXXXXXXXX
affiliation: 1
equal-contrib: true
equal_contributor: true
- surname: Doe
given-names: Joanna
name: Joanna Doe
email: [email protected]
orcid: YYYYYYYYYYYYYY
affiliation: 2
equal-contrib: true
equal_contributor: true
affiliation:
- id: 1
organization: Institute of Or
country: Indonesia
- id: 2
organization: Institute of Ar
country: Indonesia
institute:
- 1: Institute of Or
- 2: Institute of Ar
article:
doi: 10.234/23222.54
pmid: 3244343333
heading: Speculation
categories: [testing, formulating]
author-notes:
corresp:
- id: joanna
email: [email protected]
conflict: There is a big conflict
funding-statement: Dept. of Thin Air
journal:
publisher-id: pnas
title: Proc Natl Acad Sci U S A
issn: 0027-8424
eissn: 0027-8424
publisher-name: The National Academy of Sciences
publisher-loc: USA
licence: Unlicence V1.0
abstract: |
This is the **abstract** of the article. \
Blah blah blah.
tags: [jats, pandoc, test]
pandocomatic_:
use-template: [jats, pdf-refs, html-refs, odt-refs]
---
# Intro
Blah blah blah[^fn1].
![**Figure 1** — This is a fascinating caption.][image]
# Conclusion
Blah blah blah [@shipp2013].
# Bibliography
::: {#refs}
:::
[image]: placeholder.png
[^fn1]: Test footnote Note we use
HTML with all metadata converted properly: And what looks like complete XML too (I also fixed the journal info etc.): <?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-type="publisher-id">pnas</journal-id>
<journal-title-group>
<journal-title>Proc Natl Acad Sci U S A</journal-title>
</journal-title-group>
<issn publication-format="electronic">0027-8424</issn>
<publisher>
<publisher-name>The National Academy of Sciences</publisher-name>
<publisher-loc>USA</publisher-loc>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.234/23222.54</article-id>
<article-id pub-id-type="pmid">3244343333</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Speculation</subject>
</subj-group>
<subj-group subj-group-type="categories">
<subject>testing</subject>
<subject>formulating</subject>
</subj-group>
</article-categories>
<title-group>
<article-title>A JATS Test</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" equal-contrib="yes">
<contrib-id contrib-id-type="orcid">XXXXXXXXXXXXX</contrib-id>
<name>
<surname>Doe</surname>
<given-names>Jane</given-names>
</name>
<email>[email protected]</email>
<xref ref-type="aff" rid="aff-1"/>
</contrib>
<contrib contrib-type="author" equal-contrib="yes">
<contrib-id contrib-id-type="orcid">YYYYYYYYYYYYYY</contrib-id>
<name>
<surname>Doe</surname>
<given-names>Joanna</given-names>
</name>
<email>[email protected]</email>
<xref ref-type="aff" rid="aff-2"/>
</contrib>
<aff id="aff-1">
<institution-wrap>
<institution>Institute of Or</institution>
</institution-wrap>,
<country>Indonesia</country>
</aff>
<aff id="aff-2">
<institution-wrap>
<institution>Institute of Ar</institution>
</institution-wrap>,
<country>Indonesia</country>
</aff>
</contrib-group>
<author-notes>
<corresp id="cor-joanna">* E-mail: <email>[email protected]</email></corresp>
<fn fn-type="conflict"><p>There is a big conflict</p></fn>
</author-notes>
<pub-date date-type="pub" publication-format="electronic" iso-8601-date="2024-01-02">
<day>2</day>
<month>1</month>
<year>2024</year>
</pub-date>
<permissions>
</permissions>
<abstract>
<p>This is the <bold>abstract</bold> of the article.
Blah blah blah.</p>
</abstract>
<kwd-group kwd-group-type="author">
<kwd>jats</kwd>
<kwd>pandoc</kwd>
<kwd>test</kwd>
</kwd-group>
<funding-group>
<funding-statement>Dept. of Thin Air</funding-statement>
</funding-group>
</article-meta>
</front>
<body>
<sec id="intro">
<title>Intro</title>
<p>Blah blah blah<xref ref-type="fn" rid="fn1">1</xref>.</p>
<fig>
<caption><p><bold>Figure 1</bold> — This is a fascinating
caption.</p></caption>
<graphic mimetype="image" mime-subtype="png" xlink:href="placeholder.png" />
</fig>
</sec>
<sec id="conclusion">
<title>Conclusion</title>
<p>Blah blah blah
(<xref alt="Shipp et al., 2013" rid="ref-shipp2013" ref-type="bibr">Shipp
<italic>et al.</italic>, 2013</xref>).</p>
</sec>
</body>
<back>
<ref-list>
<title>Bibliography</title>
<ref id="ref-shipp2013">
<mixed-citation><italic>Shipp, S., Adams, R. A., & Friston,
K.</italic> (2013) Reflections on agranular architecture: Predictive
coding in the motor cortex. <italic>Trends in
Neurosciences</italic>, <italic>36</italic>(12), 706–716.
<ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1016/j.tins.2013.09.004">https://doi.org/10.1016/j.tins.2013.09.004</ext-link></mixed-citation>
</ref>
</ref-list>
<fn-group>
<fn id="fn1">
<label>1</label><p>Test footnote</p>
</fn>
</fn-group>
</back>
</article> The jats ends up being called jats.jats, this can be fixed easily. You still need to figure out what needs to be changed for parsing at your journal... |
For scrivomatic to use https://github.com/iandol/dotpandoc/blob/master/pandocomatic.yaml#L67 |
Wonderful!! Thank you so much. I tried it with an existing article and it worked fine. |
Hi, glad you got it working. I may make a post on the forums outline the details to get JATS working. I'll make some tweaks to scrivimatic docs to mention this also later... Coffee welcome, if these work for you: paypal.me/iandol ko-fi.com/iandol. |
Thank you again so much! Coffee went out! |
Hallo again!
` However, jats XML needs references to be listed with a lot of sub-items, like below:
` I found this very old project which proved a jats-appropriate csl: https://github.com/mfenner/pandoc-jats
I cleaned the code (search & replacing the < etc. with correct HTML tags for < > and ", removing a redundant pair and got it to work, but if an article has a long reference list, this is too much work. Especially, if I also need to adjust each in-line citation and remove all the nested ref tags. Again, this is not your concern but just wanted to keep you informed. |
This is a question about compiling directly to JATS XML (see Journal Publishing Tag Library). JATS XML includes various metadata for article publishing and can potentially be used for displaying an article in a dynamic format (giving access to references and supplementary material via tabs). PKP OJS can use this, for example: https://demo.publicknowledgeproject.org/ojs3/demo/index.php/immersion/article/view/918/463
It seems, pandoc could convert to JATS but I have not figured out how to do this. There was a lua converter but that has been archived (and uses an old JATS version): https://github.com/mfenner/pandoc-jats
Could the lua filter etc. be integrated into scrivomatic? I super appreciate scrivomatic but do not have the knowledge to update and integrate pandoc-jats for this. If it is too complicated or not possible, that is fine. If it is just a matter of copying and pasting the metadata block and lua files somewhere, I can try myself but would still appreciate guidance.
(If I can donate to scrivomatic somehow, I will sure do!)
The text was updated successfully, but these errors were encountered: