diff options
author | Norbert Preining <norbert@preining.info> | 2024-05-18 03:01:38 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-05-18 03:01:38 +0000 |
commit | 6231c97119299ef4b55ed2760faff69acfddf0e9 (patch) | |
tree | e1ab2c7a3b34f4fef9af71439b0f1b68d7aaa907 /indexing/xindex/lualatex | |
parent | 0cee130f990e7208a0fcdef78916e2cefe1a3639 (diff) |
CTAN sync 202405180301
Diffstat (limited to 'indexing/xindex/lualatex')
-rw-r--r-- | indexing/xindex/lualatex/xindex-AU.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-DIN2.lua | 37 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-HAdW-eKO.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-RU.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-base.lua | 23 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-baselib.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-cfg-common.lua | 17 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-cfg-no_uca.lua (renamed from indexing/xindex/lualatex/xindex-cfg.lua) | 6 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-cfg-uca.lua | 18 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-danteedition.lua | 17 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-dtk.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-lib.lua | 82 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-norsk.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-pretty.lua | 2 | ||||
-rw-r--r-- | indexing/xindex/lualatex/xindex-yannis.lua | 2 |
15 files changed, 150 insertions, 66 deletions
diff --git a/indexing/xindex/lualatex/xindex-AU.lua b/indexing/xindex/lualatex/xindex-AU.lua index 59c26294bf..be3a46360f 100644 --- a/indexing/xindex/lualatex/xindex-AU.lua +++ b/indexing/xindex/lualatex/xindex-AU.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-AU'] = { - version = 0.55, + version = 0.58, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/indexing/xindex/lualatex/xindex-DIN2.lua b/indexing/xindex/lualatex/xindex-DIN2.lua index 5d9bd56dc8..445edc904e 100644 --- a/indexing/xindex/lualatex/xindex-DIN2.lua +++ b/indexing/xindex/lualatex/xindex-DIN2.lua @@ -16,25 +16,31 @@ if not modules then modules = { } end modules ['xindex-DIN2'] = { license = "LPPL 1.3" } -itemPageDelimiter = "," -- Hello, 14 -compressPages = true -- something like 12--15, instead of 12,13,14,15. the |( ... |) syntax is still valid -fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5 -minCompress = 3 -- 14--17 or -numericPage = true -- for non numerical pagenumbers, like "VI-17" -sublabels = {"", "-\\,", "--\\,", "---\\,"} -- for the (sub(sub(sub-items first one is for item -pageNoPrefixDel = "" -- a delimiter for page numbers like "VI-17" -indexOpening = "" -- commands after \begin{theindex} -rangeSymbol = "--" -idxnewletter = "\\textbf" -- Only valid if -n is not set -envStart = "\\begin{theindex}" -envStop = "\\end{theindex}" - - +--UCA language = "de_din2" -- +if use_UCA then +languages.de = function(collator_obj) + local function tailor(a, b, tbl) + local autf = collator_obj:string_to_codepoints(a) + local butf = collator_obj:string_to_codepoints(b) + collator_obj:tailor(autf,butf, tbl) + end + local tailoring = function(s) collator_obj:tailor_string(s) end + languages.de(collator_obj) + tailoring "&Ö=Oe" + tailoring "&ö=oe" + tailoring "&Ä=Ae" + tailoring "&ä=ae" + tailoring "&Ü=Ue" + tailoring "&ü=ue" + tailoring "&ß=ss" + return collator_obj +end +end --[[ + Only used for -x option (no UCA): Each character's position in this array-like table determines its 'priority'. Several characters in the same slot have the same 'priority'. ]] - alphabet_lower = { -- for sorting { ' ' }, -- only for internal tests { 'a', 'á', 'à', 'å', 'æ', }, @@ -100,4 +106,3 @@ alphabet_upper = { -- for sorting { 'Y', 'Ý', 'Ÿ' }, { 'Z', 'Ž' } } - diff --git a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua index ecf51a290d..6eabbf472f 100644 --- a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua +++ b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua @@ -11,7 +11,7 @@ -- configuration for index files of the Heidelberger Akademie der Wissenschaften if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = { - version = 0.55, + version = 0.58, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/indexing/xindex/lualatex/xindex-RU.lua b/indexing/xindex/lualatex/xindex-RU.lua index 626cc1c17d..7cfb9627b6 100644 --- a/indexing/xindex/lualatex/xindex-RU.lua +++ b/indexing/xindex/lualatex/xindex-RU.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-RU'] = { - version = 0.55, + version = 0.58, comment = "configuration to xindex.lua", author = "Alexey Kuznetzov", copyright = "Herbert Voß", diff --git a/indexing/xindex/lualatex/xindex-base.lua b/indexing/xindex/lualatex/xindex-base.lua index ff44943724..77fc6894c9 100644 --- a/indexing/xindex/lualatex/xindex-base.lua +++ b/indexing/xindex/lualatex/xindex-base.lua @@ -8,7 +8,7 @@ -- $Id: xindex-base.lua 22 2022-02-07 12:18:15Z hvoss $ ----------------------------------------------------------------------- -local info = { version = 0.55 } +local info = { version = 0.60 } -- check config if pageNoPrefixDel ~= "" then @@ -112,8 +112,14 @@ writeLog(2, "GenerateSortKeys end\n", 0) k = 0 writeLog(2, "Sort begin\n", 0) -table.sort(Index,UTFCompare) + +if use_UCA then + table.sort(Index, UCACompare) +else + table.sort(Index,UTFCompare) +end writeLog(2, "Sort end\n", 0) + if SORTposthook then writeLog(2, "PostHook begin\n", 0) Index = SORTposthook(Index) @@ -168,15 +174,19 @@ if use_UCA then v = NewIndex[i] -- the collator:get_lowest_char will return character on the given -- position. It will be lowercase and without accents. - local codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.SortKey)) + if v.SortKey ~= nil then + codepoints = collator_obj:string_to_codepoints(utf8_upper(v.SortKey)) + else + codepoints = collator_obj:string_to_codepoints(utf8_upper(v.sortChar)) + end v.sortChar = getSortChar(codepoints) --or getSortChar(collator_obj:string_to_codepoints(NormalizedUpper(v.Entry))) if not v.sortChar then -- alternativelly use v.Entry if SortKey doesn't contain usable string - codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.Entry)) + codepoints = collator_obj:string_to_codepoints(utf8_upper(v.Entry)) v.sortChar = getSortChar(codepoints) end +-- print("v.sortchar="..v.sortChar) end - writeLog(2,"done\n",0) else for i=1, #NewIndex do if NewIndex[i]["SortKey"] ~= nil then @@ -187,6 +197,9 @@ else end end + +writeLog(2,"done\n",0) + if SORTendhook then NewIndex = SORTendhook(NewIndex) end diff --git a/indexing/xindex/lualatex/xindex-baselib.lua b/indexing/xindex/lualatex/xindex-baselib.lua index 36269520c9..fd7326efd1 100644 --- a/indexing/xindex/lualatex/xindex-baselib.lua +++ b/indexing/xindex/lualatex/xindex-baselib.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-baselib'] = { - version = 0.55, + version = 0.60, comment = "base library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/indexing/xindex/lualatex/xindex-cfg-common.lua b/indexing/xindex/lualatex/xindex-cfg-common.lua index e02da6f3fc..15c326c3bc 100644 --- a/indexing/xindex/lualatex/xindex-cfg-common.lua +++ b/indexing/xindex/lualatex/xindex-cfg-common.lua @@ -9,13 +9,27 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-common'] = { - version = 0.55, + version = 0.60, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", license = "LPPL 1.3" } +itemPageDelimiter = "," -- Hello, 14 +compressPages = true -- something like 12--15, instead of 12,13,14,15. the |( ... |) syntax is still valid +fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5 +minCompress = 3 -- 14--17 or +rangeSymbol = "--" +numericPage = true -- for non numerical pagenumbers, like "VI-17" +sublabels = {"", "-\\,", "--\\,", "---\\,"} -- for the (sub(sub(sub-items first one is for item +pageNoPrefixDel = "" -- a delimiter for page numbers like "VI-17" -- not used !!! +indexOpening = "" -- commands after envStart +idxnewletter = "\\textbf" -- Only valid if -n is not set +envStart = "\\begin{theindex}" +envStop = "\\end{theindex}" + + indexheader = { cs = {"Symboly", "Čísla", "czech"}, da = {"Symboler", "Tal", "danish"}, @@ -30,6 +44,7 @@ indexheader = { ru = {"Символы", "Числа", "russian"}, } + --[[ babel afrikaans azerbaijani diff --git a/indexing/xindex/lualatex/xindex-cfg.lua b/indexing/xindex/lualatex/xindex-cfg-no_uca.lua index b9960963bd..d337047a1b 100644 --- a/indexing/xindex/lualatex/xindex-cfg.lua +++ b/indexing/xindex/lualatex/xindex-cfg-no_uca.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.55, + version = 0.60, comment = "main configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -18,7 +18,7 @@ if not modules then modules = { } end modules ['xindex-cfg'] = { itemPageDelimiter = "," -- Hello, 14 compressPages = true -- something like 12--15, instead of 12,13,14,15. the |( ... |) syntax is still valid -fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5 +fCompress = true -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5 minCompress = 3 -- 14--17 or rangeSymbol = "--" numericPage = true -- for non numerical pagenumbers, like "VI-17" @@ -29,6 +29,8 @@ idxnewletter = "\\textbf" -- Only valid if -n is not set envStart = "\\begin{theindex}" envStop = "\\end{theindex}" +-- The following is not needed for sorting with UCA !!!! + --[[ Each character's position in this array-like table determines its 'priority'. Several characters in the same slot have the same 'priority'. diff --git a/indexing/xindex/lualatex/xindex-cfg-uca.lua b/indexing/xindex/lualatex/xindex-cfg-uca.lua index 8dad47adda..d7ab1f4224 100644 --- a/indexing/xindex/lualatex/xindex-cfg-uca.lua +++ b/indexing/xindex/lualatex/xindex-cfg-uca.lua @@ -9,13 +9,27 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-lua'] = { - version = 0.55, + version = 0.60, comment = "configuration to xindex-cfg-uca.lua", author = "Herbert Voss", copyright = "Herbert Voss", license = "LPPL 1.3" } +languages.fr = function(collator_obj) + -- reverse search for accents in French (recommended): + collator_obj.accents_backward = true + -- accents: sorting order in French + local tailoring = function(s) collator_obj:tailor_string(s) end + tailoring("&æ=ae") + tailoring("&œ=oe") + tailoring("&th<þ<<<Þ") -- Canadian, see SGQRI004.pdf + -- lowercase before uppercase in French + --collator_obj:uppercase_first() + return collator_obj +end + + -- put any additional code for lua-uca here --- languages.no = function(collator_obj) local tailoring = function(s) collator_obj:tailor_string(s) end @@ -50,4 +64,4 @@ Symbol Example Description <<<< か<<<<カ Identifies a quaternary difference between "か" and "カ". (New in ICU 53.) ICU permits up to three quaternary relations in a row (except for intervening "=" identity relations). = x = y Signifies no difference between "x" and "y". & &Z Instructs ICU to reset at this letter. These rules will be relative to this letter from here on, but will not affect the position of Z itself. -]]
\ No newline at end of file +]] diff --git a/indexing/xindex/lualatex/xindex-danteedition.lua b/indexing/xindex/lualatex/xindex-danteedition.lua index 477eb5ccca..a17cfc77fa 100644 --- a/indexing/xindex/lualatex/xindex-danteedition.lua +++ b/indexing/xindex/lualatex/xindex-danteedition.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.55, + version = 0.58, comment = "configuration file for the DANTE Edition", author = "Herbert Voss", copyright = "Herbert Voss", @@ -91,3 +91,18 @@ alphabet_upper = { -- for sorting { 'Y', 'Ý', 'Ÿ' }, { 'Z', 'Ž' } } + +folium = { + cs = {"f.", "ff."}, + da = {"f", "ff"}, + de = {"f", "ff"}, + en = {"f", "ff"}, + es = {"f", "ff"}, + fr = {"\\,sq.","\\,sqq."}, + it = {"f", "ff"}, + jp = {"シンボル","番号"}, + nl = {"f.", "ff."}, + no = {"\\,f.","\\,ff."}, + ru = {"",""}, -- doesn't exist +} + diff --git a/indexing/xindex/lualatex/xindex-dtk.lua b/indexing/xindex/lualatex/xindex-dtk.lua index b420597720..332813ce02 100644 --- a/indexing/xindex/lualatex/xindex-dtk.lua +++ b/indexing/xindex/lualatex/xindex-dtk.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.55, + version = 0.58, comment = "DTK configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/indexing/xindex/lualatex/xindex-lib.lua b/indexing/xindex/lualatex/xindex-lib.lua index 60c4d9a196..595ffc2dd7 100644 --- a/indexing/xindex/lualatex/xindex-lib.lua +++ b/indexing/xindex/lualatex/xindex-lib.lua @@ -9,13 +9,17 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-lib'] = { - version = 0.55, + version = 0.60, comment = "main library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", license = "LPPL 1.3" } +require ("unicode") +utf8_lower = unicode.utf8.lower +utf8_upper = unicode.utf8.upper + local escapechar1 = "\"" local escapechar2 = "\"\"" local Letters = "ÄÖÜäöüabcdefghijklmnopqrstuvwxyzßABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -55,29 +59,37 @@ function Lower(strOrig) -- return UTF string.lower end function NormalizedLower(strOrig) -- return normalized UTF string.lower (ä -> a) - local str = "" - for i=1, utf.len(strOrig) do - local c = get_normalized_char(alphabet_lower_map,utf.sub(strOrig,i,i)) - str = str..string.lower(c) + if use_UCA then + return strOrig + else + local str = "" + for i=1, utf.len(strOrig) do + local c = get_normalized_char(alphabet_lower_map,utf.sub(strOrig,i,i)) + str = str..string.lower(c) + end + return str end - return str end function NormalizedUpper(strOrig) -- return normalized UTF string.upper (ä -> A) - local str = {} - local c - for i=1, utf.len(strOrig) do - c = get_normalized_char(alphabet_lower_map,utf.sub(strOrig,i,i)) - str[#str + 1] = c - end - strOrig = table.concat(str) - str = {} - for i=1, utf.len(strOrig) do - c = get_normalized_char(alphabet_upper_map,utf.sub(strOrig,i,i)) - c = NormalizedUppercase(c) - str[#str + 1] = c + if use_UCA then + return strOrig + else + local str = {} + local c + for i=1, utf.len(strOrig) do + c = get_normalized_char(alphabet_lower_map,utf.sub(strOrig,i,i)) + str[#str + 1] = c + end + strOrig = table.concat(str) + str = {} + for i=1, utf.len(strOrig) do + c = get_normalized_char(alphabet_upper_map,utf.sub(strOrig,i,i)) + c = NormalizedUppercase(c) + str[#str + 1] = c + end + return table.concat(str) end - return table.concat(str) end function NormalizedUppercase(chr) -- return normalized UTF uppercase letter @@ -574,6 +586,7 @@ function GenerateSortKey(a) end -- s:gsub("%s+", "") strip spaces -- a["SortKey"] = a["SortKey"]:gsub("%s+", "") + --print("Sortkey: " .. a["SortKey"]) if not use_UCA then -- test if it is a symbol after 9 and before A or after Z if (a["SortKey"]:byte() > 57 and a["SortKey"]:byte() < 65) or (a["SortKey"]:byte() > 90 and a["SortKey"]:byte() < 97) or @@ -581,28 +594,35 @@ function GenerateSortKey(a) a["SortKey"] = "/"..a["SortKey"] -- sort it after / end end - --print("Sortkey: " .. a["SortKey"]) end function GenerateSortKeys(Index) - for _, entry in ipairs(Index) do + for _, entry in ipairs(Index) do -- print("<<".._..entry["Entry"]) - GenerateSortKey(entry) - end + GenerateSortKey(entry) + end end -function UTFCompare(a,b) - local A = a["SortKey"] - local B = b["SortKey"] - if use_UCA then - compare = collator_obj:compare_strings(A,B) +function UCACompare(a,b) + if ignoreSpace then + A = a["Entry"]:gsub("%s+", "") -- str = str:gsub("%s+", "") + B = b["Entry"]:gsub("%s+", "") else - compare = A<B + A = a["Entry"] + B = b["Entry"] end - writeLog(1,"UTFCompare: "..A.."<"..B.." : "..tostring(compare).."\n",2) + --print(A,B) + compare = collator_obj:compare_strings(A,B) + writeLog(1,"UCACompare: "..A.."<"..B.." : "..tostring(compare).."\n",2) return compare end +function UTFCompare(a,b) + local A = a["SortKey"] + local B = b["SortKey"] + writeLog(1,"UTFCompare: "..A.."<"..B.." : "..tostring(A<B).."\n",2) + return A<B +end function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}} -- a["number"], b["number"] are something like "3" or "VI-17" or "9--31" @@ -1018,7 +1038,7 @@ function getSortChar(codepoints) local sort_char = utf8.char(table.unpack(codes)) --print("SortChar:"..sort_char) -- print unicode category of the first char - return upper(sort_char) -- use unicode.utf8.upper to make the char uppercase + return unicode.utf8.upper(sort_char) -- use unicode.utf8.upper to make the char uppercase end end diff --git a/indexing/xindex/lualatex/xindex-norsk.lua b/indexing/xindex/lualatex/xindex-norsk.lua index f51d19db0e..4ed2664142 100644 --- a/indexing/xindex/lualatex/xindex-norsk.lua +++ b/indexing/xindex/lualatex/xindex-norsk.lua @@ -10,7 +10,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-no'] = { - version = 0.55, + version = 0.58, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/indexing/xindex/lualatex/xindex-pretty.lua b/indexing/xindex/lualatex/xindex-pretty.lua index bdf6591ff8..59d96d889f 100644 --- a/indexing/xindex/lualatex/xindex-pretty.lua +++ b/indexing/xindex/lualatex/xindex-pretty.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-pretty'] = { - version = 0.55, + version = 0.58, comment = "dump a Lua table for debugging", author = "Steve Donovan", copyright = "Steve Donovan", diff --git a/indexing/xindex/lualatex/xindex-yannis.lua b/indexing/xindex/lualatex/xindex-yannis.lua index a07d5e2f4d..350102aa6c 100644 --- a/indexing/xindex/lualatex/xindex-yannis.lua +++ b/indexing/xindex/lualatex/xindex-yannis.lua @@ -9,7 +9,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-yannis'] = { - version = 0.55, + version = 0.58, comment = "main configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", |