aboutsummaryrefslogtreecommitdiff
path: root/arabluatex.lua
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-05-08 11:24:20 +0200
committerRobert Alessi <alessi@robertalessi.net>2016-05-08 11:24:20 +0200
commite80c0d99f7d2511e6e3f3e70cd922f119a1fc217 (patch)
treecf8de357e12abc01a0699df5acf57f7da29effa9 /arabluatex.lua
parent3a541689af28f049f62be1f1b4df97763179f847 (diff)
downloadarabluatex-e80c0d99f7d2511e6e3f3e70cd922f119a1fc217.tar.gz
first implementation of 'easy' rules set
Diffstat (limited to 'arabluatex.lua')
-rw-r--r--arabluatex.lua44
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)
167return str 167return str
168end 168end
169 169
170local 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)
203return str
204end
205
170local function fullvoc(str) 206local 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)
312return str 348return str
313end 349end
314 350
315function processvoc(str) 351function 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)
323return str 363return str
324end 364end