diff options
author | Robert Alessi <alessi@robertalessi.net> | 2017-03-30 18:15:37 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2017-03-30 18:15:37 +0200 |
commit | bb3e0c4488db36c2d0a81dc39e90c37bc7adf389 (patch) | |
tree | 8a5c306d9a8f21350ab713a4e67ba3a1e2026906 | |
parent | 1917bc52ec2caef4c46a7d3d44f143ed092facf2 (diff) | |
download | arabluatex-bb3e0c4488db36c2d0a81dc39e90c37bc7adf389.tar.gz |
arabica: removed unnecessary rules and tables
-rw-r--r-- | arabluatex.lua | 19 | ||||
-rw-r--r-- | arabluatex_trans.lua | 99 |
2 files changed, 8 insertions, 110 deletions
diff --git a/arabluatex.lua b/arabluatex.lua index 722084c..3b76376 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -497,11 +497,11 @@ end | |||
497 | local function transarabica(str) | 497 | local function transarabica(str) |
498 | str = string.gsub(str, "\\arb(%b{})", function(inside) | 498 | str = string.gsub(str, "\\arb(%b{})", function(inside) |
499 | inside = string.sub(inside, 2, -2) | 499 | inside = string.sub(inside, 2, -2) |
500 | for i = 1,#hamzatrarabica do | 500 | for i = 1,#hamzatrloc do |
501 | inside = string.gsub(inside, hamzatrarabica[i].a, hamzatrarabica[i].b) | 501 | inside = string.gsub(inside, hamzatrloc[i].a, hamzatrloc[i].b) |
502 | end | 502 | end |
503 | for i = 1,#tanwintrarabica do | 503 | for i = 1,#tanwintrloc do |
504 | inside = string.gsub(inside, tanwintrarabica[i].a, tanwintrarabica[i].b) | 504 | inside = string.gsub(inside, tanwintrloc[i].a, tanwintrloc[i].b) |
505 | end | 505 | end |
506 | for i = 1,#trigraphstrarabica do | 506 | for i = 1,#trigraphstrarabica do |
507 | inside = string.gsub(inside, trigraphstrarabica[i].a, trigraphstrarabica[i].b) | 507 | inside = string.gsub(inside, trigraphstrarabica[i].a, trigraphstrarabica[i].b) |
@@ -512,14 +512,11 @@ local function transarabica(str) | |||
512 | for i = 1,#singletrarabica do | 512 | for i = 1,#singletrarabica do |
513 | inside = string.gsub(inside, singletrarabica[i].a, singletrarabica[i].b) | 513 | inside = string.gsub(inside, singletrarabica[i].a, singletrarabica[i].b) |
514 | end | 514 | end |
515 | for i = 1,#longvtrarabica do | 515 | for i = 1,#longvtrloc do |
516 | inside = string.gsub(inside, longvtrarabica[i].a, longvtrarabica[i].b) | 516 | inside = string.gsub(inside, longvtrloc[i].a, longvtrloc[i].b) |
517 | end | ||
518 | for i = 1,#shortvtrarabica do | ||
519 | inside = string.gsub(inside, shortvtrarabica[i].a, shortvtrarabica[i].b) | ||
520 | end | 517 | end |
521 | for i = 1,#finaltrarabica do | 518 | for i = 1,#shortvtrloc do |
522 | inside = string.gsub(inside, finaltrarabica[i].a, finaltrarabica[i].b) | 519 | inside = string.gsub(inside, shortvtrloc[i].a, shortvtrloc[i].b) |
523 | end | 520 | end |
524 | for i = 1,#punctuationtr do | 521 | for i = 1,#punctuationtr do |
525 | inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) | 522 | inside = string.gsub(inside, punctuationtr[i].a, punctuationtr[i].b) |
diff --git a/arabluatex_trans.lua b/arabluatex_trans.lua index bd2d27a..daf4c91 100644 --- a/arabluatex_trans.lua +++ b/arabluatex_trans.lua | |||
@@ -629,86 +629,6 @@ finaltrloc = { | |||
629 | 629 | ||
630 | -- arabica | 630 | -- arabica |
631 | 631 | ||
632 | hamzatrarabica = { --UNTOUCHED/LOC | ||
633 | -- hard coded hamza | ||
634 | {a="|\"'", b="ʾ"}, | ||
635 | {a="A\"'", b="ʾA"}, | ||
636 | {a="[au]\"'", b="ʾ"}, | ||
637 | {a="w\"'", b="ʾ"}, | ||
638 | {a="i\"'", b="ʾ"}, | ||
639 | {a="y\"'", b="ʾ"}, | ||
640 | -- hamza takes tašdīd too | ||
641 | {a="''([Uu])", b="ʾʾ%1"}, | ||
642 | {a="''([Aa])", b="ʾʾ%1"}, | ||
643 | {a="''([Ii])", b="ʾʾ%1"}, | ||
644 | -- initial long u and i (for a, see below) | ||
645 | {a="%'%_U", b="U"}, | ||
646 | {a="%'%_I", b="I"}, | ||
647 | -- taḫfīfu 'l-hamza | ||
648 | {a="^'u'([^uaiUAI])", b="U%1"}, | ||
649 | {a="(%W)'u'([^uaiUAI])", b="%1U%2"}, | ||
650 | {a="'u'([^uaiUAI])", b="ʾU"}, | ||
651 | {a="^'i'([^uaiUAI])", b="I%1"}, | ||
652 | {a="(%W)'i'([^uaiUAI])", b="%1I%2"}, | ||
653 | {a="'i'([^uaiUAI])", b="ʾI"}, | ||
654 | -- madda (historic writing below) | ||
655 | {a="^(')(A)", b="%2"}, | ||
656 | {a="(%W)(')(A)", b="%1%3"}, | ||
657 | {a="^'a'([^uaiUAI])", b="A%1"}, | ||
658 | {a="(%W)'a'([^uaiUAI])", b="%1A%2"}, | ||
659 | {a="'a'([^uaiUAI])", b="A%1"}, | ||
660 | {a="^'a?A", b="A"}, | ||
661 | {a="(%W)'a?A", b="%1A"}, | ||
662 | {a="'a?A", b="ʾA"}, | ||
663 | {a="(A)(')(i)$", b="%1ʾ%3"}, | ||
664 | {a="(A)(')(i)(%W)", b="%1ʾ%3%4"}, | ||
665 | {a="(A)(')(i)", b="%1ʾ%3"}, -- historic madda | ||
666 | {a="(A)(')", b="%1ʾ"}, -- historic madda | ||
667 | -- initial (needs both ^ and %W patterns) | ||
668 | {a="^(')([ua])", b="%2"}, | ||
669 | {a="^(')(i)", b="%2"}, | ||
670 | {a="(%W)(')([ua])", b="%1%3"}, | ||
671 | {a="(%W)(')(i)", b="%1%3"}, | ||
672 | -- final | ||
673 | {a="([Iy])(')(aN)$", b="%1ʾ%3"}, | ||
674 | {a="([Iy])(')(aN)(%W)", b="%1ʾ%3%4"}, | ||
675 | {a="([^uai])(')([uai]N?)$", b="%1ʾ%3"}, | ||
676 | {a="([^uai])(')([uai]N?)(%W)", b="%1ʾ%3%4"}, | ||
677 | {a="([UI])(')([uai])$", b="%1ʾ%3"}, | ||
678 | {a="([UI])(')([uai])(%W)", b="%1ʾ%3%4"}, | ||
679 | -- middle | ||
680 | {a="(U)(')", b="%1ʾ"}, | ||
681 | {a="([Iy])(')", b="%1ʾ"}, | ||
682 | {a="([^uai])(')([uU])", b="%1ʾ%3"}, | ||
683 | {a="([^uai])(')([aA])", b="%1ʾ%3"}, | ||
684 | {a="([^uai])(')([iI])", b="%1ʾ%3"}, | ||
685 | {a="(u)(')([uU])", b="%1ʾ%3"}, | ||
686 | {a="(u)(')([aA])", b="%1ʾ%3"}, | ||
687 | {a="(u)(')([iI])", b="%1ʾ%3"}, | ||
688 | {a="(a)(')([aA])", b="%1ʾ%3"}, | ||
689 | {a="(a)(')([uU])", b="%1ʾ%3"}, | ||
690 | {a="(a)(')([iI])", b="%1ʾ%3"}, | ||
691 | {a="(i)(')([aA])", b="%1ʾ%3"}, | ||
692 | {a="(i)(')([uU])", b="%1ʾ%3"}, | ||
693 | {a="(i)(')([iI])", b="%1ʾ%3"}, | ||
694 | {a="(a)(')([^uaiUAI])", b="%1ʾ%3"}, | ||
695 | {a="(u)(')([^uaiUAI])", b="%1ʾ%3"}, | ||
696 | {a="(i)(')([^uaiUAI])", b="%1ʾ%3"} | ||
697 | } | ||
698 | |||
699 | tanwintrarabica = { --UNTOUCHED/LOC | ||
700 | {a="%-?uNU", b="un"}, | ||
701 | {a="%-?aNU", b="an"}, | ||
702 | {a="%-?iNU", b="in"}, | ||
703 | {a="%-?(\"?At)%-?([ui])N", b="%1%2n"}, | ||
704 | {a="%-?([ui])N", b="%1n"}, | ||
705 | {a="%-?(aN)(_A)", b="an"}, | ||
706 | {a="%-?(aN)(Y)", b="an"}, | ||
707 | {a="(T)%-?(\"?aN)", b="tan"}, | ||
708 | {a="([^TA])%-?(\"?aN)", b="%1an"} | ||
709 | } | ||
710 | |||
711 | -- new | ||
712 | trigraphstrarabica = { -- trigraphs or more | 632 | trigraphstrarabica = { -- trigraphs or more |
713 | -- 'llatI / 'llad_I | 633 | -- 'llatI / 'llad_I |
714 | {a="^'ll(a)([%_]?[dt])", b="ll%1%2"}, | 634 | {a="^'ll(a)([%_]?[dt])", b="ll%1%2"}, |
@@ -759,7 +679,6 @@ trigraphstrarabica = { -- trigraphs or more | |||
759 | {a="(_a)I", b="A"} | 679 | {a="(_a)I", b="A"} |
760 | } | 680 | } |
761 | 681 | ||
762 | --new | ||
763 | digraphstrarabica = { | 682 | digraphstrarabica = { |
764 | -- discard the ʾiʿrāb hyphen (begin) | 683 | -- discard the ʾiʿrāb hyphen (begin) |
765 | {a="(%-)(\"?[UI]na)(%p?%s)", b="%2%3"}, | 684 | {a="(%-)(\"?[UI]na)(%p?%s)", b="%2%3"}, |
@@ -810,7 +729,6 @@ digraphstrarabica = { | |||
810 | {a="%^d", b="d"} | 729 | {a="%^d", b="d"} |
811 | } | 730 | } |
812 | 731 | ||
813 | -- new | ||
814 | singletrarabica = { | 732 | singletrarabica = { |
815 | {a="b", b="b"}, | 733 | {a="b", b="b"}, |
816 | {a="t", b="t"}, | 734 | {a="t", b="t"}, |
@@ -835,20 +753,3 @@ singletrarabica = { | |||
835 | {a="B", b=""} | 753 | {a="B", b=""} |
836 | } | 754 | } |
837 | 755 | ||
838 | longvtrarabica = { | ||
839 | {a="A", b="ā"}, | ||
840 | {a="U", b="ū"}, | ||
841 | {a="I", b="ī"}, | ||
842 | {a="Y", b="á"}, | ||
843 | } | ||
844 | |||
845 | shortvtrarabica = { | ||
846 | {a="u", b="u"}, | ||
847 | {a="a", b="a"}, | ||
848 | {a="i", b="i"} | ||
849 | } | ||
850 | |||
851 | -- new | ||
852 | finaltrarabica = { | ||
853 | -- {a="ʾ", b="'"}, | ||
854 | } | ||