diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-31 21:10:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-31 21:10:45 +0000 |
commit | 04bf513956f952e12fe0a3db63b4ed812e96b50f (patch) | |
tree | a6719a90340cb4acb0f5d74d4ca9d91bd60f70ff /Master/texmf-dist/tex | |
parent | 1e4ada3a2007431617c98c097519e60b9c0f3c75 (diff) |
xindex (31may20)
git-svn-id: svn://tug.org/texlive/trunk@55361 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
10 files changed, 167 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-DIN2.lua index 91856b5bdf5..35eae4f0696 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.21, + version = 0.22, 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 9f463da2051..5f1c8c8344b 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.21, + version = 0.22, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-base.lua index 4a8ffffa35a..9d36d5ddd23 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.21 } +local info = { version = 0.22 } -- check config if pageNoPrefixDel ~= "" then 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 75febfb1dac..a49723ebf2c 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.21, + version = 0.22, comment = "configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", @@ -15,6 +15,7 @@ if not modules then modules = { } end modules ['xindex-cfg-common'] = { } indexheader = { + cs = {"Symboly", "Čísla"}, de = {"Symbole", "Zahlen"}, en = {"Symbols", "Numbers"}, fr = {"Symboles","Chiffre"}, @@ -23,12 +24,13 @@ indexheader = { } folium = { + cs = {"f.", "ff."}, de = {"f", "ff"}, en = {"f", "ff"}, fr = {"\\,sq","\\,sqq"}, it = {"f", "ff"}, - no = {"\\,f.","\\,ff."}, jp = {"シンボル","番号"}, + no = {"\\,f.","\\,ff."}, } alphabet_uppercase = { diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-cfg.lua index 6c3724fff9f..9e1f12b6a23 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.21, + version = 0.22, comment = "main configuration to xindex.lua", 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 dec7ffe82b6..a195ccde023 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.21, + version = 0.22, comment = "DTK configuration to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-lapp.lua index a427274dd85..b55cb170f80 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.21, + version = 0.22, 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 0bb3d2c4fdc..8e480866c8f 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.21, + version = 0.22, comment = "main library to xindex.lua", author = "Herbert Voss", copyright = "Herbert Voss", diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua new file mode 100644 index 00000000000..7473b42ed69 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/xindex/xindex-norsk.lua @@ -0,0 +1,155 @@ +----------------------------------------------------------------------- +-- FILE: xindex-norsk.lua +-- DESCRIPTION: configuration file for xindex.lua +-- REQUIREMENTS: +-- AUTHOR: Herbert Voß +-- MODIFIED: Sveinung Heggen (2020-01-02) +-- LICENSE: LPPL1.3 +----------------------------------------------------------------------- + +if not modules then modules = { } end modules ['xindex-norsk'] = { + version = 0.22, + comment = "configuration to xindex.lua", + author = "Herbert Voss", + copyright = "Herbert Voss", + license = "LPPL 1.3" +} + +local ducet = require "lua-uca.lua-uca-ducet" +local collator = require "lua-uca.lua-uca-collator" +local languages = require "lua-uca.lua-uca-languages" +local collator_obj = collator.new(ducet) + +local language = "en" -- default language +-- 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 + +local upper = unicode.utf8.upper + +escape_chars = { -- by default " is the escape char + {'""', "\\escapedquote", '\"{}' }, + {'"@', "\\escapedat", "@" }, + {'"|', "\\escapedvert", "|" }, + {'"!', "\\escapedexcl", "!" }, + {'"(', "\\escapedparenleft", "(" }, + {'")', "\\escapedparenright", ")" } +} + +itemPageDelimiter = "," -- Hello, 14 +compressPages = true -- something like 12--15, instead 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 +numericPage = true -- for non-numerical page numbers, 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 = "--" +idxnewletter = "\\textbf" -- Only valid if -n is not set + +folium = { + de = {"f.", "ff."}, + en = {"f.", "ff."}, + fr = {"\\,sq","\\,sqq"}, + no = {"\\,f.","\\,ff."}, + cs = {"f.", "ff."}, +} + +indexheader = { + de = {"Symbole", "Zahlen"}, + en = {"Symbols", "Numbers"}, + fr = {"Symboles","Chiffre"}, + jp = {"シンボル","番号"}, + cs = {"Symboly", "Čísla"} +} + + +-- get Unicode category of the codepoint, if supported +function getCategory(codepoints) + local codepoint = codepoints[1] + local category = get_category(codepoint) + if category == "Nd" then + return "digits" + elseif category:match("^L") then + local block = binary_range_search(codepoint, unicode_blocks) or {} + return block[3] or "other" + end + return "other" +end + +-- insert the index entry to the categories subtable +function categorize(codepoints, entry, categories) + local subcategories = categories.categories + -- return category name from the Unicode block of the first character + local category = getCategory(codepoints) + -- if the categories doesn't use this code block, categorize it as other + local used = subcategories[category] and category or "other" + table.insert(subcategories[used], entry) +end + +-- convert categories back to index list +function uncategorize(ordering_categories) + local newlist = {} + -- make new index order based on defined categories + for _, category in ipairs(ordering_categories.order) do + for _,entry in ipairs(ordering_categories.categories[category]) do + newlist[#newlist+1] = entry + end + end + return newlist +end + + +function UTFCompare(a,b) + local A = a["SortKey"] + local B = b["SortKey"] + return collator_obj:compare_strings(A,B) +end + +function getSortChar(codepoints) + if #codepoints > 0 then + local codes, pos = collator_obj:get_lowest_char(codepoints, 1) + if not codes then + -- if the first character in the sort key doesn't return letter + -- continue until we find some + table.remove(codepoints, 1) + return getSortChar(codepoints) + end + local sort_char = utf8.char(table.unpack(codes)) + -- print unicode category of the first char + return upper(sort_char) -- use unicode.utf8.upper to make the char uppercase + end +end + +function SORTendhook(list) + -- get the headers for letter groups + for i=1, #list do + v = list[i] + -- the collator:get_lowest_char will return character on the given + -- position. It will be lowercase and without accents. + local codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.SortKey)) + v.sortChar = getSortChar(codepoints) --or getSortChar(collator_obj:string_to_codepoints(NormalizedUpper(v.Entry))) + if not v.sortChar then + -- alternativelly use v.Entry if SortKey doesn't contain usable string + codepoints = collator_obj:string_to_codepoints(NormalizedUpper(v.Entry)) + v.sortChar = getSortChar(codepoints) + end + end + return list +end + +-- We use Lua-UCA methods for sorting and determining first characters, so +-- alphabet list is obsolete + +alphabet_lower = { } +alphabet_upper = { } diff --git a/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua b/Master/texmf-dist/tex/lualatex/xindex/xindex-pretty.lua index 95838f807ec..3e4f12a0167 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.21, + version = 0.22, comment = "dump a Lua table for debugging", author = "Steve Donovan", copyright = "Steve Donovan", |