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

References are placed in the "body" for JATS output. #9166

Closed
estedeahora opened this issue Nov 3, 2023 · 4 comments
Closed

References are placed in the "body" for JATS output. #9166

estedeahora opened this issue Nov 3, 2023 · 4 comments
Labels

Comments

@estedeahora
Copy link

Explain the problem.

I have a Markdown document that I want to export to JATS. In this document I have at the end a Div with an "appendix", which is placed after the references section. Following the JATS indication this appendix should go in the "back". For this I use a Lua filter, which extracts the content of the Div block from the appendix and saves it in the metadata (then I insert it in the back with a small change in the template).

The problem is that when I do this, the References are placed in the body (instead of in the back).

I call Pandoc with the following line command:

pandoc +RTS -K512m -RTS example.md --to jats_publishing+element_citations --from markdown --output example.xml -s --reference-links=true --lua-filter=get_appendix.lua --citeproc

I share my Markdown file (example.md).

The filter (get_appendix.lua) I use is:

local app = nil
local RawBlock = pandoc.RawBlock

function Div(div)
    if(div.identifier == "app") then
        app = div.content
        div = RawBlock('jats', '')
    end
    return div
end

function Meta(m)
    if(app) then
        m.app = app
    end
    return(m)
end

Interestingly, when I add and modify the line div = RawBlock('jats', '') to div = pandoc.Header(1, '') the References return to the "back" (although a phantom section is generated). I guess citeproc does something with the Div of the references.

Pandoc version?
Pandoc 3.1.8

@estedeahora estedeahora added the bug label Nov 3, 2023
@jgm
Copy link
Owner

jgm commented Nov 3, 2023

Does it help if you put --citeproc before the filter on the command line?

@estedeahora
Copy link
Author

estedeahora commented Nov 3, 2023

Does it help if you put --citeproc before the filter on the command line?

No. It continuos placing the references in the body.

@estedeahora
Copy link
Author

Could it be related to issue 9017 and issue 8364?

@jgm
Copy link
Owner

jgm commented Nov 4, 2023

To reproduce without the Lua script:

---
affiliation:
- id: aff1
  name: Affiliation name
author:
- affiliation:
  - aff1
  email: my_email@mail.com
  given-names: Juan
  surname: Pérez
date:
  type: pub
  year: 2023
issue: 20
journal:
  eissn: 1234-5678
  title: Journal title
lang: es-ES
title: Title article
references:
- author:
  - family: Author
    given: N.
  id: Author2004
  issued: 2004
  title: This is a title book
  type: book

---

# Introduction

Lorem ipsum dolor [@Author2004].

# References

::: {#refs}
:::

Blah

@jgm jgm closed this as completed in 9400f75 Nov 4, 2023
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