aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-06-24 19:01:06 +0200
committerRobert Alessi <alessi@robertalessi.net>2018-06-24 19:01:06 +0200
commit5501041edd4a7b0d5e94408141ed783a9ff30ee4 (patch)
tree046890b4f57479fc696a46bb170b8e6c6a052f9f
parent42067f8524741964c43e8a10c791ad26e98c7888 (diff)
downloadarabluatex-5501041edd4a7b0d5e94408141ed783a9ff30ee4.tar.gz
cleaned up the lua code
-rw-r--r--arabluatex.lua17
-rw-r--r--arabluatex_fullvoc.lua4
-rw-r--r--arabluatex_novoc.lua2
-rw-r--r--arabluatex_trans.lua4
-rw-r--r--arabluatex_voc.lua4
5 files changed, 7 insertions, 24 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 9ed37c1..8238236 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -85,8 +85,6 @@ local albrkcmds = {
85 "end", 85 "end",
86 "par", 86 "par",
87 "LRmarginpar", 87 "LRmarginpar",
88 "Footnote",
89 "Marginpar",
90 "arbmark", 88 "arbmark",
91 "abjad" 89 "abjad"
92} 90}
@@ -128,15 +126,6 @@ local function breakcmd(str)
128 bodytext = string.sub(bodytext, 2, -2) 126 bodytext = string.sub(bodytext, 2, -2)
129 return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) 127 return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext)
130 end) 128 end)
131 -- -- \arbcolor
132 -- str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)",
133 -- function (li, tag, opt, body, lii)
134 -- li = string.gsub(li, "%+", "‍") -- ^^^^200d
135 -- lii = string.gsub(lii, "%+", "‍") -- ^^^^200d
136 -- body = string.sub(body, 2, -2)
137 -- body = string.gsub(body, "%+", "‍") -- ^^^^200d
138 -- return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii)
139 -- end)
140 -- commands set by default in outofarb 129 -- commands set by default in outofarb
141 for i = 1,#outofarb do 130 for i = 1,#outofarb do
142 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{") 131 str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{")
@@ -312,7 +301,6 @@ local function voc(str, rules)
312 inside = string.gsub(inside, null[i].a, null[i].b) 301 inside = string.gsub(inside, null[i].a, null[i].b)
313 end 302 end
314 inside = indnum(inside) 303 inside = indnum(inside)
315-- return string.format("\\txarb{%s}", inside)
316 return string.format("\\arabicfont{}%s", inside) 304 return string.format("\\arabicfont{}%s", inside)
317 end) 305 end)
318return str 306return str
@@ -349,7 +337,6 @@ local function voceasy(str)
349 inside = string.gsub(inside, null[i].a, null[i].b) 337 inside = string.gsub(inside, null[i].a, null[i].b)
350 end 338 end
351 inside = indnum(inside) 339 inside = indnum(inside)
352-- return string.format("\\txarb{%s}", inside)
353 return string.format("\\arabicfont{}%s", inside) 340 return string.format("\\arabicfont{}%s", inside)
354 end) 341 end)
355return str 342return str
@@ -403,7 +390,6 @@ local function fullvoc(str, rules)
403 inside = string.gsub(inside, null[i].a, null[i].b) 390 inside = string.gsub(inside, null[i].a, null[i].b)
404 end 391 end
405 inside = indnum(inside) 392 inside = indnum(inside)
406-- return string.format("\\txarb{%s}", inside)
407 return string.format("\\arabicfont{}%s", inside) 393 return string.format("\\arabicfont{}%s", inside)
408 end) 394 end)
409return str 395return str
@@ -452,7 +438,6 @@ local function fullvoceasy(str, rules)
452 inside = string.gsub(inside, null[i].a, null[i].b) 438 inside = string.gsub(inside, null[i].a, null[i].b)
453 end 439 end
454 inside = indnum(inside) 440 inside = indnum(inside)
455-- return string.format("\\txarb{%s}", inside)
456 return string.format("\\arabicfont{}%s", inside) 441 return string.format("\\arabicfont{}%s", inside)
457 end) 442 end)
458return str 443return str
@@ -489,7 +474,6 @@ local function novoc(str)
489 inside = string.gsub(inside, null[i].a, null[i].b) 474 inside = string.gsub(inside, null[i].a, null[i].b)
490 end 475 end
491 inside = indnum(inside) 476 inside = indnum(inside)
492-- return string.format("\\txarb{%s}", inside)
493 return string.format("\\arabicfont{}%s", inside) 477 return string.format("\\arabicfont{}%s", inside)
494 end) 478 end)
495return str 479return str
@@ -526,7 +510,6 @@ local function novoceasy(str)
526 inside = string.gsub(inside, null[i].a, null[i].b) 510 inside = string.gsub(inside, null[i].a, null[i].b)
527 end 511 end
528 inside = indnum(inside) 512 inside = indnum(inside)
529-- return string.format("\\txarb{%s}", inside)
530 return string.format("\\arabicfont{}%s", inside) 513 return string.format("\\arabicfont{}%s", inside)
531 end) 514 end)
532return str 515return str
diff --git a/arabluatex_fullvoc.lua b/arabluatex_fullvoc.lua
index 30c5bf7..8d2615e 100644
--- a/arabluatex_fullvoc.lua
+++ b/arabluatex_fullvoc.lua
@@ -329,7 +329,7 @@ tanwinfv = { -- with assimilations (\SetArbDflt*)
329 -- quoted tanwīn (end) 329 -- quoted tanwīn (end)
330 {a="%-?(uN)", b="ٌ"}, 330 {a="%-?(uN)", b="ٌ"},
331 {a="(B)%-?(aN)", b="%1ً"}, 331 {a="(B)%-?(aN)", b="%1ً"},
332 -- *** 332 -- needed by \arbcolor:
333 {a="%-?(aN)(O[%S]-%_AO)", b="ً"}, 333 {a="%-?(aN)(O[%S]-%_AO)", b="ً"},
334 {a="%-?(aN)(O[%S]-YO)", b="ً"}, 334 {a="%-?(aN)(O[%S]-YO)", b="ً"},
335 {a="(O[%S]-TO)%-?(aN)", b="ً"}, 335 {a="(O[%S]-TO)%-?(aN)", b="ً"},
@@ -383,7 +383,7 @@ tanwinfveasy = { -- no assimilations (see below)
383 -- quoted tanwīn (end) 383 -- quoted tanwīn (end)
384 {a="%-?(uN)", b="ٌ"}, 384 {a="%-?(uN)", b="ٌ"},
385 {a="(B)%-?(aN)", b="%1ً"}, 385 {a="(B)%-?(aN)", b="%1ً"},
386 -- *** 386 -- needed by \arbcolor:
387 {a="%-?(aN)(O[%S]-%_AO)", b="ً"}, 387 {a="%-?(aN)(O[%S]-%_AO)", b="ً"},
388 {a="%-?(aN)(O[%S]-YO)", b="ً"}, 388 {a="%-?(aN)(O[%S]-YO)", b="ً"},
389 {a="(O[%S]-TO)%-?(aN)", b="ً"}, 389 {a="(O[%S]-TO)%-?(aN)", b="ً"},
diff --git a/arabluatex_novoc.lua b/arabluatex_novoc.lua
index 95a19ef..774b8b3 100644
--- a/arabluatex_novoc.lua
+++ b/arabluatex_novoc.lua
@@ -53,7 +53,7 @@ tanwinnv = {
53 -- "quoted" tanwīn (end) 53 -- "quoted" tanwīn (end)
54 {a="%-?(uN)", b=""}, 54 {a="%-?(uN)", b=""},
55 {a="(B)%-?(aN)", b="%1"}, 55 {a="(B)%-?(aN)", b="%1"},
56 -- *** 56 -- needed by \arbcolor:
57 {a="%-?(aN)(O[%S]-%_AO)", b=""}, 57 {a="%-?(aN)(O[%S]-%_AO)", b=""},
58 {a="%-?(aN)(O[%S]-YO)", b=""}, 58 {a="%-?(aN)(O[%S]-YO)", b=""},
59 {a="(O[%S]-TO)%-?(aN)", b=""}, 59 {a="(O[%S]-TO)%-?(aN)", b=""},
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua
index d532021..1651418 100644
--- a/arabluatex_trans.lua
+++ b/arabluatex_trans.lua
@@ -255,7 +255,7 @@ tanwintrdmg = {
255 -- 255 --
256-- {a="uN", b="\\arbup{un}"}, (now included in the last line of this table) 256-- {a="uN", b="\\arbup{un}"}, (now included in the last line of this table)
257 {a="%-?(\"?At)%-?([ui])N", b="\\arbup{%1%2n}"}, 257 {a="%-?(\"?At)%-?([ui])N", b="\\arbup{%1%2n}"},
258 -- *** 258 -- needed by \arbcolor:
259 {a="%-?(aN)(O[%S]-%_AO)", b="ạ\\arbup{n}"}, 259 {a="%-?(aN)(O[%S]-%_AO)", b="ạ\\arbup{n}"},
260 {a="%-?(aN)(O[%S]-YO)", b="ạ\\arbup{n}"}, 260 {a="%-?(aN)(O[%S]-YO)", b="ạ\\arbup{n}"},
261 {a="(O[%S]-TO)%-?(\"?aN)", b="\\arbup{an}"}, 261 {a="(O[%S]-TO)%-?(\"?aN)", b="\\arbup{an}"},
@@ -592,7 +592,7 @@ tanwintrloc = {
592 {a="%-?iNI", b="in"}, 592 {a="%-?iNI", b="in"},
593 {a="%-?(\"?At)%-?([ui])N", b="%1%2n"}, 593 {a="%-?(\"?At)%-?([ui])N", b="%1%2n"},
594 {a="%-?([ui])N", b="%1n"}, 594 {a="%-?([ui])N", b="%1n"},
595 -- *** 595 -- needed by \arbcolor:
596 {a="%-?(aN)(O[%S]-%_AO)", b="an"}, 596 {a="%-?(aN)(O[%S]-%_AO)", b="an"},
597 {a="%-?(aN)(O[%S]-YO)", b="an"}, 597 {a="%-?(aN)(O[%S]-YO)", b="an"},
598 {a="(O[%S]-TO)%-?(\"?aN)", b="an"}, 598 {a="(O[%S]-TO)%-?(\"?aN)", b="an"},
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua
index 412255c..3f4cce9 100644
--- a/arabluatex_voc.lua
+++ b/arabluatex_voc.lua
@@ -458,7 +458,7 @@ tanwin = {
458 -- quoted tanwīn (end) 458 -- quoted tanwīn (end)
459 {a="%-?(uN)", b="ٌ"}, 459 {a="%-?(uN)", b="ٌ"},
460 {a="(B)%-?(aN)", b="%1ً"}, 460 {a="(B)%-?(aN)", b="%1ً"},
461 -- *** 461 -- needed by \arbcolor:
462 {a="%-?(aN)(O[%S]-%_AO)", b="ً"}, 462 {a="%-?(aN)(O[%S]-%_AO)", b="ً"},
463 {a="%-?(aN)(O[%S]-YO)", b="ً"}, 463 {a="%-?(aN)(O[%S]-YO)", b="ً"},
464 {a="(O[%S]-TO)%-?(aN)", b="ً"}, 464 {a="(O[%S]-TO)%-?(aN)", b="ً"},
@@ -507,7 +507,7 @@ tanwineasy = { -- 'easy' requires some lines to be taken out:
507 -- quoted tanwīn (end) 507 -- quoted tanwīn (end)
508 {a="%-?(uN)", b="ٌ"}, 508 {a="%-?(uN)", b="ٌ"},
509 {a="(B)%-?(aN)", b="%1ً"}, 509 {a="(B)%-?(aN)", b="%1ً"},
510 -- *** 510 -- needed by \arbcolor:
511 {a="%-?(aN)(O[%S]-%_AO)", b="ً"}, 511 {a="%-?(aN)(O[%S]-%_AO)", b="ً"},
512 {a="%-?(aN)(O[%S]-YO)", b="ً"}, 512 {a="%-?(aN)(O[%S]-YO)", b="ً"},
513 {a="(O[%S]-TO)%-?(aN)", b="ً"}, 513 {a="(O[%S]-TO)%-?(aN)", b="ً"},