Skip to content

Commit 680df8c

Browse files
OmikhleiaDidier Willis
authored andcommitted
fix(packages): CSL subsequent-author-substitute is optional
1 parent a3de042 commit 680df8c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

packages/bibtex/csl/engine.lua

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,16 @@ function CslEngine:_init (style, locale, extras)
103103
}
104104

105105
self.subsequentAuthorSubstitute = self.inheritable["bibliography"]["subsequent-author-substitute"]
106-
local _, count = luautf8.gsub(self.subsequentAuthorSubstitute, "[%-_–—]", "") -- naive count
107-
if count > 0 then
108-
-- With many fonts, a sequence of dashes is not looking that great.
109-
-- So replace them with a command, and let the typesetter decide for a better rendering.
110-
-- NOTE: Avoid (quoted) attributes and dashes in tags, as some global
111-
-- substitutions might affect quotes...So we use a simple "wrapper" command.
112-
local trail = luautf8.gsub(self.subsequentAuthorSubstitute, "^[%-–—_]+", "")
113-
self.subsequentAuthorSubstitute = "<bibRule>" .. count .. "</bibRule>" .. trail
106+
if self.subsequentAuthorSubstitute then
107+
local _, count = luautf8.gsub(self.subsequentAuthorSubstitute, "[%-_–—]", "") -- naive count
108+
if count > 0 then
109+
-- With many fonts, a sequence of dashes is not looking that great.
110+
-- So replace them with a command, and let the typesetter decide for a better rendering.
111+
-- NOTE: Avoid (quoted) attributes and dashes in tags, as some global
112+
-- substitutions might affect quotes...So we use a simple "wrapper" command.
113+
local trail = luautf8.gsub(self.subsequentAuthorSubstitute, "^[%-–—_]+", "")
114+
self.subsequentAuthorSubstitute = "<bibRule>" .. count .. "</bibRule>" .. trail
115+
end
114116
end
115117
end
116118

0 commit comments

Comments
 (0)