From 4948d317c59e957856bf91049b8dfcc8f9141dae Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 28 Mar 2018 00:07:59 +0200 Subject: new command \arbmark{} for inserting any additional Arabic mark --- arabluatex.dtx | 11 +++-------- arabluatex.lua | 10 ++++++++-- arabluatex_voc.lua | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index e6b680e..53a7ed4 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -3746,16 +3746,11 @@ wa-ya.sIru ta.hta 'l-jild-i % \begin{macro}{\arbmark} % New command to be documented % \begin{macrocode} -\NewDocumentCommand{\garbmark}{m}{% +\NewDocumentCommand{\arbmark}{m}{% \bgroup% \SetInputScheme{arabtex}% - \ifx\al@mode\al@mode@trans% - \luadirect{tex.write(processarbmarks(\luastringN{#1}, - \luastringO{trans}))}% - \else% - \luadirect{tex.write(processarbmarks(\luastringN{#1}, - \luastringO{notrans}))}% - \fi\egroup} + \luadirect{tex.sprint(processarbmarks(\luastringN{#1}))}% + \egroup} % \end{macrocode} % % \end{macro} diff --git a/arabluatex.lua b/arabluatex.lua index 2c0e2c2..3d25a05 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -124,6 +124,12 @@ local function breakcmd(str) body = string.sub(body, 2, -2) return string.format("}\\aemph{\\%s{%s}}\\arb{", tag, body) end) + -- Arbmark + str = string.gsub(str, "\\(arbmark.-)(%b{})", + function(tag, body) + body = string.sub(body, 2, -2) + return string.format("}\\%s{%s}\\arb{", tag, body) + end) return str end @@ -665,8 +671,8 @@ function processtrans(str, mode, rules, scheme) return str end -function processarbmarks(str, mode) - if mode == "trans" then +function processarbmarks(str) + if tex.textdir == "TLT" then for i = 1,#arbmarks do str = string.gsub(str, arbmarks[i].a, arbmarks[i].c) end diff --git a/arabluatex_voc.lua b/arabluatex_voc.lua index b27efdc..abd8ee8 100644 --- a/arabluatex_voc.lua +++ b/arabluatex_voc.lua @@ -23,7 +23,7 @@ along with this program. If not, see --]] arbmarks = { - {a="bismillah", b="﷽", c="\\arb{bi-ismi \\uc{'l-l_ahi} 'l-ra.hm_ani 'l-ra.hImi}"} + {a="bismillah", b="﷽", c="\\arb[trans]{bi-ismi \\uc{'l-l_ahi} 'l-ra.hm_ani 'l-ra.hImi}"} } abjad = { -- cgit v1.2.3