aboutsummaryrefslogtreecommitdiff
path: root/arabluatex_trans.lua
diff options
context:
space:
mode:
Diffstat (limited to 'arabluatex_trans.lua')
-rw-r--r--arabluatex_trans.lua78
1 files changed, 62 insertions, 16 deletions
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
index bc44229..0868262 100644
--- a/arabluatex_trans.lua
+++ b/arabluatex_trans.lua
@@ -31,7 +31,7 @@ punctuationtr = {
31 31
32nulltr = { 32nulltr = {
33 {a="%|", b=""}, 33 {a="%|", b=""},
34 {a="o.-o", b=""} 34 {a="o[%S]-o", b=""}
35} 35}
36 36
37-- cap 37-- cap
@@ -97,14 +97,14 @@ hamzatrdmg = {
97 {a="(A)(')", b="%1ʾ"}, -- historic madda 97 {a="(A)(')", b="%1ʾ"}, -- historic madda
98 -- initial (needs both ^ and %W patterns) 98 -- initial (needs both ^ and %W patterns)
99 -- 'aw: the diphthong is to be resolved into 'awi' (next 8 lines) 99 -- 'aw: the diphthong is to be resolved into 'awi' (next 8 lines)
100 {a="^('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1i"}, 100 {a="^('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1i"},
101 {a="(%W)('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)(.-o)", b="%1%2i"}, 101 {a="(%W)('aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1%2i"},
102 {a="^('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1i"}, 102 {a="^('aw)(o)(\"?[uai])([%S]-o)", b="%1i"},
103 {a="(%W)('aw)(o)([%(%[%|%<]?\"?[uai])(.-o)", b="%1%2i"}, 103 {a="(%W)('aw)(o)(\"?[uai])([%S]-o)", b="%1%2i"},
104 {a="^('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"}, 104 {a="^('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
105 {a="(%W)('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"}, 105 {a="(%W)('aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"},
106 {a="^('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, 106 {a="^('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, --p
107 {a="(%W)('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1%2i%3%4"}, 107 {a="(%W)('aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1%2i%3%4"}, --p
108 -- then the 'initial' rules for the remaining cases 108 -- then the 'initial' rules for the remaining cases
109 {a="^(')([ua])", b="ʾ%2"}, 109 {a="^(')([ua])", b="ʾ%2"},
110 {a="^(')(i)", b="ʾ%2"}, 110 {a="^(')(i)", b="ʾ%2"},
@@ -138,12 +138,19 @@ hamzatrdmg = {
138} 138}
139 139
140tanwintrdmg = { 140tanwintrdmg = {
141 {a="%-?([uai]NU)(o)([ui])([%S]-o)", b="\\arbup{un%3}"},
141 {a="%-?([uai]NU)(%s)([ui])", b="\\arbup{un%3}%2'"}, 142 {a="%-?([uai]NU)(%s)([ui])", b="\\arbup{un%3}%2'"},
142 {a="%-?uNU", b="\\arbup{un}"}, 143 {a="%-?uNU", b="\\arbup{un}"},
143 {a="%-?aNU", b="\\arbup{an}"}, 144 {a="%-?aNU", b="\\arbup{an}"},
144 {a="%-?iNU", b="\\arbup{in}"}, 145 {a="%-?iNU", b="\\arbup{in}"},
145 {a="%-?iNI", b="i\\arbup{n}"}, 146 {a="%-?iNI", b="i\\arbup{n}"},
146 -- tanwīn preceding ʾalif conjunctionis 147 -- tanwīn preceding ʾalif conjunctionis
148 {a="%-?(uN)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="\\arbup{uni}"},
149 {a="%-?(aN)(_A)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="ạ\\arbup{ni}"},
150 {a="%-?(aN)(Y)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="ạ\\arbup{ni}"},
151 {a="(T)%-?(aN)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="t\\arbup{ani}"},
152 {a="([^TA])%-?(aN)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1\\arbup{ani}"},
153 {a="%-?(iN)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="\\arbup{ini}"},
147 {a="%-?(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{uni}%2%3"}, 154 {a="%-?(uN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{uni}%2%3"},
148 {a="%-?(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, 155 {a="%-?(aN)(_A)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"},
149 {a="%-?(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"}, 156 {a="%-?(aN)(Y)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="ạ\\arbup{ni}%3%4"},
@@ -151,6 +158,12 @@ tanwintrdmg = {
151 {a="([^TA])%-?(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1\\arbup{ani}%3%4"}, 158 {a="([^TA])%-?(aN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1\\arbup{ani}%3%4"},
152 {a="%-?(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{ini}%2%3"}, 159 {a="%-?(iN)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="\\arbup{ini}%2%3"},
153 -- tanwīn preceding 'lla_dI/'llatI 160 -- tanwīn preceding 'lla_dI/'llatI
161 {a="%-?(uN)(o)('lla[%_]?[dt])([%S]-o)", b="\\arbup{uni}"},
162 {a="%-?(aN)(_A)(o)('lla[%_]?[dt])([%S]-o)", b="ạ\\arbup{ni}"},
163 {a="%-?(aN)(Y)(o)('lla[%_]?[dt])([%S]-o)", b="ạ\\arbup{ni}"},
164 {a="(T)%-?(aN)(o)('lla[%_]?[dt])([%S]-o)", b="t\\arbup{ani}"},
165 {a="([^TA])%-?(aN)(o)('lla[%_]?[dt])([%S]-o)", b="%1\\arbup{ani}"},
166 {a="%-?(iN)(o)('lla[%_]?[dt])([%S]-o)", b="\\arbup{ini}"},
154 {a="%-?(uN)(%s)('lla[%_]?[dt])", b="\\arbup{uni}%2%3"}, 167 {a="%-?(uN)(%s)('lla[%_]?[dt])", b="\\arbup{uni}%2%3"},
155 {a="%-?(aN)(_A)(%s)('lla[%_]?[dt])", b="ạ\\arbup{ni}%3%4"}, 168 {a="%-?(aN)(_A)(%s)('lla[%_]?[dt])", b="ạ\\arbup{ni}%3%4"},
156 {a="%-?(aN)(Y)(%s)('lla[%_]?[dt])", b="ạ\\arbup{ni}%3%4"}, 169 {a="%-?(aN)(Y)(%s)('lla[%_]?[dt])", b="ạ\\arbup{ni}%3%4"},
@@ -158,12 +171,19 @@ tanwintrdmg = {
158 {a="([^TA])%-?(aN)(%s)('lla[%_]?[dt])", b="%1\\arbup{ani}%3%4"}, 171 {a="([^TA])%-?(aN)(%s)('lla[%_]?[dt])", b="%1\\arbup{ani}%3%4"},
159 {a="%-?(iN)(%s)('lla[%_]?[dt])", b="\\arbup{ini}%2%3"}, 172 {a="%-?(iN)(%s)('lla[%_]?[dt])", b="\\arbup{ini}%2%3"},
160 -- tanwīn + alif without hamza and kasra (ibn) or dhamma (uhrub) 173 -- tanwīn + alif without hamza and kasra (ibn) or dhamma (uhrub)
174 {a="%-?(uN)(o)([ui])([%S]-o)", b="\\arbup{un%3}"},
175 {a="%-?(aN)(_A)(o)([ui])([%S]-o)", b="ạ\\arbup{n%4}"},
176 {a="%-?(aN)(Y)(o)([ui])([%S]-o)", b="ạ\\arbup{n%4}"},
177 {a="(T)%-?(aN)(o)([ui])([%S]-o)", b="t\\arbup{an%4}"},
178 {a="([^TA])%-?(aN)(o)([ui])([%S]-o)", b="%1\\arbup{an%4}"},
179 {a="%-?(iN)(o)([ui])([%S]-o)", b="\\arbup{in%3}"},
180 {a="(o[%S]-)([uai]N)(o)(\"?[ui])", b="'"},
161 {a="%-?(uN)(%s)([ui])", b="\\arbup{un%3}%2'"}, 181 {a="%-?(uN)(%s)([ui])", b="\\arbup{un%3}%2'"},
162 {a="%-?(aN)(_A)(%s)([ui])", b="ạ\\arbup{n%4}%3%'"}, 182 {a="%-?(aN)(_A)(%s)([ui])", b="ạ\\arbup{n%4}%3'"},
163 {a="%-?(aN)(Y)(%s)([ui])", b="ạ\\arbup{n%4}%3%'"}, 183 {a="%-?(aN)(Y)(%s)([ui])", b="ạ\\arbup{n%4}%3'"},
164 {a="(T)%-?(aN)(%s)([ui])", b="t\\arbup{an%4}%3%'"}, 184 {a="(T)%-?(aN)(%s)([ui])", b="t\\arbup{an%4}%3'"},
165 {a="([^TA])%-?(aN)(%s)([ui])", b="%1\\arbup{an%4}%3%'"}, 185 {a="([^TA])%-?(aN)(%s)([ui])", b="%1\\arbup{an%4}%3'"},
166 {a="%-?(iN)(%s)([ui])", b="\\arbup{in%3}%2%'"}, 186 {a="%-?(iN)(%s)([ui])", b="\\arbup{in%3}%2'"},
167 -- 187 --
168-- {a="uN", b="\\arbup{un}"}, (now included in the last line of this table) 188-- {a="uN", b="\\arbup{un}"}, (now included in the last line of this table)
169 {a="%-?(\"?At)%-?([ui])N", b="\\arbup{%1%2n}"}, 189 {a="%-?(\"?At)%-?([ui])N", b="\\arbup{%1%2n}"},
@@ -178,11 +198,15 @@ trigraphstrdmg = { -- trigraphs or more
178 -- 'llatI / 'llad_I 198 -- 'llatI / 'llad_I
179 {a="^'ll(a)([%_]?[dt])", b="'ll%1%2"}, 199 {a="^'ll(a)([%_]?[dt])", b="'ll%1%2"},
180 {a="([%(%[%|%<%s])'ll(a)([%_]?[dt])", b="%1'll%2%3"}, --p 200 {a="([%(%[%|%<%s])'ll(a)([%_]?[dt])", b="%1'll%2%3"}, --p
181 -- law: the diphthong is to be resoved into 'awi' (next 4 lines) 201 -- law: the diphthong is to be resolved into 'awi' (next 8 lines)
202 {a="^(law)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1i"},
203 {a="(%W)(law)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1%2i"},
204 {a="^(law)(o)(\"?[uai])([%S]-o)", b="%1i"},
205 {a="(%W)(law)(o)(\"?[uai])([%S]-o)", b="%1%2i"},
182 {a="^(law)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"}, 206 {a="^(law)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
183 {a="(%W)(law)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"}, 207 {a="(%W)(law)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1%2i%3%4"},
184 {a="^(law)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, 208 {a="^(law)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, --p
185 {a="(%W)(law)(%s)([%(%[%|%<]?\"?[uai])", b="%1%2i%3%4"}, 209 {a="(%W)(law)(%s)([%(%[%|%<]?\"?[uai])", b="%1%2i%3%4"}, --p
186 -- al- + lām 210 -- al- + lām
187 {a="^(a)l%-(l)", b="%1l-%2"}, 211 {a="^(a)l%-(l)", b="%1l-%2"},
188 {a="([%(%[%|%<%s%-])(a)l%-(l)", b="%1%2l-%3"}, --p 212 {a="([%(%[%|%<%s%-])(a)l%-(l)", b="%1%2l-%3"}, --p
@@ -201,8 +225,14 @@ trigraphstrdmg = { -- trigraphs or more
201 {a="^(a)l%-", b="%1l-"}, 225 {a="^(a)l%-", b="%1l-"},
202 {a="([%(%[%|%<%s%-])(a)l%-", b="%1%2l-"}, --p 226 {a="([%(%[%|%<%s%-])(a)l%-", b="%1%2l-"}, --p
203 -- diphthongs to be resolved before ʾalif conjunctionis 227 -- diphthongs to be resolved before ʾalif conjunctionis
228 {a="(aw)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1u"},
229 {a="(ay)(o)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="%1i"},
230 {a="(aw)(o)(\"?[uai])([%S]-o)", b="%1u"},
231 {a="(ay)(o)(\"?[uai])([%S]-o)", b="%1i"},
204 {a="(aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1u%2%3"}, 232 {a="(aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1u%2%3"},
205 {a="(ay)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"}, 233 {a="(ay)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
234 {a="(aw)(%s)([%(%[%|%<]?\"?[uai])", b="%1u%2%3"}, --p
235 {a="(ay)(%s)([%(%[%|%<]?\"?[uai])", b="%1i%2%3"}, --p
206 -- art. with waṣla + lām 236 -- art. with waṣla + lām
207 {a="'l%-(l)", b="'l-%1"}, 237 {a="'l%-(l)", b="'l-%1"},
208 -- art. with waṣla + solar consonant 238 -- art. with waṣla + solar consonant
@@ -235,7 +265,7 @@ trigraphstrdmg = { -- trigraphs or more
235idghamtrdmg = { 265idghamtrdmg = {
236 -- assimilations 266 -- assimilations
237 {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"}, 267 {a="(n)(}?)(%s)([rlmnwy])", b="%4%2%3%4"},
238 {a="(n)(o)([rlmnwy])(.-o)", b="%3"} 268 {a="(n)(o)([rlmnwy])([%S]-o)", b="%3"}
239} 269}
240 270
241digraphstrdmg = { 271digraphstrdmg = {
@@ -249,6 +279,15 @@ digraphstrdmg = {
249 {a="(%W)(\"?[uai])", b="%1%2"}, -- initial alif without hamza 279 {a="(%W)(\"?[uai])", b="%1%2"}, -- initial alif without hamza
250 -- this is not necessary, take out for now: 280 -- this is not necessary, take out for now:
251-- {a="([%_]?[uaiUAIY])(%s)([uai])", b="%1%2'"}, -- initial alif without hamza 281-- {a="([%_]?[uaiUAIY])(%s)([uai])", b="%1%2'"}, -- initial alif without hamza
282 {a="(aW)(o)(\"?[uai])([%S]-o)", b="awu"},
283 {a="(UA)(o)(\"?[uai])([%S]-o)", b="u"},
284 {a="(%_A)(o)(\"?[uai])([%S]-o)", b="ạ"},
285 {a="(Y)(o)(\"?[uai])([%S]-o)", b="ạ"},
286 {a="(%_a)(o)(\"?[uai])([%S]-o)", b="a"},
287 {a="(A)(o)(\"?[uai])([%S]-o)", b="a"},
288 {a="([%_]?[Uu])(o)(\"?[uai])([%S]-o)", b="u"},
289 {a="([%_]?[Ii])(o)(\"?[uai])([%S]-o)", b="i"},
290 {a="(o[%S]-)([UAIYWuaiyw])(o)(\"?[uai])", b="'"},
252 {a="(aW)(%s)([%(%[%|%<]?)(\"?[uai])", b="awu%2%3%4"}, --p 291 {a="(aW)(%s)([%(%[%|%<]?)(\"?[uai])", b="awu%2%3%4"}, --p
253 {a="(UA)(%s)([%(%[%|%<]?)(\"?[uai])", b="u%2%3'"}, --p 292 {a="(UA)(%s)([%(%[%|%<]?)(\"?[uai])", b="u%2%3'"}, --p
254 {a="([^%_][uai])(%s)([%(%[%|%<]?)(\"?[uai])", b="%1%2%3'"}, --p 293 {a="([^%_][uai])(%s)([%(%[%|%<]?)(\"?[uai])", b="%1%2%3'"}, --p
@@ -272,6 +311,13 @@ digraphstrdmg = {
272 -- ʾiʿrāb hyphen (end) 311 -- ʾiʿrāb hyphen (end)
273 -- shorten long vowels preceding ʾalif conjunctionis 312 -- shorten long vowels preceding ʾalif conjunctionis
274 {a="(U)(A)", b="U"}, 313 {a="(U)(A)", b="U"},
314 {a="(aW)(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="awu"},
315 {a="(%_a)(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="a"},
316 {a="(%_A)(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="ạ"},
317 {a="(A)(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="a"},
318 {a="(Y)(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="ạ"},
319 {a="([%_]?[Uu])(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="u"},
320 {a="([%_]?[Ii])(o)('[%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)([%S]-o)", b="i"},
275 --p (next 7 lines, just after %s) 321 --p (next 7 lines, just after %s)
276 {a="(aW)(%s)([%(%[%|%<]?['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="awu%2%3"}, 322 {a="(aW)(%s)([%(%[%|%<]?['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="awu%2%3"},
277 {a="(%_a)(%s)([%(%[%|%<]?['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="a%2%3"}, 323 {a="(%_a)(%s)([%(%[%|%<]?['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="a%2%3"},