Skip to content

Commit f4ea4ed

Browse files
Omikhleiaalerque
authored andcommitted
fix(packages): Use non-breakable space in bibTeX name splitting, not tilde
1 parent 2586450 commit f4ea4ed

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/bibtex/support/nbibtex.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
-- with permission.
33
-- Thanks, Norman, for these functions!
44

5+
-- The initial implementation was using "~", but we now sanitized the
6+
-- input earlier at parsing to replace those from the input with
7+
-- non-breaking spaces. So we can just use the non-breaking space
8+
-- character now on.
9+
local nbsp = luautf8.char(0x00A0)
10+
511
local function find_outside_braces (str, pat, i)
612
-- local len = string.len(str)
713
local j, k = string.find(str, pat, i)
@@ -243,10 +249,10 @@ do
243249
-- <possibly adjust [[sep]] and [[ssep]] according to token position and size>=
244250
if not string.find(sep, sep_char) then
245251
if i == lim - 1 then
246-
sep, ssep = "~", "~"
252+
sep, ssep = nbsp, nbsp
247253
elseif i == start + 1 then
248-
sep = string.len(shortname) < 3 and "~" or " "
249-
ssep = string.len(longname) < 3 and "~" or " "
254+
sep = string.len(shortname) < 3 and nbsp or " "
255+
ssep = string.len(longname) < 3 and nbsp or " "
250256
else
251257
sep, ssep = " ", " "
252258
end

0 commit comments

Comments
 (0)