diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-03-29 19:03:38 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-03-29 19:03:38 +0200 |
commit | e11852284d62c0d0192e9b2a204cb1e7f0ad45f1 (patch) | |
tree | 35a8f6efa3f3d98768c9c366fb3b33ddb77c7ee5 | |
parent | 6f7b8e49be7093b2c67aee02f562b0491bd16c10 (diff) | |
download | arabluatex-e11852284d62c0d0192e9b2a204cb1e7f0ad45f1.tar.gz |
\arbmarks{} first checks if its argument is defined in the arbmarks table
-rw-r--r-- | arabluatex.dtx | 6 | ||||
-rw-r--r-- | arabluatex.lua | 25 | ||||
-rw-r--r-- | arabluatex_voc.lua | 7 |
3 files changed, 27 insertions, 11 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx index 121de84..09b38e4 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx | |||
@@ -229,7 +229,7 @@ | |||
229 | %</driver> | 229 | %</driver> |
230 | % \fi | 230 | % \fi |
231 | % | 231 | % |
232 | % \CheckSum{715} | 232 | % \CheckSum{0} |
233 | % | 233 | % |
234 | % \CharacterTable | 234 | % \CharacterTable |
235 | % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z | 235 | % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
@@ -3744,7 +3744,9 @@ wa-ya.sIru ta.hta 'l-jild-i | |||
3744 | % \end{macrocode} | 3744 | % \end{macrocode} |
3745 | % \end{macro} | 3745 | % \end{macro} |
3746 | % \begin{macro}{\arbmark} | 3746 | % \begin{macro}{\arbmark} |
3747 | % New command to be documented | 3747 | % \changes{v1.10.4}{2018/03/29}{New command for inserting additional |
3748 | % marks in Arabic environments} \cs{arbmark} takes one argument from a | ||
3749 | % list of defined elements. | ||
3748 | % \begin{macrocode} | 3750 | % \begin{macrocode} |
3749 | \NewDocumentCommand{\arbmark}{m}{% | 3751 | \NewDocumentCommand{\arbmark}{m}{% |
3750 | \bgroup% | 3752 | \bgroup% |
diff --git a/arabluatex.lua b/arabluatex.lua index cd0bfa2..7a7460a 100644 --- a/arabluatex.lua +++ b/arabluatex.lua | |||
@@ -676,14 +676,27 @@ function newarbmark(abbr, rtlmk, ltrmk) | |||
676 | return true | 676 | return true |
677 | end | 677 | end |
678 | 678 | ||
679 | function processarbmarks(str) | 679 | local function isintable(table, element) |
680 | if tex.textdir == "TLT" then | 680 | for i = 1,#table do |
681 | for i = 1,#arbmarks do | 681 | if table[i].a == element then |
682 | str = string.gsub(str, arbmarks[i].a, arbmarks[i].c) | 682 | return true |
683 | end | 683 | end |
684 | end | ||
685 | return false | ||
686 | end | ||
687 | |||
688 | function processarbmarks(str) | ||
689 | if not isintable(arbmarks, str) then | ||
690 | str = "\\LR{<??>}" | ||
684 | else | 691 | else |
685 | for i = 1,#arbmarks do | 692 | if tex.textdir == "TLT" then |
686 | str = string.gsub(str, arbmarks[i].a, arbmarks[i].b) | 693 | for i = 1,#arbmarks do |
694 | str = string.gsub(str, arbmarks[i].a, arbmarks[i].c) | ||
695 | end | ||
696 | else | ||
697 | for i = 1,#arbmarks do | ||
698 | str = string.gsub(str, arbmarks[i].a, arbmarks[i].b) | ||
699 | end | ||
687 | end | 700 | end |
688 | end | 701 | end |
689 | return str | 702 | return str |
diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index 49b45a6..ac26c13 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua | |||
@@ -23,9 +23,10 @@ along with this program. If not, see | |||
23 | --]] | 23 | --]] |
24 | 24 | ||
25 | arbmarks = { | 25 | arbmarks = { |
26 | {a="bismillah", b="﷽", c="\\arb[trans]{bi-ismi \\uc{'l-l_ahi} 'l-ra.hm_ani 'l-ra.hImi}"}, | 26 | {a="bismillah", b="^^^^fdfd", c="\\arb[trans]{bi-ismi \\uc{'l-l_ahi} 'l-ra.hm_ani 'l-ra.hImi}"}, |
27 | {a="salam", b="ﷵ", c="\\arb[trans]{.sall_A\\arbnull{'l-l_ahu} \\uc{'l-l_ahu} `alay-hi wa-sallama}"}, | 27 | {a="salam", b="^^^^fdf5", c="\\arb[trans]{.sall_A\\arbnull{'l-l_ahu} \\uc{'l-l_ahu} `alay-hi wa-sallama}"}, |
28 | {a="slm", b="ﷺ", c="\\arb[trans]{.sall_A\\arbnull{'l-l_ahu} \\uc{'l-l_ahu} `alay-hi wa-sallama}"} | 28 | {a="slm", b="^^^^fdfa", c="\\arb[trans]{.sall_A\\arbnull{'l-l_ahu} \\uc{'l-l_ahu} `alay-hi wa-sallama}"}, |
29 | {a="jalla", b="^^^^fdfb", c="\\arb[trans]{^galla ^galAla-hu}"} | ||
29 | } | 30 | } |
30 | 31 | ||
31 | abjad = { | 32 | abjad = { |