diff options
author | Karl Berry <karl@freefriends.org> | 2022-12-25 21:19:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-12-25 21:19:05 +0000 |
commit | 6f630003fb5786cf7cd7c9357181f48c5b5ca5aa (patch) | |
tree | 3b2e6bba65cbcb83a9f77ba9738782a968e1a4cf /Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua | |
parent | e0738f3b15024b575173a514b73597ba701088c1 (diff) |
citation-style-language (25dec22)
git-svn-id: svn://tug.org/texlive/trunk@65357 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua')
-rw-r--r-- | Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua b/Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua index 01cca4abf66..50fe34b0593 100644 --- a/Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua +++ b/Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua @@ -74,6 +74,35 @@ function IrNode:capitalize_first_term() end end +function IrNode:collect_year_suffix_irs() + local year_suffix_irs = {} + if self.children then + for i, child_ir in ipairs(self.children) do + if child_ir._type == "YearSuffix" then + table.insert(year_suffix_irs, child_ir) + elseif child_ir.children then + util.extend(year_suffix_irs, + child_ir:collect_year_suffix_irs()) + end + end + end + return year_suffix_irs +end + +function IrNode:find_first_year_ir() + if self.is_year then + return self + end + if self.children then + for _, child_ir in ipairs(self.children) do + local year_ir = child_ir:find_first_year_ir() + if year_ir then + return year_ir + end + end + end + return nil +end local Rendered = IrNode:derive("Rendered") |