Skip to content

Commit

Permalink
Merge pull request #53 from openjournals/fix-image-paths-in-jats
Browse files Browse the repository at this point in the history
Fix image paths in JATS
  • Loading branch information
xuanxu authored May 13, 2024
2 parents 4b56e08 + 7f537e9 commit cb6439f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 6 additions & 2 deletions data/filters/unify-image-paths.lua → data/custom/jats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local function unnest (filepath, contents)
return newpath
end

function Pandoc (doc)
function Writer (doc, opts)
-- Ensure that all images have been fetched.
doc = mediabag.fill(doc)
local newpath
Expand All @@ -30,10 +30,14 @@ function Pandoc (doc)
mediabag.delete(fp)
mediabag.insert(newpath, mt, contents)
end
return doc:walk {
doc = doc:walk {
Image = function (img)
img.src = updated_filepath[img.src] or img.src
return img
end
}
pandoc.mediabag.write('paper.jats')
return pandoc.write(doc, 'jats_publishing+element_citations', opts)
end

Template = pandoc.template.default 'jats'
8 changes: 2 additions & 6 deletions data/defaults/jats.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
to: jats_publishing+element_citations
to: jats.lua
output-file: paper.jats/paper.jats
extract-media: paper.jats


filters:
- # Handle `\ref`, `\label`, and `\autoref` commands
Expand All @@ -18,7 +18,3 @@ filters:
# do it here for that reason.
type: lua
path: orcid-uri.lua

- # Ensure that images are placed on the top-level, not in subfolders.
type: lua
path: unify-image-paths.lua

0 comments on commit cb6439f

Please sign in to comment.