summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua')
-rw-r--r--Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua34
1 files changed, 31 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua
index b9464eb1f5f..a52b44cbbb0 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.09,
+ version = 0.10,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -68,6 +68,25 @@ function NormalizedUpper(strOrig) -- return normalized UTF string.upper (ä ->
return str
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
+ for i=2, utf.len(strOrig) do
+ c = get_normalized_char(alphabet_lower,utf.sub(strOrig,i,i))
+ str = str..c
+ end
+ local strOrigTrue = strOrig
+ strOrig = str
+ c = string.upper(get_normalized_char(alphabet_upper,utf.sub(strOrig,1,1)))
+ str = c
+ for i=2, utf.len(strOrig) do
+ c = get_normalized_char(alphabet_upper,utf.sub(strOrig,i,i))
+ str = str..c
+ end
+-- print(strOrigTrue.." -> "..str)
+ return str
+end
+
function checkVert(str) -- get the | part
local vert = string.find(str,"|",1,true)
if (vert) then
@@ -510,8 +529,10 @@ function UTFCompare(a,b)
Apage = string.format("%09s",a["pages"][1]["number"])
Bpage = string.format("%09s",b["pages"][1]["number"])
end
- 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('!',''))
+ 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('!',''))
writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2)
-- print(A,B)
--[[
@@ -572,6 +593,13 @@ function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}}
end
end
+function charCompare(a,b) -- compare only first char
+ local A,B
+ A = string.upper(utf.sub(a["sortChar"],1,1))
+ B = string.upper(utf.sub(b["sortChar"],1,1))
+ return A < B
+end
+
function checkFF(p)
if not p then return p end
local P = tostring(p)