diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-07 21:21:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-07 21:21:59 +0000 |
commit | bb3a18a8791a2f32a6c8a3e0c9ee15a643aefd89 (patch) | |
tree | 22208b922e1222cddf4275d663628c025848b67d /Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua | |
parent | d71a23f77ba5aa8ad94858efe8080b2cc100bb25 (diff) |
xindex (7apr19)
git-svn-id: svn://tug.org/texlive/trunk@50842 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/xindex/xindex-lib.lua | 34 |
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) |