Skip to content

Commit

Permalink
fix(packages): CSL subsequent-author-substitute is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Jan 1, 2025
1 parent a3de042 commit 680df8c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/bibtex/csl/engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<bibRule>" .. count .. "</bibRule>" .. 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 = "<bibRule>" .. count .. "</bibRule>" .. trail
end
end
end

Expand Down

0 comments on commit 680df8c

Please sign in to comment.