Skip to content

Commit

Permalink
Regression Pandoc 3.3
Browse files Browse the repository at this point in the history
Add zotero-SuppressAuthor.lua (is Pandoc 3.4)
  • Loading branch information
estedeahora committed Oct 24, 2024
1 parent 26d0324 commit a75e810
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions inst/files-pkg/filters/zotero-SuppressAuthor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--- translate-zotero.lua – filter to translate elements
--- https://github.com/estedeahora/guri/tree/main/inst/files-pkg/filters/translate-zotero.lua
--- The filter is part of the R package {guri}.
---
--- Copyright: © 2024 Pablo Santiago SERRATI
--- License: CC-by-nc-sa. The licence for this filter is the same as for the {guri} package
--- (see https://github.com/estedeahora/guri/).

-- Summary:
-- The translate-zotero.lua is a Pandoc Lua filter that translates citation elements (coming
-- from zotero plug-in for word in 'fields').

local stringify = pandoc.utils.stringify

function Cite(cite)

local cite_text = stringify(cite)

for k, citation in ipairs(cite.citations) do
prefix = stringify(citation.prefix)
if #prefix > 0 then
prefix = stringify(citation.prefix) .. " "
end
if cite_text:match('^%(' .. prefix .. '[0-9][0-9][0-9]') then
citation.mode = "SuppressAuthor"
end
end

return cite
end

0 comments on commit a75e810

Please sign in to comment.