summaryrefslogtreecommitdiff
path: root/indexing/xindex/lualatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-04 03:02:40 +0000
committerNorbert Preining <norbert@preining.info>2020-06-04 03:02:40 +0000
commit6c90555ebb89f41cc4dfb6cf3ee6bfaa8107650e (patch)
treed3475ab1d6bd6675a0975dfa6059602be057f0d5 /indexing/xindex/lualatex
parent44fde4a143b75ae4f383b05832343d497c254989 (diff)
CTAN sync 202006040302
Diffstat (limited to 'indexing/xindex/lualatex')
-rw-r--r--indexing/xindex/lualatex/xindex-DIN2.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-HAdW-eKO.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-base.lua17
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-common.lua6
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-uca.lua17
-rw-r--r--indexing/xindex/lualatex/xindex-cfg.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-dtk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lapp.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lib.lua88
-rw-r--r--indexing/xindex/lualatex/xindex-norsk.lua155
-rw-r--r--indexing/xindex/lualatex/xindex-pretty.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-yannis.lua260
12 files changed, 358 insertions, 197 deletions
diff --git a/indexing/xindex/lualatex/xindex-DIN2.lua b/indexing/xindex/lualatex/xindex-DIN2.lua
index 35eae4f069..6b925e3367 100644
--- a/indexing/xindex/lualatex/xindex-DIN2.lua
+++ b/indexing/xindex/lualatex/xindex-DIN2.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
index 5f1c8c8344..9b440fa94d 100644
--- a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
+++ b/indexing/xindex/lualatex/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.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-base.lua b/indexing/xindex/lualatex/xindex-base.lua
index 9d36d5ddd2..6c51f21763 100644
--- a/indexing/xindex/lualatex/xindex-base.lua
+++ b/indexing/xindex/lualatex/xindex-base.lua
@@ -6,7 +6,7 @@
-- LICENSE: LPPL1.3
-----------------------------------------------------------------------
-local info = { version = 0.22 }
+local info = { version = 0.23 }
-- check config
if pageNoPrefixDel ~= "" then
@@ -120,6 +120,21 @@ for i, str0 in ipairs(escape_chars) do
end
]] -- no more needed, we redo the setting
+if use_UCA then
+ for i=1, #NewIndex do
+ v = NewIndex[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
+end
+
if SORTendhook then
NewIndex = SORTendhook(NewIndex)
end
diff --git a/indexing/xindex/lualatex/xindex-cfg-common.lua b/indexing/xindex/lualatex/xindex-cfg-common.lua
index a49723ebf2..85f2c033b8 100644
--- a/indexing/xindex/lualatex/xindex-cfg-common.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-common.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-common'] = {
- version = 0.22,
+ version = 0.23,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -16,15 +16,17 @@ if not modules then modules = { } end modules ['xindex-cfg-common'] = {
indexheader = {
cs = {"Symboly", "Čísla"},
+ da = {"Symboler", "Tal"},
de = {"Symbole", "Zahlen"},
en = {"Symbols", "Numbers"},
- fr = {"Symboles","Chiffre"},
+ fr = {"Symboles","Nombres"},
it = {"Simboli", "Numeri"},
jp = {"シンボル","番号"},
}
folium = {
cs = {"f.", "ff."},
+ da = {"f", "ff"},
de = {"f", "ff"},
en = {"f", "ff"},
fr = {"\\,sq","\\,sqq"},
diff --git a/indexing/xindex/lualatex/xindex-cfg-uca.lua b/indexing/xindex/lualatex/xindex-cfg-uca.lua
new file mode 100644
index 0000000000..42ad4ec6dd
--- /dev/null
+++ b/indexing/xindex/lualatex/xindex-cfg-uca.lua
@@ -0,0 +1,17 @@
+-----------------------------------------------------------------------
+-- FILE: xindex-cfg-uca.lua
+-- DESCRIPTION: configuration file for lua-uca
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+-----------------------------------------------------------------------
+
+if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
+ version = 0.23,
+ comment = "configuration to xindex-cfg-uca.lua",
+ author = "Herbert Voss",
+ copyright = "Herbert Voss",
+ license = "LPPL 1.3"
+}
+
+-- put any additional code for lua-uca here ---
diff --git a/indexing/xindex/lualatex/xindex-cfg.lua b/indexing/xindex/lualatex/xindex-cfg.lua
index 9e1f12b6a2..7b23b7c905 100644
--- a/indexing/xindex/lualatex/xindex-cfg.lua
+++ b/indexing/xindex/lualatex/xindex-cfg.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-dtk.lua b/indexing/xindex/lualatex/xindex-dtk.lua
index a195ccde02..6a32d5e863 100644
--- a/indexing/xindex/lualatex/xindex-dtk.lua
+++ b/indexing/xindex/lualatex/xindex-dtk.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.22,
+ version = 0.23,
comment = "DTK configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-lapp.lua b/indexing/xindex/lualatex/xindex-lapp.lua
index b55cb170f8..94c22cb240 100644
--- a/indexing/xindex/lualatex/xindex-lapp.lua
+++ b/indexing/xindex/lualatex/xindex-lapp.lua
@@ -28,7 +28,7 @@
--~ n 2
--------------------------------
if not modules then modules = { } end modules ['xindex-lapp'] = {
- version = 0.22,
+ version = 0.23,
comment = "read parameter for xindex.lua",
author = "Steve Donovan",
copyright = "Steve Donovan",
diff --git a/indexing/xindex/lualatex/xindex-lib.lua b/indexing/xindex/lualatex/xindex-lib.lua
index 8e480866c8..720d473d53 100644
--- a/indexing/xindex/lualatex/xindex-lib.lua
+++ b/indexing/xindex/lualatex/xindex-lib.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.22,
+ version = 0.23,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -569,43 +569,15 @@ function GenerateSortKeys(Index)
end
end
-function UTFCompare(a,b)
--- a, b are something like \indexentry{foo}{bar}
--- writeLog(1,"UTFCompare: "..a["Entry"]..", "..a["pages"][1]["number"].." - "..b["Entry"]..", "..b["pages"][1]["number"].."\n",2)
--- k = k + 1
--- if (k % 50) == 0 then writeLog(1,".",1) end
-
+function UTFCompare(a,b)
local A = a["SortKey"]
local B = b["SortKey"]
-
writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2)
--- print(A,B)
---[[
- if A == B then -- same entry, use also page number
- Apage = string.format("%09s",a["pages"][1]["number"])
- Bpage = string.format("%09s",b["pages"][1]["number"])
- A = string.format("%-90s",A)..Apage
- B = string.format("%-90s",B)..Bpage
- end
- if numericPage then
- if tonumber(a["pages"][1]["number"]) then
- Apage = string.format("%09d",a["pages"][1]["number"])
- else
- Apage = string.format("%09d",romanToNumber(a["pages"][1]["number"]))
- end
- if tonumber(b["pages"][1]["number"]) then
- Bpage = string.format("%09d",b["pages"][1]["number"])
- else
- Bpage = string.format("%09d",romanToNumber(b["pages"][1]["number"]))
- end
+ if use_UCA then
+ return collator_obj:compare_strings(A,B)
else
- Apage = string.format("%09s",a["pages"][1]["number"])
- Bpage = string.format("%09s",b["pages"][1]["number"])
+ return A<B
end
- A = string.format("%-90s",A)..Apage
- B = string.format("%-90s",B)..Bpage
-]]
- return A < B
end
function pageCompare(a,b) -- a = {{number=...,special=..},{...,...}}
@@ -1012,3 +984,53 @@ function stripLeadingSpaces(str)
end
+-- 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 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
+
diff --git a/indexing/xindex/lualatex/xindex-norsk.lua b/indexing/xindex/lualatex/xindex-norsk.lua
deleted file mode 100644
index 7473b42ed6..0000000000
--- a/indexing/xindex/lualatex/xindex-norsk.lua
+++ /dev/null
@@ -1,155 +0,0 @@
------------------------------------------------------------------------
--- 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/indexing/xindex/lualatex/xindex-pretty.lua b/indexing/xindex/lualatex/xindex-pretty.lua
index 3e4f12a016..b671ba004e 100644
--- a/indexing/xindex/lualatex/xindex-pretty.lua
+++ b/indexing/xindex/lualatex/xindex-pretty.lua
@@ -5,7 +5,7 @@
--
if not modules then modules = { } end modules ['xindex-pretty'] = {
- version = 0.22,
+ version = 0.23,
comment = "dump a Lua table for debugging",
author = "Steve Donovan",
copyright = "Steve Donovan",
diff --git a/indexing/xindex/lualatex/xindex-yannis.lua b/indexing/xindex/lualatex/xindex-yannis.lua
new file mode 100644
index 0000000000..85bef308b9
--- /dev/null
+++ b/indexing/xindex/lualatex/xindex-yannis.lua
@@ -0,0 +1,260 @@
+-----------------------------------------------------------------------
+-- FILE: xindex-yannis.lua
+-- DESCRIPTION: configuration file for xindex.lua
+-- REQUIREMENTS:
+-- AUTHOR: Herbert Voß
+-- LICENSE: LPPL1.3
+-----------------------------------------------------------------------
+
+if not modules then modules = { } end modules ['xindex-yannis'] = {
+ version = 0.23,
+ comment = "main configuration to xindex.lua",
+ author = "Herbert Voss",
+ copyright = "Herbert Voss",
+ license = "LPPL 1.3"
+}
+
+itemPageDelimiter = "," -- Hello, 14
+compressPages = true -- something like 12--15, instaead of 12,13,14,15. the |( ... |) syntax is still valid
+fCompress = false -- 3f -> page 3, 4 and 3ff -> page 3, 4, 5
+minCompress = 2 -- 14--17 or
+rangeSymbol = "-" -- 14-17 instead of --
+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 !!!
+indexOpening = "" -- commands after \begin{theindex}
+idxnewletter = "\\textbf" -- Only valid if -n is not set
+
+
+--[[
+ Each character's position in this array-like table determines its 'priority'.
+ Several characters in the same slot have the same 'priority'.
+]]
+alphabet_lower = { -- for sorting
+ { 'α', 'ά', 'ὰ', 'ᾶ', 'ἀ', 'ἄ', 'ἂ', 'ἆ', 'ἁ', 'ἅ', 'ἃ', 'ἇ', 'ᾳ', 'ᾴ', 'ᾲ', 'ᾷ', 'ᾀ', 'ᾄ', 'ᾂ', 'ᾆ', 'ᾁ', 'ᾅ', 'ᾃ', 'ᾇ' },
+ { 'β', 'ϐ' },
+ { 'γ' },
+ { 'δ' },
+ { 'ε', 'έ', 'ὲ', 'ἐ', 'ἔ', 'ἒ', 'ἑ', 'ἕ', 'ἓ' },
+ { 'ζ' },
+ { 'η', 'ή', 'ὴ', 'ῆ', 'ἠ', 'ἤ', 'ἢ', 'ἦ', 'ἡ', 'ἥ', 'ἣ', 'ἧ', 'ῃ', 'ῄ', 'ῂ', 'ῇ', 'ᾐ', 'ᾔ', 'ᾒ', 'ᾖ', 'ᾑ', 'ᾕ', 'ᾓ', 'ᾗ' },
+ { 'θ' },
+ { 'ι', 'ί', 'ὶ', 'ῖ', 'ἰ', 'ἴ', 'ἲ', 'ἶ', 'ἱ', 'ἵ', 'ἳ', 'ἷ', 'ϊ', 'ΐ', 'ῒ', 'ῗ' },
+ { 'κ' },
+ { 'λ' },
+ { 'μ' },
+ { 'ν' },
+ { 'ξ' },
+ { 'ο', 'ό', 'ὸ', 'ὀ', 'ὄ', 'ὂ', 'ὁ', 'ὅ', 'ὃ' },
+ { 'π' },
+ { 'ρ' },
+ { 'σ', 'ς' },
+ { 'τ' },
+ { 'υ', 'ύ', 'ὺ', 'ῦ', 'ὐ', 'ὔ', 'ὒ', 'ὖ', 'ὑ', 'ὕ', 'ὓ', 'ὗ', 'ϋ', 'ΰ', 'ῢ', 'ῧ' },
+ { 'φ' },
+ { 'χ' },
+ { 'ψ' },
+ { 'ω', 'ώ', 'ὼ', 'ῶ', 'ὠ', 'ὤ', 'ὢ', 'ὦ', 'ὡ', 'ὥ', 'ὣ', 'ὧ', 'ῳ', 'ῴ', 'ῲ', 'ῷ', 'ᾠ', 'ᾤ', 'ᾢ', 'ᾦ', 'ᾡ', 'ᾥ', 'ᾣ', 'ᾧ' },
+ { 'a', 'á', 'à', 'ä', 'å', 'æ', },
+ { 'b' },
+ { 'c', 'ç' },
+ { 'd' },
+ { 'e', 'é', 'è', 'ë' },
+ { 'f' },
+ { 'g' },
+ { 'h' },
+ { 'i', 'í', 'ì', 'ï' },
+ { 'j' },
+ { 'k' },
+ { 'l' },
+ { 'm' },
+ { 'n', 'ñ' },
+ { 'o', 'ó', 'ò', 'ö', 'ø', 'œ'},
+ { 'p' },
+ { 'q' },
+ { 'r' },
+ { 's', 'š', 'ß' },
+ { 't' },
+ { 'u', 'ú', 'ù', 'ü' },
+ { 'v' },
+ { 'w' },
+ { 'x' },
+ { 'y', 'ý', 'ÿ' },
+ { 'z', 'ž' },
+ { 'а' },
+ { 'б' },
+ { 'в' },
+ { 'г', 'ѓ' },
+ { 'д' },
+ { 'е', 'ё' },
+ { 'ж' },
+ { 'з' },
+ { 'и', 'і' },
+ { 'й' },
+ { 'к' },
+ { 'л' },
+ { 'м' },
+ { 'н' },
+ { 'о' },
+ { 'п' },
+ { 'р' },
+ { 'с' },
+ { 'т' },
+ { 'у' },
+ { 'ф' },
+ { 'х' },
+ { 'ц' },
+ { 'ч' },
+ { 'ш' },
+ { 'щ' },
+ { 'ъ' },
+ { 'ы' },
+ { 'ь' },
+ { 'э' },
+ { 'ю' },
+ { 'я' },
+}
+alphabet_upper = { -- for sorting
+ { 'Α', 'Ά', 'Ἀ', 'Ἄ', 'Ἂ', 'Ἆ', 'Ἁ', 'Ἅ', 'Ἃ', 'Ἇ', 'ᾼ', 'ᾈ', 'ᾌ', 'ᾊ', 'ᾎ', 'ᾉ', 'ᾍ', 'ᾋ', 'ᾏ' },
+ { 'Β' },
+ { 'Γ' },
+ { 'Δ' },
+ { 'Ε', 'Έ', 'Ἐ', 'Ἔ', 'Ἒ', 'Ἑ', 'Ἕ', 'Ἓ' },
+ { 'Ζ' },
+ { 'Η', 'Ή', 'Ἠ', 'Ἤ', 'Ἢ', 'Ἦ', 'Ἡ', 'Ἥ', 'Ἣ', 'Ἧ', 'ῌ', 'ᾘ', 'ᾜ', 'ᾚ', 'ᾞ', 'ᾙ', 'ᾝ', 'ᾟ' },
+ { 'Θ' },
+ { 'Ι', 'Ί', 'Ἰ', 'Ἴ', 'Ἲ', 'Ἶ', 'Ἱ', 'Ἵ', 'Ἳ', 'Ἷ', 'Ϊ' },
+ { 'Κ' },
+ { 'Λ' },
+ { 'Μ' },
+ { 'Ν' },
+ { 'Ξ' },
+ { 'Ο', 'Ό', 'Ὀ', 'Ὄ', 'Ὂ', 'Ὁ', 'Ὅ', 'Ὃ' },
+ { 'Π' },
+ { 'Ρ' },
+ { 'Σ' },
+ { 'Τ' },
+ { 'Υ', 'Ύ', 'Ὑ', 'Ὕ', 'Ὓ', 'Ὗ', 'Ϋ' },
+ { 'Φ' },
+ { 'Χ' },
+ { 'Ψ' },
+ { 'Ω', 'Ώ', 'Ὠ', 'Ὤ', 'Ὢ', 'Ὦ', 'Ὡ', 'Ὥ', 'Ὣ', 'Ὧ', 'ῼ', 'ᾩ', 'ᾭ', 'ᾫ', 'ᾯ', 'ᾨ', 'ᾬ', 'ᾪ', 'ᾮ' },
+ { 'A', 'Á', 'À', 'Ä', 'Å', 'Æ'},
+ { 'B' },
+ { 'C', 'Ç' },
+ { 'D' },
+ { 'E', 'È', 'È', 'Ë' },
+ { 'F' },
+ { 'G' },
+ { 'H' },
+ { 'I', 'Í', 'Ì', 'Ï' },
+ { 'J' },
+ { 'K' },
+ { 'L' },
+ { 'M' },
+ { 'N', 'Ñ' },
+ { 'O', 'Ó', 'Ò', 'Ö', 'Ø','Œ' },
+ { 'P' },
+ { 'Q' },
+ { 'R' },
+ { 'S', 'Š' },
+ { 'T' },
+ { 'U', 'Ú', 'Ù', 'Ü' },
+ { 'V' },
+ { 'W' },
+ { 'X' },
+ { 'Y', 'Ý', 'Ÿ' },
+ { 'Z', 'Ž' },
+ { 'А' },
+ { 'Б' },
+ { 'В' },
+ { 'Г', 'Ѓ' },
+ { 'Д' },
+ { 'Е', 'Ё' },
+ { 'Ж' },
+ { 'З' },
+ { 'И', 'І' },
+ { 'Й' },
+ { 'К' },
+ { 'Л' },
+ { 'М' },
+ { 'Н' },
+ { 'О' },
+ { 'П' },
+ { 'Р' },
+ { 'С' },
+ { 'Т' },
+ { 'У' },
+ { 'Ф' },
+ { 'Х' },
+ { 'Ц' },
+ { 'Ч' },
+ { 'Ш' },
+ { 'Щ' },
+ { 'Ъ' },
+ { 'Ы' },
+ { 'Ь' },
+ { 'Э' },
+ { 'Ю' },
+ { 'Я' },
+}
+
+
+function SORTendhook(list)
+ print ("We have "..#list.." total list entries")
+ local greek = {}
+ local latin = {}
+ local cyrillic = {}
+ local symbols = {}
+ local numbers = {}
+ local others = {}
+ local firstChar, charType
+ local firstCharNumber
+ local v
+ for i=1,#list do
+ v = list[i]
+ firstChar = NormalizedUppercase(utf.sub(v["sortChar"],1,1))
+ v["sortChar"] = firstChar -- to be sure it is an uppercase unicode char
+ firstCharNumber = string.utfvalue(firstChar)
+ charType = getCharType(firstChar)
+-- print (utf.sub(v["sortChar"],1,1).."->"..firstChar.." ("..firstCharNumber..") ".." ("..charType..")")
+ if charType == 0 then
+ symbols[#symbols+1] = v
+ elseif charType == 1 then
+ numbers[#numbers+1] = v
+ elseif firstCharNumber > 0x052F then -- 0x052F is last cyrillic character
+ others[#others+1] = v
+ elseif firstCharNumber >= 0x0400 then -- 0x0400-0x052F cyrillic characters
+ cyrillic[#cyrillic+1] = v
+ elseif firstCharNumber <= 0x03FF then -- 0x03FF is last greek character
+ if firstCharNumber >= 0x0370 then
+ greek[#greek+1] = v -- 0x0370-0x03FF greek characters
+ elseif firstCharNumber <= 0x024F then
+ if firstCharNumber >= 0x041 then -- 0x041-0x024F latin character
+ latin[#latin+1] = v
+ else
+ others[#others+1] = v -- everything else
+ end
+ end
+ end
+ end
+ print ("We have "..#greek.." Greek entries")
+ print ("We have "..#latin.." Latin entries")
+ print ("We have "..#cyrillic.." Cyrillic entries")
+ print ("We have "..#symbols.." Symbol entries")
+ print ("We have "..#numbers.." Number entries")
+ print ("We have "..#others.." other entries")
+ list = {}
+ for i = 1,#greek do list[#list+1] = greek[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#latin do list[#list+1] = latin[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#cyrillic do list[#list+1] = cyrillic[i] end
+ list[#list]["Macro"] = "\\vspace{1cm}"
+ for i = 1,#symbols do list[#list+1] = symbols[i] end
+ for i = 1,#numbers do list[#list+1] = numbers[i] end
+ for i = 1,#others do list[#list+1] = others[i] end
+ print ("Sorted "..#list.." entries")
+ return list
+end
+