-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add zotero-SuppressAuthor.lua (is Pandoc 3.4)
- Loading branch information
1 parent
26d0324
commit a75e810
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |