diff options
Diffstat (limited to 'arabluatex.lua')
-rw-r--r-- | arabluatex.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 91932b7..722084c 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -494,6 +494,44 @@ local function transloc(str) | |||
494 | return str | 494 | return str |
495 | end | 495 | end |
496 | 496 | ||
497 | local function transarabica(str) | ||
498 | str = string.gsub(str, "\\arb(%b{})", function(inside) | ||
499 | inside = string.sub(inside, 2, -2) | ||
500 | for i = 1,#hamzatrarabica do | ||
501 | inside = string.gsub(inside, hamzatrarabica[i].a, hamzatrarabica[i].b) | ||
502 | end | ||
503 | for i = 1,#tanwintrarabica do | ||
504 | inside = string.gsub(inside, tanwintrarabica[i].a, tanwintrarabica[i].b) | ||
505 | end | ||
506 | for i = 1,#trigraphstrarabica do | ||
507 | inside = string.gsub(inside, trigraphstrarabica[i].a, trigraphstrarabica[i].b) | ||
508 | end | ||
509 | for i = 1,#digraphstrarabica do | ||
510 | inside = string.gsub(inside, digraphstrarabica[i].a, digraphstrarabica[i].b) | ||
511 | end | ||
512 | for i = 1,#singletrarabica do | ||
513 | inside = string.gsub(inside, singletrarabica[i].a, singletrarabica[i].b) | ||
514 | end | ||
515 | for i = 1,#longvtrarabica do | ||
516 | inside = string.gsub(inside, longvtrarabica[i].a, longvtrarabica[i].b) | ||
517 | end | ||
518 | for i = 1,#shortvtrarabica do | ||
519 | inside = string.gsub(inside, shortvtrarabica[i].a, shortvtrarabica[i].b) | ||
520 | end | ||
521 | for i = 1,#finaltrarabica do | ||
522 | inside = string.gsub(inside, finaltrarabica[i].a, finaltrarabica[i].b) | ||
523 | end | ||
524 | for i = 1,#punctuationtr do | ||
525 | inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) | ||
526 | end | ||
527 | for i = 1,#nulltr do | ||
528 | inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) | ||
529 | end | ||
530 | return string.format("\\txtrans{%s}", inside) | ||
531 | end) | ||
532 | return str | ||
533 | end | ||
534 | |||
497 | local function processbuckw(str) | 535 | local function processbuckw(str) |
498 | str = string.gsub(str, "\\arb(%b{})", function(inside) | 536 | str = string.gsub(str, "\\arb(%b{})", function(inside) |
499 | inside = string.sub(inside, 2, -2) | 537 | inside = string.sub(inside, 2, -2) |
@@ -579,6 +617,8 @@ function processtrans(str, mode, rules, scheme) | |||
579 | str = transdmg(str, rules) | 617 | str = transdmg(str, rules) |
580 | elseif mode == "loc" then | 618 | elseif mode == "loc" then |
581 | str = transloc(str) | 619 | str = transloc(str) |
620 | elseif mode == "arabica" then | ||
621 | str = transarabica(str) | ||
582 | end | 622 | end |
583 | str = unprotectarb(str) | 623 | str = unprotectarb(str) |
584 | return str | 624 | return str |