summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/xindex/xindex.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-03 21:22:07 +0000
committerKarl Berry <karl@freefriends.org>2020-06-03 21:22:07 +0000
commit51fd9695523eae3273b36259411d456341f02a64 (patch)
tree2ac7e8aa79b5d5860e339b4405d84fa255fa7967 /Master/texmf-dist/scripts/xindex/xindex.lua
parentca46fdb68d0556867eabb3169853811b944c9d19 (diff)
xindex (3jun20)
git-svn-id: svn://tug.org/texlive/trunk@55401 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/xindex/xindex.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/xindex/xindex.lua38
1 files changed, 37 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/xindex/xindex.lua b/Master/texmf-dist/scripts/xindex/xindex.lua
index d4316b2949f..2f4654ec136 100755
--- a/Master/texmf-dist/scripts/xindex/xindex.lua
+++ b/Master/texmf-dist/scripts/xindex/xindex.lua
@@ -8,7 +8,7 @@
-----------------------------------------------------------------------
xindex = xindex or { }
- local version = 0.22
+ local version = 0.23
xindex.version = version
--xindex.self = "xindex"
@@ -49,6 +49,7 @@ local args = require ('xindex-lapp') [[
-o,--output (default "")
-l,--language (default en)
-p,--prefix (default L)
+ -u,--use_UCA
<input> (string)
]]
@@ -174,6 +175,8 @@ escape_chars = { -- by default " is the escape char
{esc_char..')', '//escapedparenright//',')' }
}
+local language = "en" -- default language
+
language = string.lower(args["language"]):sub(1, 2)
writeLog(2,"Language = "..language.."\n",1)
if (indexheader[language] == nil) then
@@ -189,6 +192,39 @@ else
page_folium = folium[language]
end
+use_UCA = args["use_UCA"]
+if use_UCA then
+ writeLog(1,"Will use LUA-UCA\n",1)
+ ducet = require "lua-uca.lua-uca-ducet"
+ collator = require "lua-uca.lua-uca-collator"
+ languages = require "lua-uca.lua-uca-languages"
+ collator_obj = collator.new(ducet)
+
+ local uca_config_file = "xindex-cfg-uca.lua"
+ writeLog(2,"Loading local UCA config file "..uca_config_file,0)
+ UCA_Config_File = kpse.find_file(uca_config_file)
+ uca_cfg = require(UCA_Config_File)
+ writeLog(2," ... done\n",0)
+
+-- language name specified on the command line doesn't seem to be available
+-- in the config file, so we just try to find it ourselves
+ for i, a in ipairs(arg) do
+ if a == "-l" or a=="--language" then
+ language = arg[i+1]
+ break
+ end
+ end
+
+ if languages[language] then
+ print("[Lua-UCA] Loading language: " .. language)
+ collator_obj = languages[language](collator_obj)
+ end
+else
+ writeLog(1,"Will _not_ use LUA-UCA\n",1)
+end
+
+upper = unicode.utf8.upper
+
no_caseSensitive = args["no_casesensitive"]
if no_caseSensitive then
writeLog(1,"Sorting will be no case sensitive\n",1)