Skip to content

Commit

Permalink
Always add all cited references to metadata before processing
Browse files Browse the repository at this point in the history
Having the references in the metadata is useful when producing some
formats, e.g., crossref xml.
  • Loading branch information
tarleb committed Dec 20, 2021
1 parent ae06223 commit 3b67f2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data/defaults/shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ resource-path:
- '.'

filters:
- type: lua
path: inline-cited-references.lua
- type: citeproc
- type: lua
path: time.lua
Expand Down
5 changes: 5 additions & 0 deletions data/filters/inline-cited-references.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Pandoc (doc)
doc.meta.references = pandoc.utils.references(doc)

This comment has been minimized.

Copy link
@jedbrown

jedbrown Jan 6, 2022

Member

I built a fresh Docker image on main and get an error tracing from this line. Does this rely on something being added to the image?

$ docker run -it --rm -v /home/jed/src/libceed/doc/papers/joss:/data -u $(id -u):$(id -g) openjournals/inara paper.md
[INFO] Running filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua
Error running filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua:
...re/openjournals/data/filters/inline-cited-references.lua:2: attempt to call a nil value (field 'references')
stack traceback:
        ...re/openjournals/data/filters/inline-cited-references.lua:2: in function 'Pandoc'

This comment has been minimized.

Copy link
@tarleb

tarleb Jan 6, 2022

Author Collaborator

Right, my bad. This uses a pandoc feature that has not been released yet. It should be safe to remove this filter from shared.yaml, so it won't get in the way when producing PDF output. Inara produces both PDF and JATS by default, but you'll probably just want PDF, so best to call it with -o pdf.

I'm currently working to produce a Docker image that has LaTeX and the development version of pandoc. Switching to the new image will then fix the issue.

This comment has been minimized.

Copy link
@tarleb

tarleb Jan 6, 2022

Author Collaborator

Actually, this probably shouldn't wait that long. I'll fix it tomorrow.

This comment has been minimized.

Copy link
@jedbrown

jedbrown Jan 6, 2022

Member

Thanks. That allowed me to test #4

This comment has been minimized.

Copy link
@tarleb

tarleb Jan 7, 2022

Author Collaborator

I've pushed a temporary fix, the docker image should work again.

doc.meta.bibliography = nil -- prevent bibliography from being parsed twice
return doc
end

0 comments on commit 3b67f2b

Please sign in to comment.