diff options
Diffstat (limited to 'arabluatex.lua')
-rw-r--r-- | arabluatex.lua | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 4484c27..d999548 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -167,6 +167,42 @@ local function voc(str) | |||
167 | return str | 167 | return str |
168 | end | 168 | end |
169 | 169 | ||
170 | local function voceasy(str) | ||
171 | str = string.gsub(str, "\\arb(%b{})", function(inside) | ||
172 | inside = string.sub(inside, 2, -2) | ||
173 | for i = 1,#hamza do | ||
174 | inside = string.gsub(inside, hamza[i].a, hamza[i].b) | ||
175 | end | ||
176 | for i = 1,#tanwin do | ||
177 | inside = string.gsub(inside, tanwin[i].a, tanwin[i].b) | ||
178 | end | ||
179 | for i = 1,#trigraphs do | ||
180 | inside = string.gsub(inside, trigraphs[i].a, trigraphs[i].b) | ||
181 | end | ||
182 | for i = 1,#digraphs do | ||
183 | inside = string.gsub(inside, digraphs[i].a, digraphs[i].b) | ||
184 | end | ||
185 | for i = 1,#single do | ||
186 | inside = string.gsub(inside, single[i].a, single[i].b) | ||
187 | end | ||
188 | for i = 1,#longv do | ||
189 | inside = string.gsub(inside, longv[i].a, longv[i].b) | ||
190 | end | ||
191 | for i = 1,#shortv do | ||
192 | inside = string.gsub(inside, shortv[i].a, shortv[i].b) | ||
193 | end | ||
194 | for i = 1,#punctuation do | ||
195 | inside = string.gsub(inside, punctuation[i].a, punctuation[i].b) | ||
196 | end | ||
197 | for i = 1,#null do | ||
198 | inside = string.gsub(inside, null[i].a, null[i].b) | ||
199 | end | ||
200 | inside = indnum(inside) | ||
201 | return string.format("\\txarb{%s}", inside) | ||
202 | end) | ||
203 | return str | ||
204 | end | ||
205 | |||
170 | local function fullvoc(str) | 206 | local function fullvoc(str) |
171 | str = string.gsub(str, "\\arb(%b{})", function(inside) | 207 | str = string.gsub(str, "\\arb(%b{})", function(inside) |
172 | inside = string.sub(inside, 2, -2) | 208 | inside = string.sub(inside, 2, -2) |
@@ -312,13 +348,17 @@ local function transloc(str) | |||
312 | return str | 348 | return str |
313 | end | 349 | end |
314 | 350 | ||
315 | function processvoc(str) | 351 | function processvoc(str, rules) |
316 | str = "\\arb{".. str.."}" | 352 | str = "\\arb{".. str.."}" |
317 | str = takeoutcap(str) | 353 | str = takeoutcap(str) |
318 | str = protectarb(str) | 354 | str = protectarb(str) |
319 | str = breakcmd(str) | 355 | str = breakcmd(str) |
320 | str = holdcmd(str) | 356 | str = holdcmd(str) |
321 | str = voc(str) | 357 | if rules == "easy" then |
358 | str = voceasy(str) | ||
359 | elseif mode == "dflt" then | ||
360 | str = voc(str) | ||
361 | else end | ||
322 | str = unprotectarb(str) | 362 | str = unprotectarb(str) |
323 | return str | 363 | return str |
324 | end | 364 | end |