diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lang-url.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/lang-url.lua | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua index 17ad15cd890..95d9592067d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-url.lua @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['lang-url'] = { local utfcharacters, utfvalues, utfbyte, utfchar = utf.characters, utf.values, utf.byte, utf.char local min, max = math.min, math.max +local concat = table.concat local context = context @@ -76,10 +77,9 @@ urls.righthyphenmin = 3 urls.discretionary = nil urls.packslashes = false -directives.register("hyphenators.urls.packslashes",function(v) urls.packslashes = v end) - -local trace = false trackers.register("hyphenators.urls",function(v) trace = v end) -local report = logs.reporter("hyphenators","urls") +directives.register("hyphenators.urls.packslashes",function(v) + urls.packslashes = v +end) -- local ctx_a = context.a -- local ctx_b = context.b @@ -153,10 +153,8 @@ local function action(hyphenatedurl,str,left,right,disc) local pack = urls.packslashes local length = 0 local list = utf.split(str) - local size = #list - local prev = nil - for i=1,size do + for i=1,#list do local what = nil local dodi = false local char = list[i] @@ -164,7 +162,7 @@ local function action(hyphenatedurl,str,left,right,disc) char = mapping[char] or char if char == disc then dodi = true - elseif pack and char == "/" and (list[i+1] == "/" or prev == "/") then + elseif pack and char == "/" and list[i+1] == "/" then what = "c" else local how = characters[char] @@ -194,13 +192,9 @@ local function action(hyphenatedurl,str,left,right,disc) else list[i] = "\\" .. what .. "{" .. utfbyte(char) .. "}" end - prev = char - end - if trace then - report("old : %s",str) - report("new : %t",list) end - context("%t",list) + list = concat(list) + context(list) end -- urls.action = function(_,...) action(...) end -- sort of obsolete |