From def6d6f411adf08f0d782acc3810b0122faa9292 Mon Sep 17 00:00:00 2001 From: Omikhleia Date: Sat, 15 Feb 2025 14:09:24 +0100 Subject: [PATCH] fix(packages): Empty CSL macros must be suppressed --- packages/bibtex/csl/engine.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/bibtex/csl/engine.lua b/packages/bibtex/csl/engine.lua index 5c4824441..9a297f7e8 100644 --- a/packages/bibtex/csl/engine.lua +++ b/packages/bibtex/csl/engine.lua @@ -451,7 +451,17 @@ function CslEngine:_text (options, content, entry) local link if options.macro then if self.macros[options.macro] then + -- This is not explicit in the CSL 1.0.2 specification, which mention conditional + -- rendering for groups only. However, macro should behave as it own group, and + -- be suppressed on the same conditions. This is used in a variety of styles, for + -- instance UFES-ABNT, UNEAL-ABNT or ABNT-IPEA have definitions like: + -- + -- + -- (...) + -- + self:_enterGroup() t = self:_render_children(self.macros[options.macro], entry) + t = self:_leaveGroup(t) else SU.error("CSL macro " .. options.macro .. " not found") end