summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-07-06 19:47:42 +0000
committerKarl Berry <karl@freefriends.org>2023-07-06 19:47:42 +0000
commit0f3f21d7a985893fe3c8a594937a84640b77b590 (patch)
tree4dfd0b8a25bb5108d1c4538cbac1e82455df1d88 /Master/texmf-dist/tex
parented791132736e91eb8e0b3c66c29bd4babd7c6b71 (diff)
xindex (6jul23)
git-svn-id: svn://tug.org/texlive/trunk@67563 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/xindex/xindex.sty8
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua27
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua51
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua2
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua2
15 files changed, 81 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/xindex/xindex.sty b/Master/texmf-dist/tex/latex/xindex/xindex.sty
index a2b229b74f3..4832bdf75d0 100644
--- a/Master/texmf-dist/tex/latex/xindex/xindex.sty
+++ b/Master/texmf-dist/tex/latex/xindex/xindex.sty
@@ -1,6 +1,6 @@
%% This is file `xindex.sty',
%%
-%% Copyright (C) 2018-2022
+%% Copyright (C) 2018-2023
%% Herbert Voss
%%
%% It may be distributed and/or modified under the
@@ -11,10 +11,9 @@
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%
-% $Id: xindex.sty 836 2018-11-11 20:22:56Z herbert $
%
% -------------------------------------
-\ProvidesPackage{xindex}[2018/11/11 v. 0.02 write into an idx file (hv)]
+\ProvidesPackage{xindex}[2023/07/01 v. 0.03 write into an idx file (hv)]
%
\RequirePackage{xkeyval}
@@ -72,5 +71,8 @@
\def\writeidx#1{\write\@indexfile{\noexpand#1}}
\fi
+\providecommand\parenLeft{\{}
+\providecommand\parenRight{\}}
+
\endinput
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua
index a544692b487..5fa7dbfd3dd 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-AU.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua
index c82b153e82e..d08942fb9a0 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua
index 465a7bdb224..e9adda19358 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-RU.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua
index 37a67838129..336142e30c8 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
index 5e563aec478..9d7c9188eb4 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-baselib.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua
index 33f4b2cbb4e..4793d1758dd 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua
index 2a87366dad8..014d3719d23 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-uca.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua
index b475a2eb7f9..24098c5272e 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua
index 80d7426381f..f7d2d09b5fe 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-danteedition.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua
index 0082be4dc94..74de071b0a3 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
index 97ede6b8fce..f321765c64c 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua
index 7fc34e24a32..19289ee0861 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua
index 92d3aa92d80..ec6139e324d 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua
index 1ab0b12f6be..dbf6c60e772 100644
--- a/Master/texmf-dist/tex/lualatex/xindex/xindex-yannis.lua
+++ b/Master/texmf-dist/tex/lualatex/xindex/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",