aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx19
-rw-r--r--arabluatex.lua451
-rw-r--r--arabluatex_fullvoc.lua305
-rw-r--r--arabluatex_trans.lua55
-rw-r--r--arabluatex_voc.lua176
5 files changed, 810 insertions, 196 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index f44b309..2661ad4 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2061,7 +2061,7 @@ wa-ya.sIru ta.hta 'l-jildi
2061% \end{macrocode} 2061% \end{macrocode}
2062% \end{macro} 2062% \end{macro}
2063% \begin{macro}{\SetArbEasy} 2063% \begin{macro}{\SetArbEasy}
2064% \begin{macro}{\SetArbDeflt} 2064% \begin{macro}{\SetArbDflt}
2065% By default, \package{arabluatex} applies complex rules to generate 2065% By default, \package{arabluatex} applies complex rules to generate
2066% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT} 2066% euphonic \arb[trans]{ta^sdId}, \arb[trans]{'alif mamdUdaT}
2067% \linebreak and \arb[trans]{sukUn} depending on the modes which are 2067% \linebreak and \arb[trans]{sukUn} depending on the modes which are
@@ -2073,7 +2073,7 @@ wa-ya.sIru ta.hta 'l-jildi
2073% \begin{macrocode} 2073% \begin{macrocode}
2074\def\al@arb@rules{dflt} 2074\def\al@arb@rules{dflt}
2075\NewDocumentCommand{\SetArbEasy}{}{\def\al@arb@rules{easy}} 2075\NewDocumentCommand{\SetArbEasy}{}{\def\al@arb@rules{easy}}
2076\NewDocumentCommand{\SetArbDflt}{}{\def\al@arb@rules{default}} 2076\NewDocumentCommand{\SetArbDflt}{}{\def\al@arb@rules{dflt}}
2077% \end{macrocode} 2077% \end{macrocode}
2078% \end{macro} 2078% \end{macro}
2079% \end{macro} 2079% \end{macro}
@@ -2130,7 +2130,8 @@ wa-ya.sIru ta.hta 'l-jildi
2130 \else% 2130 \else%
2131 \ifx\@tempa\al@mode@fullvoc% 2131 \ifx\@tempa\al@mode@fullvoc%
2132 \bgroup\textdir TRT\arabicfont% 2132 \bgroup\textdir TRT\arabicfont%
2133 \luadirect{tex.sprint(processfullvoc(\luastringN{#2}))}\egroup% 2133 \luadirect{tex.sprint(processfullvoc(\luastringN{#2},
2134 \luastringO{\al@arb@rules}))}\egroup%
2134 \else% 2135 \else%
2135 \ifx\@tempa\al@mode@novoc% 2136 \ifx\@tempa\al@mode@novoc%
2136 \bgroup\textdir TRT\arabicfont% 2137 \bgroup\textdir TRT\arabicfont%
@@ -2139,7 +2140,8 @@ wa-ya.sIru ta.hta 'l-jildi
2139 \ifx\@tempa\al@mode@trans% 2140 \ifx\@tempa\al@mode@trans%
2140 \bgroup\textdir TLT\al@trans@style% 2141 \bgroup\textdir TLT\al@trans@style%
2141 \luadirect{tex.sprint(processtrans(\luastringN{#2}, 2142 \luadirect{tex.sprint(processtrans(\luastringN{#2},
2142 \luastringO{\al@trans@convention}))}\egroup% 2143 \luastringO{\al@trans@convention},
2144 \luastringO{\al@arb@rules}))}\egroup%
2143 \else% 2145 \else%
2144 \fi\fi\fi\fi} 2146 \fi\fi\fi\fi}
2145% \end{macrocode} 2147% \end{macrocode}
@@ -2152,11 +2154,13 @@ wa-ya.sIru ta.hta 'l-jildi
2152{\par\edef\@tempa{#1}% 2154{\par\edef\@tempa{#1}%
2153 \ifx\@tempa\al@mode@voc% 2155 \ifx\@tempa\al@mode@voc%
2154 \bgroup\pardir TRT\textdir TRT\arabicfont% 2156 \bgroup\pardir TRT\textdir TRT\arabicfont%
2155 \luadirect{tex.sprint(processvoc(\luastringO{\BODY}))}\egroup% 2157 \luadirect{tex.sprint(processvoc(\luastringO{\BODY},
2158 \luastringO{\al@arb@rules}))}\egroup%
2156 \else% 2159 \else%
2157 \ifx\@tempa\al@mode@fullvoc% 2160 \ifx\@tempa\al@mode@fullvoc%
2158 \bgroup\pardir TRT\textdir TRT\arabicfont% 2161 \bgroup\pardir TRT\textdir TRT\arabicfont%
2159 \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY}))}\egroup% 2162 \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY},
2163 \luastringO{\al@arb@rules}))}\egroup%
2160 \else% 2164 \else%
2161 \ifx\@tempa\al@mode@novoc% 2165 \ifx\@tempa\al@mode@novoc%
2162 \bgroup\pardir TRT\textdir TRT\arabicfont% 2166 \bgroup\pardir TRT\textdir TRT\arabicfont%
@@ -2164,7 +2168,8 @@ wa-ya.sIru ta.hta 'l-jildi
2164 \else \ifx\@tempa\al@mode@trans% 2168 \else \ifx\@tempa\al@mode@trans%
2165 \bgroup\pardir TLT\textdir TLT\al@trans@style% 2169 \bgroup\pardir TLT\textdir TLT\al@trans@style%
2166 \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, 2170 \luadirect{tex.sprint(processtrans(\luastringO{\BODY},
2167 \luastringO{\al@trans@convention}))}\egroup% 2171 \luastringO{\al@trans@convention},
2172 \luastringO{\al@arb@rules}))}\egroup%
2168 \else \fi\fi\fi\fi}[\par] 2173 \else \fi\fi\fi\fi}[\par]
2169% \end{macrocode} 2174% \end{macrocode}
2170% \end{environment} 2175% \end{environment}
diff --git a/arabluatex.lua b/arabluatex.lua
index d999548..0bb4756 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -134,217 +134,288 @@ end
134local function voc(str) 134local function voc(str)
135 str = string.gsub(str, "\\arb(%b{})", function(inside) 135 str = string.gsub(str, "\\arb(%b{})", function(inside)
136 inside = string.sub(inside, 2, -2) 136 inside = string.sub(inside, 2, -2)
137 for i = 1,#hamza do 137 for i = 1,#hamza do
138 inside = string.gsub(inside, hamza[i].a, hamza[i].b) 138 inside = string.gsub(inside, hamza[i].a, hamza[i].b)
139 end 139 end
140 for i = 1,#tanwin do 140 for i = 1,#tanwin do
141 inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) 141 inside = string.gsub(inside, tanwin[i].a, tanwin[i].b)
142 end 142 end
143 for i = 1,#trigraphs do 143 for i = 1,#trigraphs do
144 inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) 144 inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b)
145 end 145 end
146 for i = 1,#digraphs do 146 for i = 1,#digraphs do
147 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) 147 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b)
148 end 148 end
149 for i = 1,#single do 149 for i = 1,#single do
150 inside = string.gsub(inside, single[i].a, single[i].b) 150 inside = string.gsub(inside, single[i].a, single[i].b)
151 end 151 end
152 for i = 1,#longv do 152 for i = 1,#longv do
153 inside = string.gsub(inside, longv[i].a, longv[i].b) 153 inside = string.gsub(inside, longv[i].a, longv[i].b)
154 end 154 end
155 for i = 1,#shortv do 155 for i = 1,#shortv do
156 inside = string.gsub(inside, shortv[i].a, shortv[i].b) 156 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
157 end 157 end
158 for i = 1,#punctuation do 158 for i = 1,#punctuation do
159 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) 159 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
160 end 160 end
161 for i = 1,#null do 161 for i = 1,#null do
162 inside = string.gsub(inside, null[i].a, null[i].b) 162 inside = string.gsub(inside, null[i].a, null[i].b)
163 end 163 end
164 inside = indnum(inside) 164 inside = indnum(inside)
165 return string.format("\\txarb{%s}", inside) 165 return string.format("\\txarb{%s}", inside)
166 end) 166 end)
167return str 167return str
168end 168end
169 169
170local function voceasy(str) 170local function voceasy(str)
171 str = string.gsub(str, "\\arb(%b{})", function(inside) 171 str = string.gsub(str, "\\arb(%b{})", function(inside)
172 inside = string.sub(inside, 2, -2) 172 inside = string.sub(inside, 2, -2)
173 for i = 1,#hamza do 173 for i = 1,#hamzaeasy do
174 inside = string.gsub(inside, hamza[i].a, hamza[i].b) 174 inside = string.gsub(inside, hamzaeasy[i].a, hamzaeasy[i].b)
175 end 175 end
176 for i = 1,#tanwin do 176 for i = 1,#tanwineasy do
177 inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) 177 inside = string.gsub(inside, tanwineasy[i].a, tanwineasy[i].b)
178 end 178 end
179 for i = 1,#trigraphs do 179 for i = 1,#trigraphseasy do
180 inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) 180 inside = string.gsub(inside, trigraphseasy[i].a, trigraphseasy[i].b)
181 end 181 end
182 for i = 1,#digraphs do 182 for i = 1,#digraphs do
183 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) 183 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b)
184 end 184 end
185 for i = 1,#single do 185 for i = 1,#single do
186 inside = string.gsub(inside, single[i].a, single[i].b) 186 inside = string.gsub(inside, single[i].a, single[i].b)
187 end 187 end
188 for i = 1,#longv do 188 for i = 1,#longv do
189 inside = string.gsub(inside, longv[i].a, longv[i].b) 189 inside = string.gsub(inside, longv[i].a, longv[i].b)
190 end 190 end
191 for i = 1,#shortv do 191 for i = 1,#shortv do
192 inside = string.gsub(inside, shortv[i].a, shortv[i].b) 192 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
193 end 193 end
194 for i = 1,#punctuation do 194 for i = 1,#punctuation do
195 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) 195 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
196 end 196 end
197 for i = 1,#null do 197 for i = 1,#null do
198 inside = string.gsub(inside, null[i].a, null[i].b) 198 inside = string.gsub(inside, null[i].a, null[i].b)
199 end 199 end
200 inside = indnum(inside) 200 inside = indnum(inside)
201 return string.format("\\txarb{%s}", inside) 201 return string.format("\\txarb{%s}", inside)
202 end) 202 end)
203return str 203return str
204end 204end
205 205
206local function fullvoc(str) 206local function fullvoc(str)
207 str = string.gsub(str, "\\arb(%b{})", function(inside) 207 str = string.gsub(str, "\\arb(%b{})", function(inside)
208 inside = string.sub(inside, 2, -2) 208 inside = string.sub(inside, 2, -2)
209 for i = 1,#hamzafv do 209 for i = 1,#hamzafv do
210 inside = string.gsub(inside, hamzafv[i].a, hamzafv[i].b) 210 inside = string.gsub(inside, hamzafv[i].a, hamzafv[i].b)
211 end 211 end
212 for i = 1,#tanwinfv do 212 for i = 1,#tanwinfv do
213 inside = string.gsub(inside, tanwinfv[i].a, tanwinfv[i].b) 213 inside = string.gsub(inside, tanwinfv[i].a, tanwinfv[i].b)
214 end 214 end
215 for i = 1,#trigraphsfv do 215 for i = 1,#trigraphsfv do
216 inside = string.gsub(inside, trigraphsfv[i].a, trigraphsfv[i].b) 216 inside = string.gsub(inside, trigraphsfv[i].a, trigraphsfv[i].b)
217 end 217 end
218 for i = 1,#digraphsfv do 218 for i = 1,#digraphsfv do
219 inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b) 219 inside = string.gsub(inside, digraphsfv[i].a, digraphsfv[i].b)
220 end 220 end
221 for i = 1,#singlefv do 221 for i = 1,#singlefv do
222 inside = string.gsub(inside, singlefv[i].a, singlefv[i].b) 222 inside = string.gsub(inside, singlefv[i].a, singlefv[i].b)
223 end 223 end
224 for i = 1,#longv do 224 for i = 1,#longv do
225 inside = string.gsub(inside, longv[i].a, longv[i].b) 225 inside = string.gsub(inside, longv[i].a, longv[i].b)
226 end 226 end
227 for i = 1,#shortv do 227 for i = 1,#shortv do
228 inside = string.gsub(inside, shortv[i].a, shortv[i].b) 228 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
229 end 229 end
230 for i = 1,#punctuation do 230 for i = 1,#punctuation do
231 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) 231 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
232 end 232 end
233 for i = 1,#null do 233 for i = 1,#null do
234 inside = string.gsub(inside, null[i].a, null[i].b) 234 inside = string.gsub(inside, null[i].a, null[i].b)
235 end 235 end
236 inside = indnum(inside) 236 inside = indnum(inside)
237 return string.format("\\txarb{%s}", inside) 237 return string.format("\\txarb{%s}", inside)
238 end) 238 end)
239return str
240end
241
242local function fullvoceasy(str)
243 str = string.gsub(str, "\\arb(%b{})", function(inside)
244 inside = string.sub(inside, 2, -2)
245 for i = 1,#hamzafveasy do
246 inside = string.gsub(inside, hamzafveasy[i].a, hamzafveasy[i].b)
247 end
248 for i = 1,#tanwinfveasy do
249 inside = string.gsub(inside, tanwinfveasy[i].a, tanwinfveasy[i].b)
250 end
251 for i = 1,#trigraphsfveasy do
252 inside = string.gsub(inside, trigraphsfveasy[i].a, trigraphsfveasy[i].b)
253 end
254 for i = 1,#digraphsfveasy do
255 inside = string.gsub(inside, digraphsfveasy[i].a, digraphsfveasy[i].b)
256 end
257 for i = 1,#singlefveasy do
258 inside = string.gsub(inside, singlefveasy[i].a, singlefveasy[i].b)
259 end
260 for i = 1,#longv do
261 inside = string.gsub(inside, longv[i].a, longv[i].b)
262 end
263 for i = 1,#shortv do
264 inside = string.gsub(inside, shortv[i].a, shortv[i].b)
265 end
266 for i = 1,#punctuation do
267 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
268 end
269 for i = 1,#null do
270 inside = string.gsub(inside, null[i].a, null[i].b)
271 end
272 inside = indnum(inside)
273 return string.format("\\txarb{%s}", inside)
274 end)
239return str 275return str
240end 276end
241 277
242local function novoc(str) 278local function novoc(str)
243 str = string.gsub(str, "\\arb(%b{})", function(inside) 279 str = string.gsub(str, "\\arb(%b{})", function(inside)
244 inside = string.sub(inside, 2, -2) 280 inside = string.sub(inside, 2, -2)
245 for i = 1,#hamza do 281 for i = 1,#hamza do
246 inside = string.gsub(inside, hamza[i].a, hamza[i].b) 282 inside = string.gsub(inside, hamza[i].a, hamza[i].b)
247 end 283 end
248 for i = 1,#tanwinnv do 284 for i = 1,#tanwinnv do
249 inside = string.gsub(inside, tanwinnv[i].a, tanwinnv[i].b) 285 inside = string.gsub(inside, tanwinnv[i].a, tanwinnv[i].b)
250 end 286 end
251 for i = 1,#trigraphsnv do 287 for i = 1,#trigraphsnv do
252 inside = string.gsub(inside, trigraphsnv[i].a, trigraphsnv[i].b) 288 inside = string.gsub(inside, trigraphsnv[i].a, trigraphsnv[i].b)
253 end 289 end
254 for i = 1,#digraphs do 290 for i = 1,#digraphs do
255 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) 291 inside = string.gsub(inside, digraphs[i].a, digraphs[i].b)
256 end 292 end
257 for i = 1,#single do 293 for i = 1,#single do
258 inside = string.gsub(inside, single[i].a, single[i].b) 294 inside = string.gsub(inside, single[i].a, single[i].b)
259 end 295 end
260 for i = 1,#longvnv do 296 for i = 1,#longvnv do
261 inside = string.gsub(inside, longvnv[i].a, longvnv[i].b) 297 inside = string.gsub(inside, longvnv[i].a, longvnv[i].b)
262 end 298 end
263 for i = 1,#shortvnv do 299 for i = 1,#shortvnv do
264 inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b) 300 inside = string.gsub(inside, shortvnv[i].a, shortvnv[i].b)
265 end 301 end
266 for i = 1,#punctuation do 302 for i = 1,#punctuation do
267 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) 303 inside = string.gsub(inside, punctuation[i].a, punctuation[i].b)
268 end 304 end
269 for i = 1,#null do 305 for i = 1,#null do
270 inside = string.gsub(inside, null[i].a, null[i].b) 306 inside = string.gsub(inside, null[i].a, null[i].b)
271 end 307 end
272 inside = indnum(inside) 308 inside = indnum(inside)
273 return string.format("\\txarb{%s}", inside) 309 return string.format("\\txarb{%s}", inside)
274 end) 310 end)
275return str 311return str
276end 312end
277 313
278local function transdmg(str) 314local function transdmg(str)
279 str = string.gsub(str, "\\arb(%b{})", function(inside) 315 str = string.gsub(str, "\\arb(%b{})", function(inside)
280 inside = string.sub(inside, 2, -2) 316 inside = string.sub(inside, 2, -2)
281 for i = 1,#hamzatrdmg do 317 for i = 1,#hamzatrdmg do
282 inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b) 318 inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b)
283 end 319 end
284 for i = 1,#tanwintrdmg do 320 for i = 1,#tanwintrdmg do
285 inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b) 321 inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b)
286 end 322 end
287 for i = 1,#trigraphstrdmg do 323 for i = 1,#trigraphstrdmg do
288 inside = string.gsub(inside, trigraphstrdmg[i].a, trigraphstrdmg[i].b) 324 inside = string.gsub(inside, trigraphstrdmg[i].a, trigraphstrdmg[i].b)
289 end 325 end
290 for i = 1,#digraphstrdmg do 326 for i = 1,#digraphstrdmg do
291 inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b) 327 inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b)
292 end 328 end
293 for i = 1,#singletrdmg do 329 for i = 1,#singletrdmg do
294 inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b) 330 inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b)
295 end 331 end
296 for i = 1,#longvtrdmg do 332 for i = 1,#longvtrdmg do
297 inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b) 333 inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b)
298 end 334 end
299 for i = 1,#shortvtrdmg do 335 for i = 1,#shortvtrdmg do
300 inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b) 336 inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b)
301 end 337 end
302 for i = 1,#punctuationtr do 338 for i = 1,#punctuationtr do
303 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) 339 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b)
304 end 340 end
305 for i = 1,#nulltr do 341 for i = 1,#nulltr do
306 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) 342 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b)
307 end 343 end
308 return string.format("\\txtrans{%s}", inside) 344 return string.format("\\txtrans{%s}", inside)
309 end) 345 end)
346return str
347end
348
349local function transdmgeasy(str)
350 str = string.gsub(str, "\\arb(%b{})", function(inside)
351 inside = string.sub(inside, 2, -2)
352 for i = 1,#hamzatrdmg do
353 inside = string.gsub(inside, hamzatrdmg[i].a, hamzatrdmg[i].b)
354 end
355 for i = 1,#tanwintrdmg do
356 inside = string.gsub(inside, tanwintrdmg[i].a, tanwintrdmg[i].b)
357 end
358 for i = 1,#trigraphstrdmgeasy do
359 inside = string.gsub(inside, trigraphstrdmgeasy[i].a, trigraphstrdmgeasy[i].b)
360 end
361 for i = 1,#digraphstrdmg do
362 inside = string.gsub(inside, digraphstrdmg[i].a, digraphstrdmg[i].b)
363 end
364 for i = 1,#singletrdmg do
365 inside = string.gsub(inside, singletrdmg[i].a, singletrdmg[i].b)
366 end
367 for i = 1,#longvtrdmg do
368 inside = string.gsub(inside, longvtrdmg[i].a, longvtrdmg[i].b)
369 end
370 for i = 1,#shortvtrdmg do
371 inside = string.gsub(inside, shortvtrdmg[i].a, shortvtrdmg[i].b)
372 end
373 for i = 1,#punctuationtr do
374 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b)
375 end
376 for i = 1,#nulltr do
377 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b)
378 end
379 return string.format("\\txtrans{%s}", inside)
380 end)
310return str 381return str
311end 382end
312 383
313local function transloc(str) 384local function transloc(str)
314 str = string.gsub(str, "\\arb(%b{})", function(inside) 385 str = string.gsub(str, "\\arb(%b{})", function(inside)
315 inside = string.sub(inside, 2, -2) 386 inside = string.sub(inside, 2, -2)
316 for i = 1,#hamzatrloc do 387 for i = 1,#hamzatrloc do
317 inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b) 388 inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b)
318 end 389 end
319 for i = 1,#tanwintrloc do 390 for i = 1,#tanwintrloc do
320 inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b) 391 inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b)
321 end 392 end
322 for i = 1,#trigraphstrloc do 393 for i = 1,#trigraphstrloc do
323 inside = string.gsub(inside, trigraphstrloc[i].a, trigraphstrloc[i].b) 394 inside = string.gsub(inside, trigraphstrloc[i].a, trigraphstrloc[i].b)
324 end 395 end
325 for i = 1,#digraphstrloc do 396 for i = 1,#digraphstrloc do
326 inside = string.gsub(inside, digraphstrloc[i].a, digraphstrloc[i].b) 397 inside = string.gsub(inside, digraphstrloc[i].a, digraphstrloc[i].b)
327 end 398 end
328 for i = 1,#singletrloc do 399 for i = 1,#singletrloc do
329 inside = string.gsub(inside, singletrloc[i].a, singletrloc[i].b) 400 inside = string.gsub(inside, singletrloc[i].a, singletrloc[i].b)
330 end 401 end
331 for i = 1,#longvtrloc do 402 for i = 1,#longvtrloc do
332 inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b) 403 inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b)
333 end 404 end
334 for i = 1,#shortvtrloc do 405 for i = 1,#shortvtrloc do
335 inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b) 406 inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b)
336 end 407 end
337 for i = 1,#finaltrloc do 408 for i = 1,#finaltrloc do
338 inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b) 409 inside = string.gsub(inside, finaltrloc[i].a, finaltrloc[i].b)
339 end 410 end
340 for i = 1,#punctuationtr do 411 for i = 1,#punctuationtr do
341 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) 412 inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b)
342 end 413 end
343 for i = 1,#nulltr do 414 for i = 1,#nulltr do
344 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) 415 inside = string.gsub(inside, nulltr[i].a, nulltr[i].b)
345 end 416 end
346 return string.format("\\txtrans{%s}", inside) 417 return string.format("\\txtrans{%s}", inside)
347 end) 418 end)
348return str 419return str
349end 420end
350 421
@@ -356,20 +427,24 @@ function processvoc(str, rules)
356 str = holdcmd(str) 427 str = holdcmd(str)
357 if rules == "easy" then 428 if rules == "easy" then
358 str = voceasy(str) 429 str = voceasy(str)
359 elseif mode == "dflt" then 430 elseif rules == "dflt" then
360 str = voc(str) 431 str = voc(str)
361 else end 432 else end
362 str = unprotectarb(str) 433 str = unprotectarb(str)
363return str 434return str
364end 435end
365 436
366function processfullvoc(str) 437function processfullvoc(str, rules)
367 str = "\\arb{".. str.."}" 438 str = "\\arb{".. str.."}"
368 str = takeoutcap(str) 439 str = takeoutcap(str)
369 str = protectarb(str) 440 str = protectarb(str)
370 str = breakcmd(str) 441 str = breakcmd(str)
371 str = holdcmd(str) 442 str = holdcmd(str)
372 str = fullvoc(str) 443 if rules == "easy" then
444 str = fullvoceasy(str)
445 elseif rules == "dflt" then
446 str = fullvoc(str)
447 else end
373 str = unprotectarb(str) 448 str = unprotectarb(str)
374return str 449return str
375end 450end
@@ -385,14 +460,18 @@ function processnovoc(str)
385return str 460return str
386end 461end
387 462
388function processtrans(str, mode) 463function processtrans(str, mode, rules)
389 str = "\\arb{".. str.."}" 464 str = "\\arb{".. str.."}"
390 str = takeoutabjad(str) 465 str = takeoutabjad(str)
391 str = protectarb(str) 466 str = protectarb(str)
392 str = breakcmd(str) 467 str = breakcmd(str)
393 str = holdcmd(str) 468 str = holdcmd(str)
394 if mode == "dmg" then 469 if mode == "dmg" then
395 str = transdmg(str) 470 if rules == "easy" then
471 str = transdmgeasy(str)
472 elseif rules == "dflt" then
473 str = transdmg(str)
474 else end
396 elseif mode == "loc" then 475 elseif mode == "loc" then
397 str = transloc(str) 476 str = transloc(str)
398 else end 477 else end
diff --git a/arabluatex_fullvoc.lua b/arabluatex_fullvoc.lua
index 8263734..a2676e0 100644
--- a/arabluatex_fullvoc.lua
+++ b/arabluatex_fullvoc.lua
@@ -22,7 +22,6 @@ along with this program. If not, see
22<http://www.gnu.org/licenses/>. 22<http://www.gnu.org/licenses/>.
23--]] 23--]]
24 24
25-- this is new
26hamzafv = { 25hamzafv = {
27 -- hard coded hamza 26 -- hard coded hamza
28 {a="|\"'", b="ء"}, 27 {a="|\"'", b="ء"},
@@ -115,6 +114,98 @@ hamzafv = {
115 {a="(i)(')([^uaiUAI])", b="%1ئْ%3"} 114 {a="(i)(')([^uaiUAI])", b="%1ئْ%3"}
116} 115}
117 116
117hamzafveasy = { -- differences marked below with 'easy'
118 -- hard coded hamza
119 {a="|\"'", b="ء"},
120 {a="A\"'", b="آ"},
121 {a="[au]\"'", b="أ"},
122 {a="w\"'", b="ؤ"},
123 {a="i\"'", b="إ"},
124 {a="y\"'", b="ئ"},
125 {a="ؤ([^uaiUAI])", b="ؤْ%1"},
126 {a="ؤ$", b="ؤْ"},
127 {a="ؤ(%s)", b="ؤْ%1"},
128 {a="أ([^uaiUAI])", b="أْ%1"},
129 {a="أ$", b="أْ"},
130 {a="أ(%s)", b="أْ%1"},
131 {a="ئ([^uaiUAI])", b="ئْ%1"},
132 {a="ئ$", b="ئْ"},
133 {a="ئ(%s)", b="ئْ%1"},
134 -- hamza takes tašdīd too
135 {a="''([Uu])", b="ؤؤ%1"},
136 {a="''([Aa])", b="أأ%1"},
137 {a="''([Ii])", b="ئئ%1"},
138 -- initial long u and i (for a, see below)
139 {a="%'%_U", b="أU"},
140 {a="%'%_I", b="إI"},
141 -- taḫfīfu 'l-hamza
142 {a="'u'([^uaiUAI])", b="أU%1"},
143 {a="'i'([^uaiUAI])", b="إI%1"},
144 -- madda (historic writing below)
145 {a="'a'([^uaiUAI])", b="آ%1"},
146 {a="'a?A([%_%^%.]?[%`%'btjghdrzsfqklmnywAY])", b="آ%1"},
147--easy {a="(A)(')(uN?)$", b="aآء%3"},
148--easy {a="(A)(')(uN?)(%W)", b="aآء%3%4"},
149--easy {a="(A)(')(iN?)$", b="aآء%3"},
150--easy {a="(A)(')(iN?)(%W)", b="aآء%3%4"},
151--easy {a="(A)(')(i)", b="aآئ%3"}, -- historic madda
152--easy {a="(A)(')(u)", b="aآؤ%3"}, -- historic madda
153--easy {a="(A)(')", b="aآء"}, -- historic madda
154 -- initial (needs both ^ and %W patterns)
155 {a="^(')([ua])", b="أ%2"},
156 {a="^(')(i)", b="إ%2"},
157 {a="(%W)(')([ua])", b="%1أ%3"},
158 {a="(%W)(')(i)", b="%1إ%3"},
159 -- final
160 -- ^say'aN and .zim'aN are special orthographies
161 {a="(%^say)(%')(aN)", b="%1ئ%3"},
162 {a="(.zi?m)(%')(aN)", b="%1ئ%3"},
163 {a="([^uai])(')([uai]N?)$", b="%1ء%3"},
164 {a="([^uai])(')([uai]N?)(%W)", b="%1ء%3%4"},
165-- u
166 {a="(u)(')([uai]?N)$", b="%1ؤ%3"},
167 {a="(u)(')([uai]N?)(%W)", b="%1ؤ%3%4"},
168 {a="(u)(')$", b="%1ؤْ"},
169 {a="(u)(')(%W)", b="%1ؤْ%3"},
170-- a
171 {a="(a)(')(A)$", b="%1آ"},
172 {a="(a)(')(A)(%W)", b="%1آ%4"},
173 {a="(a)(')([u]N?)$", b="%1أ%3"},
174 {a="(a)(')([u]N?)(%W)", b="%1أ%3%4"},
175 {a="(a)(')(a)$", b="%1أ%3"},
176 {a="(a)(')(a)(%W)", b="%1أ%3%4"},
177 {a="(a)(')(aN)$", b="%1أً"},
178 {a="(a)(')(aN)(%W)", b="%1أً%4"},
179 {a="(a)(')([i]N?)$", b="%1إ%3"},
180 {a="(a)(')([i]N?)(%W)", b="%1إ%3%4"},
181 {a="(a)(')$", b="%1أْ"},
182 {a="(a)(')(%W)", b="%1أْ%3"},
183-- i
184 {a="(i)(')([uai]N?)$", b="%1ئ%3"},
185 {a="(i)(')([uai]N?)(%W)", b="%1ئ%3%4"},
186 {a="(i)(')$", b="%1ئْ"},
187 {a="(i)(')(%W)", b="%1ئْ%3"},
188--
189 -- middle
190 {a="(U)(')", b="%1ء"},
191 {a="([Iy])(')", b="%1ئ"},
192 {a="([^uai])(')([uU])", b="%1ؤ%3"},
193 {a="([^uai])(')([aA])", b="%1أ%3"},
194 {a="([^uai])(')([iI])", b="%1ئ%3"},
195 {a="(u)(')([uU])", b="%1ؤ%3"},
196 {a="(u)(')([aA])", b="%1ؤ%3"},
197 {a="(u)(')([iI])", b="%1ئ%3"},
198 {a="(a)(')([aA])", b="%1أ%3"},
199 {a="(a)(')([uU])", b="%1ؤ%3"},
200 {a="(a)(')([iI])", b="%1ئ%3"},
201 {a="(i)(')([aA])", b="%1ئ%3"},
202 {a="(i)(')([uU])", b="%1ئ%3"},
203 {a="(i)(')([iI])", b="%1ئ%3"},
204 {a="(a)(')([^uaiUAI])", b="%1أْ%3"},
205 {a="(u)(')([^uaiUAI])", b="%1ؤْ%3"},
206 {a="(i)(')([^uaiUAI])", b="%1ئْ%3"}
207}
208
118tanwinfv = { 209tanwinfv = {
119 {a="uNU", b="ٌو"}, 210 {a="uNU", b="ٌو"},
120 {a="aNU", b="ًوا"}, 211 {a="aNU", b="ًوا"},
@@ -150,7 +241,41 @@ tanwinfv = {
150 {a="(iN)", b="ٍ"} 241 {a="(iN)", b="ٍ"}
151} 242}
152 243
153-- this is new 244tanwinfveasy = { -- no assimilations (see below)
245 {a="uNU", b="ٌو"},
246 {a="aNU", b="ًوا"},
247 {a="iNU", b="ٍو"},
248 {a="([uai]N)(%s)([uai])", b="%1%2ٱ"},
249 {a="(aN[%_]?[AY])(%s)([uai])", b="%1%2ٱ"},
250 -- assimilations (begin)
251--easy {a="(uN)(%s)([rlmnwy])", b="ٌ%2%3%3"},
252--easy {a="(aN)(_A)(%s)([rlmnwy])", b="ًى%3%4%4"},
253--easy {a="(aN)(Y)(%s)([rlmnwy])", b="ًى%3%4%4"},
254--easy {a="(T)(aN)(%s)([rlmnwy])", b="%1ً%3%4%4"},
255--easy {a="(ء)(aN)(%s)([rlmnwy])", b="%1ً%3%4%4"},
256--easy {a="([^TA])(aN)(%s)([rlmnwy])", b="%1ًا%3%4%4"},
257--easy {a="(iN)(%s)([rlmnwy])", b="ٍ%2%3%3"},
258 -- assimilations (end)
259 -- quoted tanwīn (begin)
260 {a="(\"uN)", b=""},
261 {a="(B)(\"aN)", b="%1"},
262 {a="(\"aN)(_A)", b="ى"},
263 {a="(\"aN)(Y)", b="ى"},
264 {a="(T)(\"aN)", b="%1"},
265 {a="(ء)(\"aN)", b="%1"},
266 {a="([^TA])(\"aN)", b="%1ا"},
267 {a="(\"iN)", b=""},
268 -- quoted tanwīn (end)
269 {a="(uN)", b="ٌ"},
270 {a="(B)(aN)", b="%1ً"},
271 {a="(aN)(_A)", b="ًى"},
272 {a="(aN)(Y)", b="ًى"},
273 {a="(T)(aN)", b="%1ً"},
274 {a="(ء)(aN)", b="%1ً"},
275 {a="([^TA])(aN)", b="%1ًا"},
276 {a="(iN)", b="ٍ"}
277}
278
154trigraphsfv = { -- trigraphs or more 279trigraphsfv = { -- trigraphs or more
155 -- 'llatI / 'llad_I 280 -- 'llatI / 'llad_I
156 {a="^'ll(a)([%_]?[dt])", b="ٱلّ%1%2"}, 281 {a="^'ll(a)([%_]?[dt])", b="ٱلّ%1%2"},
@@ -207,7 +332,62 @@ trigraphsfv = { -- trigraphs or more
207 {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"} 332 {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"}
208} 333}
209 334
210-- this is new 335trigraphsfveasy = { -- trigraphs or more (see 'easy' tag below for the diffs)
336 -- 'llatI / 'llad_I
337 {a="^'ll(a)([%_]?[dt])", b="ٱلّ%1%2"},
338 {a="([%s%-])'ll(a)([%_]?[dt])", b="%1ٱلّ%2%3"},
339 -- al- + lām
340 {a="^(a)l%-(l)", b="ا%1ل%2%2"},
341 {a="([%s%-])(a)l%-(l)", b="%1ا%2ل%3%3"},
342 -- al- + solar consonant
343 {a="^(a)l%-([%_%^%.]?[tdrzsn])", b="ا%1ل%2%2"},
344 {a="([%s%-])(a)l%-([%_%^%.]?[tdrzsn])", b="%1ا%2ل%3%3"},
345 -- assim. art. + solar consonant
346 {a="^(a)([%_%^%.]?[tdrzsn])%-", b="ا%1ل%2"},
347 {a="([%s%-])(a)([%_%^%.]?[tdrzsn])%-", b="%1ا%2ل%3"},
348 -- al- + initial unstable hamza
349 {a="^(a)l%-(\"?[uai])", b="ا%1لٱ%2"},
350 {a="([%s%-])(a)l%-(\"?[uai])", b="%1ا%2لٱ%3"},
351 -- li-/la + art. + initial unstable hamza is a special orthography
352 {a="l([ai])%-l%-(\"?[uai])", b="ل%1لٱ%2"},
353 -- al- + lunar consonant (i.e. what remains)
354 {a="^(a)l%-", b="ا%1لْ"},
355 {a="([%s%-])(a)l%-", b="%1ا%2لْ"},
356 -- diphthongs to be resolved before ʾalif conjunctionis
357 {a="(aW)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="awuا%2%3"},
358 {a="(aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1u%2%3"},
359 {a="(ay)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
360 -- art. with waṣla + lām
361 {a="'l%-(l)", b="ٱل%1%1"},
362 -- art. with waṣla + solar consonant
363 {a="'l%-([%_%^%.]?[tdrzsn])", b="ٱل%1%1"},
364 -- li-/la- + art. + lām
365 {a="l([ai])%-l%-(l)", b="ل%1%2%2"},
366 -- assim. art. with waṣla + solar consonant
367 {a="'([%_%^%.]?[tdrzsn])%-", b="ٱل%1"},
368 -- li-/la- + art. + solar consonant is a special orthography
369 {a="l([ai])%-l%-([%_%^%.]?[tdrzsn])", b="ل%1ل%2%2"},
370 -- li-/la- + assim. art. + solar consonant is a special orthography
371 {a="l([ai])%-([%_%^%.]?[tdrzsn])%-([%_%^%.]?[tdrzsn])", b="ل%1ل%3%3"},
372 -- art. with waṣla + initial unstable hamza
373 {a="'l%-(\"?[uai])", b="ٱلٱ%1"},
374 -- art. with waṣla + lunar consonant (i.e. what remains)
375 {a="'l%-", b="ٱلْ"},
376 -- the silent wāw
377 {a="uU$", b="uو"},
378 {a="uU(%W)", b="uو%1"},
379 {a="aU$", b="aو"},
380 {a="aU(%W)", b="aو%1"},
381 {a="iU$", b="iو"},
382 {a="iU(%W)", b="iو%1"},
383 -- words ending in -āT with silent wāw/yāʾ
384 {a="(_a)UA", b="%1وا"},
385 {a="(_a)U", b="%1و"},
386 {a="(_a)I", b="%1ي"},
387 -- assimilations
388--easy {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"}
389}
390
211digraphsfv = { 391digraphsfv = {
212 -- initial straight double quote gives a connective ʾalif 392 -- initial straight double quote gives a connective ʾalif
213 {a="^\"[uai]", b="ٱ"}, 393 {a="^\"[uai]", b="ٱ"},
@@ -293,6 +473,94 @@ digraphsfv = {
293 {a="%^d", b="ڊ"} 473 {a="%^d", b="ڊ"}
294} 474}
295 475
476digraphsfveasy = { -- see the diffenrences under 'easy' marker below
477 -- initial straight double quote gives a connective ʾalif
478 {a="^\"[uai]", b="ٱ"},
479 {a="([%s%-])\"[uai]", b="%1ٱ"},
480 -- diphthongs to be resolved before ʾalif conjunctionis
481 {a="(aW)(%s)(\"?[uai])", b="awuا%2ٱ"},
482 {a="(aw)(%s)(\"?[uai])", b="%1u%2ٱ"},
483 {a="(ay)(%s)(\"?[uai])", b="%1i%2ٱ"},
484 {a="([uai]%-)(\"?[uai])", b="%1ٱ"}, -- hyphen + initial alif without hamza
485 -- initial alif without hamza
486 {a="([%_]?[uaiUAIY])(%s)(\"?[uai])", b="%1%2ٱ"},
487 {a="^([uai])", b="ا%1"}, -- initial alif without hamza
488 {a="(%s)([uai])", b="%1ا%2"}, -- initial alif without hamza
489 {a="%-%-", b="ـ"},
490 {a="ؤؤ", b="ؤّ"},
491 {a="أأ", b="أّ"},
492 {a="ئئ", b="ئّ"},
493 {a="bb", b="بّ"},
494 {a="BB", b="ـّ"},
495 {a="(%_)([thd])([thd])", b="%1%2|%3"},
496 {a="tt", b="تّ"},
497 {a="%_t%_t", b="ثّ"},
498 {a="jj", b="جّ"},
499 {a="%^g%^g", b="جّ"},
500 {a="xx", b="خّ"},
501 {a="%_h%_h", b="خّ"},
502 {a="dd", b="دّ"},
503 {a="%_d%_d", b="ذّ"},
504 {a="rr", b="رّ"},
505 {a="zz", b="زّ"},
506 {a="ss", b="سّ"},
507 {a="%^s%^s", b="شّ"},
508 {a="%.s%.s", b="صّ"},
509 {a="%.d%.d", b="ضّ"},
510 {a="%.t%.t", b="طّ"},
511 {a="%.z%.z", b="ظّ"},
512 {a="%`%`", b="عّ"},
513 {a="%.g%.g", b="غّ"},
514 {a="ff", b="فّ"},
515 {a="qq", b="قّ"},
516 {a="kk", b="كّ"},
517 {a="ll", b="لّ"},
518 {a="mm", b="مّ"},
519 {a="nn", b="نّ"},
520 {a="hh", b="هّ"},
521 {a="ww", b="وّ"},
522 {a="yy", b="يّ"},
523 -- sukūn begin ('easy' needs these rules to be taken out); but
524 -- first take out every previously generated sukūn by hamza rules,
525 -- so there be no need to edit them:
526 {a="ْ", b=""},
527-- {a="([%_%^%.]?[Bbtjghxdrzs%`fqklmnwy])$", b="%1ْ"},
528-- {a="([%_%^%.]?[Bbtjghxdrzs%`fqklmnwy])([%s])", b="%1ْ%2"},
529-- {a="([%_%^%.]?[Bbtjghxdrzs%`fqklmnwy])([%_]?[^%_uaiUAIًٌٍ])", b="%1ْ%2"},
530 -- take out sukūn in cases of assimilation
531-- {a="(n)(ْ)(%s)([روي])", b="%1%3%4"},
532-- {a="(n)(ْ)(%s)([ل])", b="%1%3%4"},
533-- {a="(n)(ْ)(%s)([م])", b="%1%3%4"},
534-- {a="(n)(ْ)(%s)([ن])", b="%1%3%4"},
535-- {a="ْ\"", b="\""},
536 -- sukūn end
537 {a="_t", b="ث"},
538 {a="%^g", b="ج"},
539 {a="%.h", b="ح"},
540 {a="_h", b="خ"},
541 {a="_d", b="ذ"},
542 {a="%^s", b="ش"},
543 {a="%.s", b="ص"},
544 {a="%.d", b="ض"},
545 {a="%.t", b="ط"},
546 {a="%.z", b="ظ"},
547 {a="%.g", b="غ"},
548 {a="(U)(A)", b="%1ا"},
549 {a="WA", b="وْا"},
550 {a="(a)W\"", b="%1وا"},
551 {a="(a)W", b="%1وْا"},
552 {a="_A", b="aى"},
553 {a="_u", b="ٗ"},
554 {a="_a", b="ٰ"},
555 {a="_i", b="ٖ"},
556 {a="%.b", b="ٮ"},
557 {a="%.f", b="ڡ"},
558 {a="%.q", b="ٯ"},
559 {a="%.k", b="ک"},
560 {a="%.n", b="ں"},
561 {a="%^d", b="ڊ"}
562}
563
296singlefv = { 564singlefv = {
297 {a="b", b="ب"}, 565 {a="b", b="ب"},
298 {a="t", b="ت"}, 566 {a="t", b="ت"},
@@ -320,3 +588,34 @@ singlefv = {
320 {a="([^0-9])%-([^0-9])", b="%1%2"}, 588 {a="([^0-9])%-([^0-9])", b="%1%2"},
321 {a="B", b="ـ"}, 589 {a="B", b="ـ"},
322} 590}
591
592singlefveasy = { -- see the differences under 'easy' tag below
593 {a="b", b="ب"},
594 {a="t", b="ت"},
595 {a="j", b="ج"},
596 {a="x", b="خ"},
597 {a="d", b="د"},
598 {a="r", b="ر"},
599 {a="z", b="ز"},
600 {a="s", b="س"},
601 {a="f", b="ف"},
602 {a="`", b="ع"},
603 {a="f", b="ف"},
604 {a="q", b="ق"},
605 {a="k", b="ك"},
606 {a="l", b="ل"},
607 {a="m", b="م"},
608 {a="n", b="ن"},
609 {a="h", b="ه"},
610 {a="w", b="و"},
611 {a="y", b="ي"},
612 {a="T", b="ة"},
613 -- easy (begin): \" needs to put back the sukūn
614 {a="\"$", b="ْ"},
615 {a="\"(%W)", b="ْ%1"},
616 {a="\"([^uaiUAI])", b="ْ%1"},
617 -- easy (end)
618 {a="([^0-9])%-([^0-9])", b="%1%2"},
619 {a="B", b="ـ"},
620}
621
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
index 6b3f1bc..c96a9da 100644
--- a/arabluatex_trans.lua
+++ b/arabluatex_trans.lua
@@ -201,6 +201,61 @@ trigraphstrdmg = { -- trigraphs or more
201 {a="(n)(%s)([rlmnwy])", b="%3%2%3"} 201 {a="(n)(%s)([rlmnwy])", b="%3%2%3"}
202} 202}
203 203
204trigraphstrdmgeasy = { -- see the differences below under 'easy' tag
205 -- 'llatI / 'llad_I
206 {a="^'ll(a)([%_]?[dt])", b="'ll%1%2"},
207 {a="(%s)'ll(a)([%_]?[dt])", b="%1'll%2%3"},
208 -- al- + lām
209 {a="^(a)l%-(l)", b="%1l-%2"},
210 {a="([%s%-])(a)l%-(l)", b="%1%2l-%3"},
211 -- al- + solar consonant
212 {a="^(a)l%-([%_%^%.]?[tdrzsn])", b="%1%2-%2"},
213 {a="([%s%-])(a)l%-([%_%^%.]?[tdrzsn])", b="%1%2%3-%3"},
214 -- assim. art. + solar consonant
215 {a="^(a)([%_%^%.]?[tdrzsn])%-", b="%1%2-"},
216 {a="([%s%-])(a)([%_%^%.]?[tdrzsn])%-", b="%1%2%3-"},
217 -- al- + initial unstable hamza
218 {a="^(a)l%-([uai])", b="%1l-%2"},
219 {a="([%s%-])(a)l%-([uai])", b="%1%2l-%3"},
220 -- li-/la- + art. + initial unstable hamza is a special orthography
221 {a="l([ai])%-l%-([uai])", b="l%1-l-%2"},
222 -- al- + lunar consonant (i.e. what remains)
223 {a="^(a)l%-", b="%1l-"},
224 {a="([%s%-])(a)l%-", b="%1%2l-"},
225 -- diphthongs to be resolved before ʾalif conjunctionis
226 {a="(aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1u%2%3"},
227 {a="(ay)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
228 -- art. with waṣla + lām
229 {a="'l%-(l)", b="'l-%1"},
230 -- art. with waṣla + solar consonant
231 {a="'l%-([%_%^%.]?[tdrzsn])", b="'%1-%1"},
232 -- li-/la- + art. + lām
233 {a="l([ai])%-l%-(l)", b="l%1-%2%2"},
234 -- assim. art. with waṣla + solar consonant
235 {a="'([%_%^%.]?[tdrzsn])%-", b="'%1-"},
236 -- li-/la- + art. + solar consonant is a special orthography
237 {a="l([ai])%-l%-([%_%^%.]?[tdrzsn])", b="l%1-%2-%2"},
238 -- li-/la- + assim. art. + solar consonant is a special orthography
239 {a="l([ai])%-([%_%^%.]?[tdrzsn])%-([%_%^%.]?[tdrzsn])", b="l%1-%2-%3"},
240 -- art. with waṣla + initial unstable hamza
241 {a="'l%-([uai])", b="'l-%1"},
242 -- art. with waṣla + lunar consonant (i.e. what remains)
243 {a="'l%-", b="'l-"},
244 -- the silent wāw
245 {a="uU$", b="u"},
246 {a="uU(%W)", b="u%1"},
247 {a="aU$", b="a"},
248 {a="aU(%W)", b="a%1"},
249 {a="iU$", b="i"},
250 {a="iU(%W)", b="i%1"},
251 -- words ending in -āT with silent wāw/yāʾ
252 {a="(_a)UA", b="A"},
253 {a="(_a)U", b="A"},
254 {a="(_a)I", b="A"}
255 -- assimilations
256--easy {a="(n)(%s)([rlmnwy])", b="%3%2%3"}
257}
258
204digraphstrdmg = { 259digraphstrdmg = {
205 {a="([uai]%-)(\"?[uai])", b="%1'"}, -- hyphen + initial alif without hamza 260 {a="([uai]%-)(\"?[uai])", b="%1'"}, -- hyphen + initial alif without hamza
206 {a="^(\"?[uai])", b="%1"}, -- initial alif without hamza 261 {a="^(\"?[uai])", b="%1"}, -- initial alif without hamza
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua
index 5eafca5..4f5399f 100644
--- a/arabluatex_voc.lua
+++ b/arabluatex_voc.lua
@@ -154,6 +154,89 @@ hamza = {
154 {a="(i)(')([^uaiUAI])", b="%1ئ%3"} 154 {a="(i)(')([^uaiUAI])", b="%1ئ%3"}
155} 155}
156 156
157hamzaeasy = { -- differences marked below with 'easy'
158 -- hard coded hamza
159 {a="|\"'", b="ء"},
160 {a="A\"'", b="آ"},
161 {a="[au]\"'", b="أ"},
162 {a="w\"'", b="ؤ"},
163 {a="i\"'", b="إ"},
164 {a="y\"'", b="ئ"},
165 -- hamza takes tašdīd too
166 {a="''([Uu])", b="ؤؤ%1"},
167 {a="''([Aa])", b="أأ%1"},
168 {a="''([Ii])", b="ئئ%1"},
169 -- initial long u and i (for a, see below)
170 {a="%'%_U", b="أU"},
171 {a="%'%_I", b="إI"},
172 -- taḫfīfu 'l-hamza
173 {a="'u'([^uaiUAI])", b="أU%1"},
174 {a="'i'([^uaiUAI])", b="إI%1"},
175 -- madda (historic writing below)
176 {a="'a'([^uaiUAI])", b="آ%1"},
177 {a="'a?A([%_%^%.]?[%`%'btjghdrzsfqklmnywAY])", b="آ%1"},
178--easy {a="(A)(')(uN?)$", b="aآء%3"},
179--easy {a="(A)(')(uN?)(%W)", b="aآء%3%4"},
180--easy {a="(A)(')(iN?)$", b="aآء%3"},
181--easy {a="(A)(')(iN?)(%W)", b="aآء%3%4"},
182--easy {a="(A)(')(i)", b="aآئ%3"}, -- historic madda
183--easy {a="(A)(')(u)", b="aآؤ%3"}, -- historic madda
184--easy {a="(A)(')", b="aآء"}, -- historic madda
185 -- initial (needs both ^ and %W patterns)
186 {a="^(')([ua])", b="أ%2"},
187 {a="^(')(i)", b="إ%2"},
188 {a="(%W)(')([ua])", b="%1أ%3"},
189 {a="(%W)(')(i)", b="%1إ%3"},
190 -- final
191 -- ^say'aN and .zim'aN are special orthographies
192 {a="(%^say)(%')(aN)", b="%1ئ%3"},
193 {a="(.zi?m)(%')(aN)", b="%1ئ%3"},
194 {a="([^uai])(')([uai]N?)$", b="%1ء%3"},
195 {a="([^uai])(')([uai]N?)(%W)", b="%1ء%3%4"},
196-- u
197 {a="(u)(')([uai]?N)$", b="%1ؤ%3"},
198 {a="(u)(')([uai]N?)(%W)", b="%1ؤ%3%4"},
199 {a="(u)(')$", b="%1ؤ"},
200 {a="(u)(')(%W)", b="%1ؤ%3"},
201-- a
202 {a="(a)(')(A)$", b="%1آ"},
203 {a="(a)(')(A)(%W)", b="%1آ%4"},
204 {a="(a)(')([u]N?)$", b="%1أ%3"},
205 {a="(a)(')([u]N?)(%W)", b="%1أ%3%4"},
206 {a="(a)(')(a)$", b="%1أ%3"},
207 {a="(a)(')(a)(%W)", b="%1أ%3%4"},
208 {a="(a)(')(aN)$", b="%1أً"},
209 {a="(a)(')(aN)(%W)", b="%1أً%4"},
210 {a="(a)(')([i]N?)$", b="%1إ%3"},
211 {a="(a)(')([i]N?)(%W)", b="%1إ%3%4"},
212 {a="(a)(')$", b="%1أ"},
213 {a="(a)(')(%W)", b="%1أ%3"},
214-- i
215 {a="(i)(')([uai]N?)$", b="%1ئ%3"},
216 {a="(i)(')([uai]N?)(%W)", b="%1ئ%3%4"},
217 {a="(i)(')$", b="%1ئ"},
218 {a="(i)(')(%W)", b="%1ئ%3"},
219--
220 -- middle
221 {a="(U)(')", b="%1ء"},
222 {a="([Iy])(')", b="%1ئ"},
223 {a="([^uai])(')([uU])", b="%1ؤ%3"},
224 {a="([^uai])(')([aA])", b="%1أ%3"},
225 {a="([^uai])(')([iI])", b="%1ئ%3"},
226 {a="(u)(')([uU])", b="%1ؤ%3"},
227 {a="(u)(')([aA])", b="%1ؤ%3"},
228 {a="(u)(')([iI])", b="%1ئ%3"},
229 {a="(a)(')([aA])", b="%1أ%3"},
230 {a="(a)(')([uU])", b="%1ؤ%3"},
231 {a="(a)(')([iI])", b="%1ئ%3"},
232 {a="(i)(')([aA])", b="%1ئ%3"},
233 {a="(i)(')([uU])", b="%1ئ%3"},
234 {a="(i)(')([iI])", b="%1ئ%3"},
235 {a="(a)(')([^uaiUAI])", b="%1أ%3"},
236 {a="(u)(')([^uaiUAI])", b="%1ؤ%3"},
237 {a="(i)(')([^uaiUAI])", b="%1ئ%3"}
238}
239
157tanwin = { 240tanwin = {
158 {a="uNU", b="ٌو"}, 241 {a="uNU", b="ٌو"},
159 {a="aNU", b="ًوا"}, 242 {a="aNU", b="ًوا"},
@@ -187,6 +270,39 @@ tanwin = {
187 {a="(iN)", b="ٍ"} 270 {a="(iN)", b="ٍ"}
188} 271}
189 272
273tanwineasy = { -- 'easy' requires some lines to be taken out:
274 {a="uNU", b="ٌو"},
275 {a="aNU", b="ًوا"},
276 {a="iNU", b="ٍو"},
277 -- assimilations (begin)
278-- {a="(uN)(%s)([rlmnwy])", b="ٌ%2%3%3"},
279-- {a="(aN)(_A)(%s)([rlmnwy])", b="ًى%3%4%4"},
280-- {a="(aN)(Y)(%s)([rlmnwy])", b="ًى%3%4%4"},
281-- {a="(T)(aN)(%s)([rlmnwy])", b="%1ً%3%4%4"},
282-- {a="(ء)(aN)(%s)([rlmnwy])", b="%1ً%3%4%4"},
283-- {a="([^TA])(aN)(%s)([rlmnwy])", b="%1ًا%3%4%4"},
284-- {a="(iN)(%s)([rlmnwy])", b="ٍ%2%3%3"},
285 -- assimilations (end)
286 -- quoted tanwīn (begin)
287 {a="(\"uN)", b=""},
288 {a="(B)(\"aN)", b="%1"},
289 {a="(\"aN)(_A)", b="ى"},
290 {a="(\"aN)(Y)", b="ى"},
291 {a="(T)(\"aN)", b="%1"},
292 {a="(ء)(\"aN)", b="%1"},
293 {a="([^TA])(\"aN)", b="%1ا"},
294 {a="(\"iN)", b=""},
295 -- quoted tanwīn (end)
296 {a="(uN)", b="ٌ"},
297 {a="(B)(aN)", b="%1ً"},
298 {a="(aN)(_A)", b="ًى"},
299 {a="(aN)(Y)", b="ًى"},
300 {a="(T)(aN)", b="%1ً"},
301 {a="(ء)(aN)", b="%1ً"},
302 {a="([^TA])(aN)", b="%1ًا"},
303 {a="(iN)", b="ٍ"}
304}
305
190trigraphs = { -- trigraphs or more 306trigraphs = { -- trigraphs or more
191 -- 'llatI / 'llad_I 307 -- 'llatI / 'llad_I
192 {a="^'ll(a)([%_]?[dt])", b="الّ%1%2"}, 308 {a="^'ll(a)([%_]?[dt])", b="الّ%1%2"},
@@ -247,6 +363,66 @@ trigraphs = { -- trigraphs or more
247 {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"} 363 {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"}
248} 364}
249 365
366trigraphseasy = { -- differences marked below with 'easy'
367 -- 'llatI / 'llad_I
368 {a="^'ll(a)([%_]?[dt])", b="الّ%1%2"},
369 {a="([%s%-])'ll(a)([%_]?[dt])", b="%1الّ%2%3"},
370 -- al- + lām (easy)
371 {a="^(a)l%-(l)", b="ا%1ل%2"},
372 {a="([%s%-])(a)l%-(l)", b="%1ا%2ل%3"},
373 -- al- + solar consonant (easy)
374 {a="^(a)l%-([%_%^%.]?[tdrzsn])", b="ا%1ل%2"},
375 {a="([%s%-])(a)l%-([%_%^%.]?[tdrzsn])", b="%1ا%2ل%3"},
376 -- assim. art. + solar consonant (easy)
377 {a="^(a)([%_%^%.]?[tdrzsn])%-", b="ا%1ل"},
378 {a="([%s%-])(a)([%_%^%.]?[tdrzsn])%-", b="%1ا%2ل"},
379 -- al- + initial unstable hamza
380 {a="^(a)l%-(\")([uai])", b="ا%1لٱ%3"},
381 {a="([%s%-])(a)l%-(\")([uai])", b="%1ا%2لٱ%4"},
382 {a="^(a)l%-([uai])", b="ا%1لا%2"},
383 {a="([%s%-])(a)l%-([uai])", b="%1ا%2لا%3"},
384 -- li-/la- + art. + initial unstable hamza is a special orthography
385 {a="l([ai])%-l%-(\")([uai])", b="ل%1لٱ%3"},
386 {a="l([ai])%-l%-([uai])", b="ل%1لا%2"},
387 -- al- + lunar consonant (i.e. what remains)
388 {a="^(a)l%-", b="ا%1ل"},
389 {a="([%s%-])(a)l%-", b="%1ا%2ل"},
390 -- diphthongs to be resolved before ʾalif conjunctionis
391 {a="(aW)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="awuا%2%3"},
392 {a="(aw)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1u%2%3"},
393 {a="(ay)(%s)(['][%_%^%.]?[l'btjghxdrzs`fqkmnwy]%-)", b="%1i%2%3"},
394 -- art. with waṣla + lām (easy)
395 {a="'l%-(l)", b="ال%1"},
396 -- art. with waṣla + solar consonant (easy)
397 {a="'l%-([%_%^%.]?[tdrzsn])", b="ال%1"},
398 -- li-/la- + art. + lām (easy)
399 {a="l([ai])%-l%-(l)", b="ل%1%2"},
400 -- assim. art. with waṣla + solar consonant (easy)
401 {a="'([%_%^%.]?[tdrzsn])%-", b="ال"},
402 -- li-/la- + art. + solar consonant is a special orthography (easy)
403 {a="l([ai])%-l%-([%_%^%.]?[tdrzsn])", b="ل%1ل%2"},
404 -- li-/la + assim. art. + solar consonant is a special orthography (easy)
405 {a="l([ai])%-([%_%^%.]?[tdrzsn])%-([%_%^%.]?[tdrzsn])", b="ل%1ل%3"},
406 -- art. with waṣla + initial unstable hamza
407 {a="'l%-(\")([uai])", b="الٱ%2"},
408 {a="'l%-([uai])", b="الا%1"},
409 -- art. with waṣla + lunar consonant (i.e. what remains)
410 {a="'l%-", b="ال"},
411 -- the silent wāw
412 {a="uU$", b="uو"},
413 {a="uU(%W)", b="uو%1"},
414 {a="aU$", b="aو"},
415 {a="aU(%W)", b="aو%1"},
416 {a="iU$", b="iو"},
417 {a="iU(%W)", b="iو%1"},
418 -- words ending in -āT with silent wāw/yāʾ
419 {a="(_a)UA", b="%1وا"},
420 {a="(_a)U", b="%1و"},
421 {a="(_a)I", b="%1ي"},
422 -- assimilations
423--easy {a="(n)(%s)([rlmnwy])", b="%1%2%3%3"}
424}
425
250digraphs = { 426digraphs = {
251 -- initial straight double quote gives a connective ʾalif 427 -- initial straight double quote gives a connective ʾalif
252 {a="^\"[uai]", b="ٱ"}, 428 {a="^\"[uai]", b="ٱ"},