summaryrefslogtreecommitdiff
path: root/indexing/xindex/lualatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
commit2178d699db60492a15e11c107f17da33543af865 (patch)
tree157f2907e3778e17df8a7e891bc276b83b444f48 /indexing/xindex/lualatex
parent97f4d34e17013b3239a49484afcb3d805ab09f38 (diff)
CTAN sync 202307070300
Diffstat (limited to 'indexing/xindex/lualatex')
-rw-r--r--indexing/xindex/lualatex/xindex-AU.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-HAdW-eKO.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-RU.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-base.lua27
-rw-r--r--indexing/xindex/lualatex/xindex-baselib.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-common.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-uca.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-danteedition.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-dtk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lib.lua51
-rw-r--r--indexing/xindex/lualatex/xindex-norsk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-pretty.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-yannis.lua2
14 files changed, 76 insertions, 26 deletions
diff --git a/indexing/xindex/lualatex/xindex-AU.lua b/indexing/xindex/lualatex/xindex-AU.lua
index a544692b48..5fa7dbfd3d 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.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
index c82b153e82..d08942fb9a 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.48,
+ version = 0.49,
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 465a7bdb22..e9adda1935 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.48,
+ version = 0.49,
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 37a6783812..336142e30c 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.48 }
+local info = { version = 0.49 }
-- check config
if pageNoPrefixDel ~= "" then
@@ -31,7 +31,7 @@ else
writeLog(2,#lines.." lines of data read\n",0)
end
end
-print("Anzahl Zeilen: "..#lines)
+--print("Anzahl Zeilen: "..#lines)
if #lines == 0 then
print("=========================================")
print("Input file(s) is/are empty!")
@@ -48,9 +48,10 @@ if #lines == 0 then
end
print("Presort of \\indexentry lines")
+for _,l in pairs(lines) do print (l) end
table.sort(lines)
if vlevel > 1 then
- print("Pres-Sorted index list:")
+ print("Pre-Sorted index list:")
for _,l in pairs(lines) do print (l) end
end
@@ -174,6 +175,17 @@ if use_UCA then
end
end
writeLog(2,"done\n",0)
+else
+ for i=1, #NewIndex do
+ v = NewIndex[i]
+ if findStr(v["SortKey"],"\\parenLeft") < 2 then v["SortKey"] = '{' v["sortChar"] = '{'end
+ if findStr(v["SortKey"],"\\parenRight") < 2 then v["SortKey"] = '}' end
+ if findStr(v["SortKey"],"//escapedexcl//") < 2 then v["SortKey"] = '!' end
+ if findStr(v["SortKey"],"//escapedquote//") < 2 then v["SortKey"] = '"' end
+ if findStr(v["SortKey"],"//escapedat//") < 2 then v["SortKey"] = '@' end
+ if findStr(v["SortKey"],"//escapedvert//") < 2 then v["SortKey"] = '|' end
+ NewIndex[i] = v
+ end
end
if SORTendhook then
@@ -217,27 +229,34 @@ for k=1,#NewIndex do
writeLog(1," NewIndex[k]: "..v["Entry"].."\n",2)
writeLog(1,require 'xindex-pretty'.dump(v),3) -- only for internal dump
entry = v["Entry"]
+-- print("SortKey:"..v["SortKey"].." sortChar:"..v["sortChar"])
writeLog(1,"\nBase start: "..entry.."\n",2)
-- local c = utf.sub(v["sortChar"],1,1)
-- if utf8.codepoint(c) < 12288 then -- Japanese starts at hex 3000
-- firstChar = v["sortChar"]
-- else
+-- print(v["SortKey"],v["sortChar"],v["Entry"])
if language == "cs" then -- Czech language has special char ch
if utf.sub(v["sortChar"],1,2) == "CH" then
- firstChar = "Ch"
+ firstChar = "Ch"
else
+-- firstChar = utf.sub(v["SortKey"],1,1)
firstChar = utf.sub(v["sortChar"],1,1)
end
else
+-- firstChar = utf.sub(v["SortKey"],1,1)
firstChar = utf.sub(v["sortChar"],1,1) -- catch a translatet Ö->OE
end
-- end
currentChar = firstChar
+ local SortKey = tostring(v["SortKey"])
+ writeLog(1,"SortKey="..SortKey.."; firstChar="..currentChar.."\n",2)
if string.len(firstChar) > 1 then
charType = getCharType(utf.sub(firstChar,1,1))
else
charType = getCharType(firstChar)
end
+-- print(">>"..v["sortChar"].." "..firstChar.." "..tostring(charType))
if charType == 0 then
numbers = false
symbols = true
diff --git a/indexing/xindex/lualatex/xindex-baselib.lua b/indexing/xindex/lualatex/xindex-baselib.lua
index 5e563aec47..9d7c9188eb 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.48,
+ version = 0.49,
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 33f4b2cbb4..4793d1758d 100644
--- a/indexing/xindex/lualatex/xindex-cfg-common.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-common.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-common'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-cfg-uca.lua b/indexing/xindex/lualatex/xindex-cfg-uca.lua
index 2a87366dad..014d3719d2 100644
--- a/indexing/xindex/lualatex/xindex-cfg-uca.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-uca.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex-cfg-uca.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-cfg.lua b/indexing/xindex/lualatex/xindex-cfg.lua
index b475a2eb7f..24098c5272 100644
--- a/indexing/xindex/lualatex/xindex-cfg.lua
+++ b/indexing/xindex/lualatex/xindex-cfg.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.48,
+ version = 0.49,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-danteedition.lua b/indexing/xindex/lualatex/xindex-danteedition.lua
index 80d7426381..f7d2d09b5f 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.48,
+ version = 0.49,
comment = "configuration file for the DANTE Edition",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-dtk.lua b/indexing/xindex/lualatex/xindex-dtk.lua
index 0082be4dc9..74de071b0a 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.48,
+ version = 0.49,
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 97ede6b8fc..f321765c64 100644
--- a/indexing/xindex/lualatex/xindex-lib.lua
+++ b/indexing/xindex/lualatex/xindex-lib.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.48,
+ version = 0.49,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -125,7 +125,8 @@ function read_lines_from(infile)
str = line:gsub('^\\%a+%s*{','{') -- remove "\\indexentry "
writeLog(1,"read_lines: str="..str.." ("..utf.sub(str,2,2)..")\n",2)
if getCharType(utf.sub(str,2,2)) == 0 then -- we have a symbol
- lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
+ lines[#lines + 1] = str:gsub('^{*','{') -- add a space ... why????
+-- lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
else
lines[#lines + 1] = str
end
@@ -275,6 +276,7 @@ function getEntryAndPage(w, nextW, EntryList)
sortChar= NormalizedUpper(utf.sub(IndexString,1,1)), -- :byte(), -- Initial for later output
Macro = macro
}
+ --print("Entry:"..EntryList[#EntryList]["sortChar"])
if args_v then
if Special == "" then Special = "-" end
writeLog(1,"getEntryAndPage: "..tostring(IndexString,pageNo,Special,utf.sub(IndexString,1,1),macro).."\n",2)
@@ -318,7 +320,7 @@ end
--[[ example entry
EntryList[2] = {
- Entry = "Johann", -- the index item foo@bar
+ Entry = 'Johann//escapedexcl//', -- the index item foo@bar
pages = { -- the page number(s) and the part after |
{ number = 111,
special = '\\emph' },
@@ -502,6 +504,19 @@ function getCharType(c)
end
end
+function findStr(s,f)
+ if s == nil then return 99999 end
+ str = s:match'^%s*(.*)' -- strip left spaces
+-- s:gsub("%s+", "")-- strip spaces
+-- print(s,f)
+ local i,j = str:find(f)
+-- print(tostring(i),tostring(j))
+ if i == nil
+ then return 99999 -- makes it easier to compare with <
+ else return i
+ end
+end
+
--print(get_category(utf8.codepoint('ö')))
--print(category_to_number(get_category(utf8.codepoint('ö'))))
@@ -532,22 +547,36 @@ function GenerateSortKey(a)
if ignoreSpace then
a["SortKey"] = A:gsub("%s+", "") -- remove spaces
else
- a["SortKey"] = A
+ a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
end
else
A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!',' ')) -- replace! by empty
if ignoreSpace then
a["SortKey"] = A:gsub("%s+", "")-- remove spaces
else
- a["SortKey"] = A
+ a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
end
end
- -- print(a["SortKey"])
- -- return A
+-- s:gsub("%s+", "") strip spaces
+ if findStr(a["SortKey"],"\\parenLeft") < 2 then a["SortKey"] = '{ '..Apage end
+ if findStr(a["SortKey"],"\\parenRight") < 2 then a["SortKey"] = '} '..Apage end
+ if findStr(a["SortKey"],"//escapedexcl//") < 2 then a["SortKey"] = '! '..Apage end
+ if findStr(a["SortKey"],"//escapedquote//") < 2 then a["SortKey"] = '" '..Apage end
+ if findStr(a["SortKey"],"//escapedat//") < 2 then a["SortKey"] = '@ '..Apage end
+ if findStr(a["SortKey"],"//escapedvert//") < 2 then a["SortKey"] = '| '..Apage end
+ -- 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() > 122 and a["SortKey"]:byte() < 128) then -- symbol above digits
+ a["SortKey"] = "/"..a["SortKey"] -- sort it after /
+ end
+ end
end
function GenerateSortKeys(Index)
for _, entry in ipairs(Index) do
+-- print("<<".._..entry["Entry"])
GenerateSortKey(entry)
end
end
@@ -555,12 +584,13 @@ end
function UTFCompare(a,b)
local A = a["SortKey"]
local B = b["SortKey"]
- writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2)
if use_UCA then
- return collator_obj:compare_strings(A,B)
+ compare = collator_obj:compare_strings(A,B)
else
- return A<B
+ compare = A<B
end
+ writeLog(1,"UTFCompare: A--B "..A.."--"..B.."A<B:"..tostring(compare).."\n",2)
+ return compare
end
@@ -923,6 +953,7 @@ function getSortChar(codepoints)
return getSortChar(codepoints)
end
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
end
diff --git a/indexing/xindex/lualatex/xindex-norsk.lua b/indexing/xindex/lualatex/xindex-norsk.lua
index 7fc34e24a3..19289ee086 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.48,
+ version = 0.49,
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 92d3aa92d8..ec6139e324 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.48,
+ version = 0.49,
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 1ab0b12f6b..dbf6c60e77 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.48,
+ version = 0.49,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",