summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-04-03 21:32:12 +0000
committerKarl Berry <karl@freefriends.org>2023-04-03 21:32:12 +0000
commitf7e460629cd4ad5b5633111ebcfe71c4d9dfa545 (patch)
tree9d18c6da99ca46eb92eb8019b2880c7c2d33e990 /Master/texmf-dist/scripts/citation-style-language/citeproc-ir-node.lua
parente7038d590db60ddbdbb89f18f8251bc096355c09 (diff)
citation-style-language (3apr23)
git-svn-id: svn://tug.org/texlive/trunk@66749 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.lua37
1 files changed, 36 insertions, 1 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 50fe34b0593..5770d8d0dc0 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
@@ -1,5 +1,5 @@
--
--- Copyright (c) 2021-2022 Zeping Lee
+-- Copyright (c) 2021-2023 Zeping Lee
-- Released under the MIT license.
-- Repository: https://github.com/zepinglee/citeproc-lua
--
@@ -9,6 +9,7 @@ local irnode = {}
local util = require("citeproc-util")
+---@class IrNode
local IrNode = {
_element = nil,
_type = "IrNode",
@@ -61,6 +62,35 @@ function IrNode:derive(type)
return o
end
+function IrNode:_debug(level)
+ level = level or 0
+ local ir_info_str = ""
+ if self.delimiter then
+ ir_info_str = ir_info_str .. string.format('delimiter: "%s"', self.delimiter)
+ end
+ if self.should_inherit_delim then
+ if ir_info_str ~= "" then
+ ir_info_str = ir_info_str .. " "
+ end
+ ir_info_str = ir_info_str .. "should_inherit_delim: true"
+ end
+ if ir_info_str ~= "" then
+ ir_info_str = string.format("{%s}", ir_info_str)
+ end
+ local text = string.format("\n%s [%s] %s <%s> %s", string.rep(" ", level), self.group_var, self._type, self._element, ir_info_str)
+ if self.children and #self.children > 0 then
+ for _, child_ir in ipairs(self.children) do
+ text = text .. child_ir:_debug(level + 1)
+ end
+
+ elseif self.inlines then
+ for _, inline in ipairs(self.inlines) do
+ text = text .. " " .. inline:_debug()
+ end
+ end
+ return text
+end
+
function IrNode:flatten(format)
return format:flatten_ir(self)
end
@@ -105,6 +135,7 @@ function IrNode:find_first_year_ir()
end
+---@class Rendered: IrNode
local Rendered = IrNode:derive("Rendered")
function Rendered:new(inlines, element)
@@ -122,6 +153,7 @@ function Rendered:new(inlines, element)
end
+---@class YearSuffix: IrNode
local YearSuffix = IrNode:derive("YearSuffix")
function YearSuffix:new(inlines, element)
@@ -139,9 +171,11 @@ function YearSuffix:new(inlines, element)
end
+---@class NameIr: IrNode
local NameIr = IrNode:derive("NameIr")
+---@class PersonNameIr: IrNode
local PersonNameIr = IrNode:derive("PersonNameIr")
function PersonNameIr:new(inlines, element)
@@ -157,6 +191,7 @@ function PersonNameIr:new(inlines, element)
end
+---@class SeqIr: IrNode
local SeqIr = IrNode:derive("SeqIr")
-- function SeqIr:new(children)