-
Notifications
You must be signed in to change notification settings - Fork 0
/
xindex-muya.lua
173 lines (159 loc) · 3.97 KB
/
xindex-muya.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
-----------------------------------------------------------------------
-- FILE: xindex-muya.lua
-- DESCRIPTION: configuration file for xindex.lua
-- REQUIREMENTS:
-- AUTHOR: Martin Sievers
-- LICENSE: LPPL1.3
-- VERSION: v0.62.0
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-muya'] = {
version = 0.33,
comment = "",
author = "Martin Sievers",
copyright = "Martin Sievers",
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
languages.av = function(collator_obj)
local tailoring = function(s) collator_obj:tailor_string(s) end
tailoring("&a<ā<ā̊ <ą<b<β<c<d<δ<e<ē<ǝ=ə<ǝ̄=ə̄<f<g<γ<h<i<ī<j<k<m<n<ń<ṇ<ŋ<ŋ́<ŋv<o<ō<p<r<s<š<š́<ṣ̌<t<t̰<ϑ=θ<u<ū<v<x<x́<xv<y<z<ž")
return collator_obj
end
languages.gu = function(collator_obj)
local tailoring = function(s) collator_obj:tailor_string(s) end
tailoring("&a<ā<i<ī<u<ū<e<o<ṃ<k<kh<g<gh<c<ch<j<z<ṭ<ṭh<ḍ<ḍh<ṇ<t<th<d<dh<n<p<f<b<bh<m<y<r<l<v<ś<ṣ<s<h<ḷ")
return collator_obj
end
-- language 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
itemPageDelimiter = "\\quad "
compressPages = true
fCompress = false
minCompress = 1
rangeSymbol = "--"
numericPage = true
sublabels = {"", "", "", ""}
pageNoPrefixDel = ""
indexOpening = ""
idxnewletter = "\\textbf" -- Only valid if -n is not set
envStart = "\\begin{theindex}"
envStop = "\\end{theindex}"
function UTFCompare(a,b)
local A = a["SortKey"]
local B = b["SortKey"]
A = string.gsub( A, '%-', '' )
A = string.gsub( A, '%.', '' )
A = string.gsub( A, '%(', '' )
A = string.gsub( A, '%)', '' )
A = string.gsub( A, ' ', '' )
--
B = string.gsub( B, '%-', '' )
B = string.gsub( B, '%.', '' )
B = string.gsub( B, '%(', '' )
B = string.gsub( B, '%)', '' )
B = string.gsub( B, ' ', '' )
return collator_obj:compare_strings(A,B)
end
--[[
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
{ ' ' }, -- only for internal tests
{ 'a' },
{ 'ā' },
{ 'ā̊' },
{ 'ą' },
{ 'b' },
{ 'β' },
{ 'c' },
{ 'd' },
{ 'δ' },
{ 'e' },
{ 'ē' },
{ 'ə' },
{ 'ə̄' },
{ 'f' },
{ 'g' },
{ 'γ' },
{ 'h' },
{ 'i' },
{ 'ī' },
{ 'j' },
{ 'k' },
{ 'l' },
{ 'm' },
{ 'n' },
{ 'ń' },
{ 'ṇ' },
{ 'ŋ' },
{ 'ŋ́ ' },
{ 'ŋv' },
{ 'o' },
{ 'ō' },
{ 'p' },
{ 'q' },
{ 'r' },
{ 's' },
{ 'š' },
{ 'š́' },
{ 'ṣ̌' },
{ 't' },
{ 't̰' },
{ 'ϑ', 'θ' },
{ 'u' },
{ 'ū' },
{ 'v' },
{ 'w' },
{ 'x' },
{ 'x́ ' },
{ 'xv' },
{ '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', 'Ž' }
}