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

JATS writer regression: incorrect placement of <ref-list> inside <body> instead of inside <back> when heading inside input document #9017

Closed
castedo opened this issue Aug 23, 2023 · 7 comments
Labels

Comments

@castedo
Copy link
Contributor

castedo commented Aug 23, 2023

REPO STEPS
Using input-with-heading.md

pandoc --to jats -s --citeproc input-with-heading.md

outputs

...

<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">

...

<body>
<sec id="i-like">
  <title>I like</title>
  <p>(DeGroot 2002).</p>
  <ref-list>
    <ref id="ref-degroot_probability">
      <mixed-citation>DeGroot. 2002. “Probability.”</mixed-citation>
    </ref>
  </ref-list>
</sec>
</body>
<back>
</back>
</article>

EXPECTED

The <ref-list> element should be inside <back>, not <body>.

NOTES

Changing the input heading from "# I like" to just text "I like" eliminates the bug. E.g. using input-no-heading.md outputs the <ref-list> inside the <back>.

Pandoc version?
I reproduce this with 3.1.6.2, 3.1.6.1, 3.1.4, but not 3.1.3. So this appears to be a regression from 3.1.3 to 3.1.4.

@jgm
Copy link
Owner

jgm commented Aug 23, 2023

The problem is splitBackBlocks in 4f44058

@jgm
Copy link
Owner

jgm commented Aug 23, 2023

Added a header to the test case in #8364, and it still created a back section. I think this is because that test specifies reference-section-title in the metadata.

@jgm
Copy link
Owner

jgm commented Aug 23, 2023

Here's the diagnosis. If you end your file with a header or provide reference-section-title in metadata, a heading will be added to the references, and then makeSections will create a proper section for it, and splitBackBlocks will put this section in the back matter.

If you don't create a section heading for your references, then makeSections will incorporate the references into the final section of the document, and it won't be split into back matter.

One possible fix would be to look for a refs Div prior to calling makeSections, and ensure that there is a preceding Header element. (If not, add an empty one?)

@castedo
Copy link
Contributor Author

castedo commented Aug 23, 2023

Thank for this information, I think I now see a work-around so that I can use the latest release for my document processing.

Some quick information to share since it was confusing me regarding this:

Here's the diagnosis. If you end your file with a header or provide reference-section-title in metadata, ...

It seems if one does BOTH end a file with header "# References" AND provides a reference-section-title of the same title text AND the penultimate section is not empty, then the ref-list gets misplaced in the body and not placed in back.

@castedo
Copy link
Contributor Author

castedo commented Aug 23, 2023

Regarding possible fixes, I'm not sure ... but another possibility is to essentially treat reference-section-title as always having a default value of "References" when outputing JATS XML. But I don't understand the Haskell very well to have a sense on which possibility is better.

jgm added a commit that referenced this issue Aug 23, 2023
This improves the fix to #9017 in commit
7c43546

An alternative would be to avoid backslash escaping `#` and `%`
in URLs, and instead always add `fragile` to the slide environment.
@jgm jgm closed this as completed in 3cb6130 Aug 23, 2023
@jgm jgm reopened this Oct 26, 2023
@jgm
Copy link
Owner

jgm commented Oct 26, 2023

This was wrongly closed I think. The commit above has nothing to do with this issue and I think it was just a typo.

@jgm
Copy link
Owner

jgm commented Oct 26, 2023

Never mind - it was properly closed but not by the referenced issue above.

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

No branches or pull requests

2 participants