diff options
author | Karl Berry <karl@freefriends.org> | 2019-06-06 21:48:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-06-06 21:48:48 +0000 |
commit | a00ccc589e31a793b43c011f84af168d8f4789b6 (patch) | |
tree | 44aa072b1e2af0332355883b0fea7cc00e8301bf /Master/texmf-dist/tex | |
parent | 8c72e2851460499029099ad70cb4defd907df7cb (diff) |
xindex (6jun19)
git-svn-id: svn://tug.org/texlive/trunk@51330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
9 files changed, 140 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua index cbf9dd6bc03..d79c2cc8e2e 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.10, + version = 0.12, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -29,6 +29,7 @@ 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 = "--" --[[ 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 38ffcccab96..7e2b9cf7408 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-HAdW-eKO.lua @@ -9,7 +9,7 @@ -- configuration for index files of the Heidelberger Akademie der Wissenschaften if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = { - version = 0.10, + version = 0.12, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -26,6 +26,7 @@ numericPage = false -- 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 = "--" case_sensitive = false -- speeds up running diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua index 1a8919c1149..51b40cfb547 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua @@ -6,7 +6,7 @@ -- LICENSE: LPPL1.3 ----------------------------------------------------------------------- -local info = { version = 0.10} +local info = { version = 0.12 } -- check config if pageNoPrefixDel ~= "" then @@ -106,6 +106,9 @@ for i, str0 in ipairs(escape_chars) do end ]] -- no more needed, we redo the setting +if SORTendhook then + NewIndex = SORTendhook(NewIndex) +end outFile:write("\n") outFile:write("\\begin{theindex}\n") @@ -155,10 +158,12 @@ for k=1,#NewIndex do if charType == 0 then numbers = false symbols = true + letters = false end if charType == 1 then numbers = true symbols = false + letters = false end if charType > 1 then numbers = false @@ -170,7 +175,7 @@ for k=1,#NewIndex do if firstSLine then firstSLine = false if not no_headings then - outFile:write("\\textbf{"..index_header[1].."}") + outFile:write("\\par\\textbf{"..index_header[1].."}") if (labelPrefix == "") then outFile:write("\\label{xindex-"..index_header[1].."}\n\\nopagebreak[4]\n") else 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 6446cee0a62..7f84d4e8670 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg-common.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg-common'] = { - version = 0.10, + version = 0.12, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -27,3 +27,91 @@ folium = { fr = {"\\,sq","\\,sqq"}, } +alphabet_uppercase = { + { 'α', 'Α' }, + { 'β', 'Β' }, + { 'ϐ', 'ϐ' }, + { 'γ', 'Γ' }, + { 'δ', 'Δ' }, + { 'ε', 'Ε' }, + { 'ζ', 'Ζ' }, + { 'η', 'Η' }, + { 'θ', 'Θ' }, + { 'ι', 'Ι' }, + { 'κ', 'Κ' }, + { 'λ', 'Λ' }, + { 'μ', 'Μ' }, + { 'ν', 'Ν' }, + { 'ξ', 'Ξ' }, + { 'ο', 'Ο' }, + { 'π', 'Π' }, + { 'ρ', 'Ρ' }, + { 'σ', 'Σ' }, + { 'ς', 'ς' }, + { 'τ', 'Τ' }, + { 'υ', 'Υ' }, + { 'φ', 'Φ' }, + { 'χ', 'Χ' }, + { 'ψ', 'Ψ' }, + { 'ω', 'Ω' }, +-- + { 'a', 'A' }, + { 'b', 'B' }, + { 'c', 'C' }, + { 'd', 'D' }, + { 'e', 'E' }, + { 'f', 'F' }, + { 'g', 'G' }, + { 'h', 'H' }, + { 'i', 'I' }, + { 'j', 'J' }, + { 'k', 'K' }, + { 'l', 'L' }, + { 'm', 'M' }, + { 'n', 'N' }, + { 'o', 'O' }, + { 'p', 'P' }, + { 'q', 'Q' }, + { 'r', 'R' }, + { 's', 'S' }, + { 't', 'T' }, + { 'u', 'U' }, + { 'v', 'V' }, + { 'w', 'W' }, + { 'x', 'X' }, + { 'y', 'Y' }, + { 'z', 'Z' }, +-- + { 'а', 'А' }, + { 'б', 'Б' }, + { 'в', 'В' }, + { 'г', 'Г' }, + { 'д', 'Д' }, + { 'е', 'Е' }, + { 'ж', 'Ж' }, + { 'з', 'З' }, + { 'и', 'И' }, + { 'й', 'Й' }, + { 'к', 'К' }, + { 'л', 'Л' }, + { 'м', 'М' }, + { 'н', 'Н' }, + { 'о', 'О' }, + { 'п', 'П' }, + { 'р', 'Р' }, + { 'с', 'С' }, + { 'т', 'Т' }, + { 'у', 'У' }, + { 'ф', 'Ф' }, + { 'х', 'Х' }, + { 'ц', 'Ц' }, + { 'ч', 'Ч' }, + { 'ш', 'Ш' }, + { 'щ', 'Щ' }, + { 'ъ', 'Ъ' }, + { 'ы', 'Ы' }, + { 'ь', 'Ь' }, + { 'э', 'Э' }, + { 'ю', 'Ю' }, + { 'я', 'Я' } +} diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua index f4a72a9ffcb..0670c1f4d39 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.10, + version = 0.12, comment = "main configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -18,6 +18,7 @@ itemPageDelimiter = "," -- Hello, 14 compressPages = true -- something like 12--15, instaead 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 !!! diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua index 82327ed597b..7b4f6b18c8a 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-dtk.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-cfg'] = { - version = 0.10, + version = 0.12, comment = "DTK configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -21,6 +21,7 @@ minCompress = 3 -- 14--17 or numericPage = true -- for non numerical pagenumbers, like "VI-17" sublabels = {"","","",""} -- for the sub(sub(sub-items pageNoPrefixDel = "" -- a delimiter for page numbers like "VI-17" -- not used !!! +rangeSymbol = "--" indexOpening = "" --[[\providecommand*\lettergroupDefault[1]{} \providecommand*\lettergroup[1]{% \par\textbf{#1}\par diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua index f470fcb1e59..45c7fdec7dd 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua @@ -28,7 +28,7 @@ --~ n 2 -------------------------------- if not modules then modules = { } end modules ['xindex-lapp'] = { - version = 0.10, + version = 0.12, comment = "read parameter for xindex.lua", author = "Steve Donovan", copyright = "Steve Donovan", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua index a52b44cbbb0..a8227ce7cfb 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua @@ -7,7 +7,7 @@ ----------------------------------------------------------------------- if not modules then modules = { } end modules ['xindex-lib'] = { - version = 0.10, + version = 0.12, comment = "main library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -55,19 +55,31 @@ end function NormalizedUpper(strOrig) -- return normalized UTF string.upper (ä -> A) local str = "" + local c for i=1, utf.len(strOrig) do - local c = get_normalized_char(alphabet_lower,utf.sub(strOrig,i,i)) - str = str..string.upper(c) + c = get_normalized_char(alphabet_lower,utf.sub(strOrig,i,i)) +-- str = str..string.upper(c) + str = str..c end strOrig = str - str = "" + str="" for i=1, utf.len(strOrig) do - local c = get_normalized_char(alphabet_upper,utf.sub(strOrig,i,i)) - str = str..string.upper(c) + c = get_normalized_char(alphabet_upper,utf.sub(strOrig,i,i)) + c = NormalizedUppercase(c) + str = str..c end return str end +function NormalizedUppercase(chr) -- return normalized UTF uppercase letter + for i, alphabet_entry in ipairs(alphabet_uppercase) do + if chr == alphabet_entry[1] then + return alphabet_entry[2] + end + end + return chr +end + function NormalizedChars(strOrig) -- return normalized UTF string (ä -> a) with first as upper case local c = string.upper(get_normalized_char(alphabet_lower,utf.sub(strOrig,1,1))) local str = c @@ -181,7 +193,7 @@ function findSequences(a) -- look for 1,2,3,4, ... if a[i]-a[i-1] > 1 then -- not next page lastPage = a[i-1] -- new start for a sequence search if lastPage - firstPage >= minCompress then -- sequence found - b[#b+1]= tostring(firstPage).."--"..tostring(lastPage) + b[#b+1]= tostring(firstPage)..rangeSymbol..tostring(lastPage) else b[#b+1]= firstPage if (firstPage ~= lastPage) then b[#b+1]= lastPage end @@ -190,7 +202,7 @@ function findSequences(a) -- look for 1,2,3,4, ... end end if a[#a] - firstPage > 2 then -- test file end - b[#b+1]= tostring(firstPage).."--"..tostring(a[#a]) + b[#b+1]= tostring(firstPage)..rangeSymbol..tostring(a[#a]) else b[#b+1]= firstPage if (firstPage ~= a[#a]) then b[#b+1]= a[#a] end @@ -225,7 +237,7 @@ function checkParenthesis(Entries) -- search for |( ... |) entries elseif paraClose then lastPage = v["pages"][1]["number"] newEntries[#newEntries+1] = { Entry = v["Entry"], - pages = {{ number = firstPage.."--"..lastPage, + pages = {{ number = firstPage..rangeSymbol..lastPage, special = deleteOpenClose(v["pages"][1]["special"])}}, sortChar= v["sortChar"], Macro = v["Macro"] @@ -358,7 +370,7 @@ function compressPageList(pages) -- called with (v["pages"]) end -- only one pageno if #pages == 2 then -- only two pages if tonumber(pages[1]["number"]) and tonumber(pages[2]["number"]) then - if ((tonumber(pages[2]["number"]) - tonumber(pages[1]["number"])) == 1) and + if fCompress and ((tonumber(pages[2]["number"]) - tonumber(pages[1]["number"])) == 1) and (pages[1]["special"] == pages[2]["special"]) then pages[1]["number"] = pages[1]["number"].."f" pages[2] = nil @@ -392,9 +404,9 @@ if args_v then print ("compressPageList: more than two pages for the entry\n") elseif (#series == 1) then -- no -f page -> only one page -> output newPages[#newPages+1] = series[1] series = {pages[i]} - elseif (#series > minCompress) then -- we found series od f pages like 11, 12, 13, 14 + elseif (#series > minCompress) then -- we found series or f pages like 11, 12, 13, 14 -- the sequenz gets the special from the first page - newPages[#newPages+1] = { number = series[1]["number"].."--"..series[#series]["number"], special = series[1]["special"]} -- first..last + newPages[#newPages+1] = { number = series[1]["number"]..rangeSymbol..series[#series]["number"], special = series[1]["special"]} -- first..last series = {pages[i]} else -- series < minCompress if fCompress then @@ -433,7 +445,7 @@ if args_v then print ("compressPageList: more than two pages for the entry\n") series = {pages[i]} else -- current page is non numeric if (#series > minCompress) then -- we found a page series - newPages[#newPages+1] = { number = series[1]["number"].."--"..series[#series]["number"], -- first..last + newPages[#newPages+1] = { number = series[1]["number"]..rangeSymbol..series[#series]["number"], -- first..last special =series[1]["special"] } series = {pages[i]} else -- series < minCompress @@ -529,10 +541,13 @@ function UTFCompare(a,b) Apage = string.format("%09s",a["pages"][1]["number"]) Bpage = string.format("%09s",b["pages"][1]["number"]) end - A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!','')) -- replace! by empty - B = NormalizedChars(getSortString(b["Entry"].." "..Bpage..b["pages"][1]["special"]):gsub('!','')) --- A = NormalizedUpper(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!','')) -- replace! by empty --- B = NormalizedUpper(getSortString(b["Entry"].." "..Bpage..b["pages"][1]["special"]):gsub('!','')) + if no_caseSensitive then + A = NormalizedUpper(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!','')) -- replace! by empty + B = NormalizedUpper(getSortString(b["Entry"].." "..Bpage..b["pages"][1]["special"]):gsub('!','')) + else + A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!','')) -- replace! by empty + B = NormalizedChars(getSortString(b["Entry"].." "..Bpage..b["pages"][1]["special"]):gsub('!','')) + end writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2) -- print(A,B) --[[ @@ -583,8 +598,8 @@ function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}} -- now we have some special page numbers A = tostring(a0) B = tostring(b0) - A1 = A:find("--",1,true) or A:find("f",1,true) -- sequence or folio pages - B1 = B:find("--",1,true) or B:find("f",1,true) + A1 = A:find(rangeSymbol,1,true) or A:find("f",1,true) -- sequence or folio pages + B1 = B:find(rangeSymbol,1,true) or B:find("f",1,true) if A1 then a0 = tonumber(A:sub(1,A1-1)) end if B1 then b0 = tonumber(B:sub(1,B1-1)) end return tonumber(a0) < tonumber(b0) -- numeric diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua index 588f2d842a1..3e252581fc7 100644 --- a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua @@ -5,7 +5,7 @@ -- if not modules then modules = { } end modules ['xindex-pretty'] = { - version = 0.10, + version = 0.12, comment = "dump a Lua table for debugging", author = "Steve Donovan", copyright = "Steve Donovan", |