aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex_trans.lua187
1 files changed, 187 insertions, 0 deletions
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
new file mode 100644
index 0000000..e65c3eb
--- /dev/null
+++ b/arabluatex_trans.lua
@@ -0,0 +1,187 @@
1--[[
2This file is part of the `arabluatex' package
3
4copyright (C) 2016 Robert Alessi
5
6Please send error reports and suggestions for improvements to
7Robert Alessi <alessi@robertalessi.net>
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2202111-1307, USA.
23--]]
24
25hamzatrdmg = {
26 -- initial long u
27 {a="%'%_U", b="ʾU"},
28 -- madda (historic writing below)
29 {a="'A", b="ʾA"},
30 {a="(A)(')(i)$", b="%1ʾ%3"},
31 {a="(A)(')(i)(%W)", b="%1ʾ%3%4"},
32 {a="(A)(')(i)", b="%1ʾ%3"}, -- historic madda
33 {a="(A)(')", b="%1ʾ"}, -- historic madda
34 -- initial (needs both ^ and %W patterns)
35 {a="^(')([ua])", b="ʾ%2"},
36 {a="^(')(i)", b="ʾ%2"},
37 {a="(%W)(')([ua])", b="%1ʾ%3"},
38 {a="(%W)(')(i)", b="%1ʾ%3"},
39 -- final
40 {a="([Iy])(')(aN)$", b="%1ʾ%3"},
41 {a="([Iy])(')(aN)(%W)", b="%1ʾ%3%4"},
42 {a="([^uai])(')([uai]N?)$", b="%1ʾ%3"},
43 {a="([^uai])(')([uai]N?)(%W)", b="%1ʾ%3%4"},
44 {a="([UI])(')([uai])$", b="%1ʾ%3"},
45 {a="([UI])(')([uai])(%W)", b="%1ʾ%3%4"},
46 -- middle
47 {a="(U)(')", b="%1ʾ"},
48 {a="([Iy])(')", b="%1ʾ"},
49 {a="([^uai])(')([uU])", b="%1ʾ%3"},
50 {a="([^uai])(')([aA])", b="%1ʾ%3"},
51 {a="([^uai])(')([iI])", b="%1ʾ%3"},
52 {a="(u)(')([uU])", b="%1ʾ%3"},
53 {a="(u)(')([aA])", b="%1ʾ%3"},
54 {a="(u)(')([iI])", b="%1ʾ%3"},
55 {a="(a)(')([aA])", b="%1ʾ%3"},
56 {a="(a)(')([uU])", b="%1ʾ%3"},
57 {a="(a)(')([iI])", b="%1ʾ%3"},
58 {a="(i)(')([aA])", b="%1ʾ%3"},
59 {a="(i)(')([uU])", b="%1ʾ%3"},
60 {a="(i)(')([iI])", b="%1ʾ%3"},
61 {a="(a)(')([^uaiUAI])", b="%1ʾ%3"},
62 {a="(u)(')([^uaiUAI])", b="%1ʾ%3"},
63 {a="(i)(')([^uaiUAI])", b="%1ʾ%3"}
64}
65
66trigraphstrdmg = { -- trigraphs or more
67 -- 'llatI / 'llad_I
68 {a="^'ll(a)([%_]?[dt])", b="'ll%1%2"},
69 {a="(%s)'ll(a)([%_]?[dt])", b="%1'll%2%3"},
70 -- al- + lām
71 {a="^(a)l%-(l)", b="%1l-%2%2"},
72 {a="(%s)(a)l%-(l)", b="%1%2l-%3%3"},
73 -- al- + solar consonant
74 {a="^(a)l%-([%_%^%.]?[tdrzsn])", b="%1%2-%2"},
75 {a="(%s)(a)l%-([%_%^%.]?[tdrzsn])", b="%1%2%3-%3"},
76 -- assim. art. + solar consonant
77 {a="^(a)([%_%^%.]?[tdrzsn])%-", b="%1%2-%2"},
78 {a="(%s)(a)([%_%^%.]?[tdrzsn])%-", b="%1%2%3-%3"},
79 -- al- + initial unstable hamza
80 {a="^(a)l%-([uai])", b="%1l-%2"},
81 {a="(%s)(a)l%-([uai])", b="%1%2l-%3"},
82 -- li- + art. + initial unstable hamza is a special orthography
83 {a="l(i)%-l%-([uai])", b="l%1-l-%2"},
84 -- al- + lunar consonant (i.e. what remains)
85 {a="^(a)l%-", b="%1l-"},
86 {a="(%s)(a)l%-", b="%1%2l-"},
87 -- art. with waṣla + lām
88 {a="'l%-(l)", b="'l-%1"},
89 -- art. with waṣla + solar consonant
90 {a="'l%-([%_%^%.]?[tdrzsn])", b="'%1-"},
91 -- li- + art. + lām
92 {a="l(i)%-l%-(l)", b="l%1-l-%2%2"},
93 -- assim. art. with waṣla + solar consonant
94 {a="'([%_%^%.]?[tdrzsn])%-", b="'%1-%1"},
95 -- li- + art. + solar consonant is a special orthography
96 {a="l(i)%-l%-([%_%^%.]?[tdrzsn])", b="l%1-%2-%2"},
97 -- li- + assim. art. + solar consonant is a special orthography
98 {a="l(i)%-([%_%^%.]?[tdrzsn])%-([%_%^%.]?[tdrzsn])", b="l%1-%2-%3"},
99 -- art. with waṣla + initial unstable hamza
100 {a="'l%-([uai])", b="'l-%1"},
101 -- art. with waṣla + lunar consonant (i.e. what remains)
102 {a="'l%-", b="'l-"}
103}
104
105tanwintrdmg = {
106 {a="uN", b="un"},
107 {a="(aN)(_A)", b="an"},
108 {a="(aN)(Y)", b="an"},
109 {a="(T)(aN)", b="tan"},
110 {a="([^TA])(aN)", b="%1an"},
111 {a="iN", b="in"}
112}
113
114digraphstrdmg = {
115 {a="(%-)([uai])", b="%1%2"}, -- hyphen + initial alif without hamza
116 {a="^([uai])", b="%1"}, -- initial alif without hamza
117 {a="(%s)([uai])", b="%1%2"}, -- initial alif without hamza
118 {a="%-%-", b=""},
119 {a="T([^uai])", b="%1"},
120 {a="_t", b="ṯ"},
121 {a="%^g", b="ǧ"},
122 {a="%.h", b="ḥ"},
123 {a="_h", b="ḫ"},
124 {a="_d", b="ḏ"},
125 {a="%^s", b="š"},
126 {a="%.s", b="ṣ"},
127 {a="%.d", b="ḍ"},
128 {a="%.t", b="ṭ"},
129 {a="%.z", b="ẓ"},
130 {a="%.g", b="ġ"},
131 {a="(U)(A)", b="ū"},
132 {a="WA", b="ū"},
133 {a="(a)W", b="%1w"},
134 {a="_A", b="ā"},
135 {a="_u", b="ū"},
136 {a="_a", b="ā"},
137 {a="_i", b="ī"}
138}
139
140singletrdmg = {
141 {a="b", b="b"},
142 {a="t", b="t"},
143 {a="j", b="ǧ"},
144 {a="x", b="ḫ"},
145 {a="d", b="d"},
146 {a="r", b="r"},
147 {a="z", b="z"},
148 {a="s", b="s"},
149 {a="`", b="ʿ"},
150 {a="f", b="f"},
151 {a="q", b="q"},
152 {a="k", b="k"},
153 {a="l", b="l"},
154 {a="m", b="m"},
155 {a="n", b="n"},
156 {a="h", b="h"},
157 {a="w", b="w"},
158 {a="y", b="y"},
159 {a="T", b="t"},
160 {a="Y", b="ā"},
161 {a='"', b=''},
162}
163
164longvtrdmg = {
165 {a="A", b="ā"},
166 {a="U", b="ū"},
167 {a="I", b="ī"}
168}
169
170shortvtrdmg = {
171 {a="u", b="u"},
172 {a="a", b="a"},
173 {a="i", b="i"}
174}
175
176
177-- return {
178-- raw = raw,
179-- hamza = hamza,
180-- trigraphs = trigraphs,
181-- tanwin = tanwin,
182-- digraphs = digraphs,
183-- single = single,
184-- longv = longv,
185-- shortv = shortv,
186-- null =null
187-- }