From 680df8cf4cb8038b034a564269687b13efae9cbb Mon Sep 17 00:00:00 2001 From: Omikhleia Date: Wed, 1 Jan 2025 01:30:07 +0100 Subject: [PATCH 1/2] fix(packages): CSL subsequent-author-substitute is optional --- packages/bibtex/csl/engine.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/bibtex/csl/engine.lua b/packages/bibtex/csl/engine.lua index 013f2d9fb..c6b15124b 100644 --- a/packages/bibtex/csl/engine.lua +++ b/packages/bibtex/csl/engine.lua @@ -103,14 +103,16 @@ function CslEngine:_init (style, locale, extras) } self.subsequentAuthorSubstitute = self.inheritable["bibliography"]["subsequent-author-substitute"] - local _, count = luautf8.gsub(self.subsequentAuthorSubstitute, "[%-_–—]", "") -- naive count - if count > 0 then - -- With many fonts, a sequence of dashes is not looking that great. - -- So replace them with a command, and let the typesetter decide for a better rendering. - -- NOTE: Avoid (quoted) attributes and dashes in tags, as some global - -- substitutions might affect quotes...So we use a simple "wrapper" command. - local trail = luautf8.gsub(self.subsequentAuthorSubstitute, "^[%-–—_]+", "") - self.subsequentAuthorSubstitute = "" .. count .. "" .. trail + if self.subsequentAuthorSubstitute then + local _, count = luautf8.gsub(self.subsequentAuthorSubstitute, "[%-_–—]", "") -- naive count + if count > 0 then + -- With many fonts, a sequence of dashes is not looking that great. + -- So replace them with a command, and let the typesetter decide for a better rendering. + -- NOTE: Avoid (quoted) attributes and dashes in tags, as some global + -- substitutions might affect quotes...So we use a simple "wrapper" command. + local trail = luautf8.gsub(self.subsequentAuthorSubstitute, "^[%-–—_]+", "") + self.subsequentAuthorSubstitute = "" .. count .. "" .. trail + end end end From 5e6e7458af4f7fcac15f6c9306ede9ce20cf79f5 Mon Sep 17 00:00:00 2001 From: Omikhleia Date: Wed, 1 Jan 2025 01:47:19 +0100 Subject: [PATCH 2/2] chore(packages): Some LDoc tags are incorrect in the CSL engine --- packages/bibtex/csl/engine.lua | 4 ++-- packages/bibtex/csl/locale.lua | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/bibtex/csl/engine.lua b/packages/bibtex/csl/engine.lua index c6b15124b..5c4824441 100644 --- a/packages/bibtex/csl/engine.lua +++ b/packages/bibtex/csl/engine.lua @@ -1492,7 +1492,7 @@ function CslEngine:_process (entries, mode) end --- Generate a citation string. --- @tparam table entry List of CSL entries +-- @tparam table entries List of CSL entries -- @treturn string The XML citation string function CslEngine:cite (entries) entries = type(entries) == "table" and not entries.type and entries or { entries } @@ -1500,7 +1500,7 @@ function CslEngine:cite (entries) end --- Generate a reference string. --- @tparam table entry List of CSL entries +-- @tparam table entries List of CSL entries -- @treturn string The XML reference string function CslEngine:reference (entries) entries = type(entries) == "table" and not entries.type and entries or { entries } diff --git a/packages/bibtex/csl/locale.lua b/packages/bibtex/csl/locale.lua index 98944b434..43f924164 100644 --- a/packages/bibtex/csl/locale.lua +++ b/packages/bibtex/csl/locale.lua @@ -181,7 +181,6 @@ end --- Lookup an ordinal term in the locale. -- Reserved for ordinal terms. -- @tparam number number The numeric value to be formatted --- @tparam string name The name of the term -- @tparam string form The form of the term (default: "short") -- @tparam string genderf The gender-form of the term (default: "neuter") -- @tparam boolean plural Whether to return the plural form (default: false)