summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-24 21:12:01 +0000
committerKarl Berry <karl@freefriends.org>2019-03-24 21:12:01 +0000
commit78db05a5b839a72cb42fced13a31ff781776001a (patch)
tree3499f8472f405fbf52a04e5b3f63750729391d1a /Master/texmf-dist/tex/lualatex
parent6973e20e83544bed3652e7b57886f39a8ab60e23 (diff)
arabluatex (24mar19)
git-svn-id: svn://tug.org/texlive/trunk@50571 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua64
-rw-r--r--Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty126
2 files changed, 102 insertions, 88 deletions
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
index 9d8343810f6..df031569c01 100644
--- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
+++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.lua
@@ -22,6 +22,8 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
--]]
+arabluatex = {}
+
require("arabluatex_voc")
require("arabluatex_fullvoc")
require("arabluatex_novoc")
@@ -95,7 +97,7 @@ local albrkcmds = {
}
local brkcmds = {}
-function mkarbbreak(str, opt)
+function arabluatex.mkarbbreak(str, opt)
str = str ..","
str = string.gsub(str, "%s+", "")
local fieldstart = 1
@@ -659,17 +661,17 @@ end
local utffilesuffix = "_out"
local export_utf = "no"
-function al_utffilesuffix(str)
+function arabluatex.utffilesuffix(str)
utffilesuffix = str
return true
end
-function al_doexport(str)
+function arabluatex.doexport(str)
export_utf = str
return true
end
-function al_openstream()
+function arabluatex.openstream()
local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "a+")
local preamble = io.open(tex.jobname..".tex", "r")
for line in preamble:lines() do
@@ -706,7 +708,7 @@ local function processarbtoutf(str)
body = string.gsub(body, "(\\abjad%s?)(%b{})", function(btag, bbody)
bbody = string.sub(bbody, 2, -2)
if tonumber(bbody) ~= nil then
- bbody = abjadify(bbody)
+ bbody = arabluatex.abjadify(bbody)
return string.format("\\oline*{\\arb[novoc]{%s}}", bbody)
else
return string.format("%s{%s}", btag, bbody)
@@ -793,7 +795,7 @@ local function processarbtoutf(str)
return str
end
-function arbtoutf(str)
+function arabluatex.arbtoutf(str)
str = processarbtoutf(str)
str = "\\ArbOutFile{"..str.."}"
str = string.gsub(str, "(\\ArbOutFile)%s?(%b{})", function(tag, body)
@@ -814,7 +816,7 @@ function arbtoutf(str)
return str
end
-function tooutfile(str, nl)
+function arabluatex.tooutfile(str, nl)
local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "a+")
if nl == "newline" then
f:write(str, "\n\n")
@@ -825,7 +827,7 @@ function tooutfile(str, nl)
return str
end
-function al_closestream()
+function arabluatex.closestream()
local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r")
local o = io.open(tex.jobname..utffilesuffix..".tex", "w")
local t = f:read("*a")
@@ -883,7 +885,7 @@ function al_closestream()
end
-- Process standard arabluatex modes:
-function processvoc(str, rules, scheme)
+function arabluatex.processvoc(str, rules, scheme)
str = takeoutarb(str)
str = processarbnull(str, scheme)
str = takeoutcapetc(str)
@@ -901,17 +903,17 @@ function processvoc(str, rules, scheme)
str = unprotectarb(str)
if export_utf == "yes" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
return ""
end
-function processfullvoc(str, rules, scheme)
+function arabluatex.processfullvoc(str, rules, scheme)
str = takeoutarb(str)
str = processarbnull(str, scheme)
str = takeoutcapetc(str)
@@ -931,17 +933,17 @@ function processfullvoc(str, rules, scheme)
str = unprotectarb(str)
if export_utf == "yes" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
return ""
end
-function processnovoc(str, rules, scheme)
+function arabluatex.processnovoc(str, rules, scheme)
str = takeoutarb(str)
str = processarbnull(str, scheme)
str = takeoutcapetc(str)
@@ -959,17 +961,17 @@ function processnovoc(str, rules, scheme)
str = unprotectarb(str)
if export_utf == "yes" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = "\\txarb{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
return ""
end
-function processtrans(str, mode, rules, scheme)
+function arabluatex.processtrans(str, mode, rules, scheme)
str = takeoutarb(str)
str = processdiscretionary(str)
str = processarbnull(str, scheme)
@@ -990,17 +992,17 @@ function processtrans(str, mode, rules, scheme)
str = unprotectarb(str)
if export_utf == "yes" then
tofile = "\\txtrans{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = "\\txtrans{"..str.."}"
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
return ""
end
-function newarbmark(abbr, rtlmk, ltrmk)
+function arabluatex.newarbmark(abbr, rtlmk, ltrmk)
abbr = "@"..abbr
rtlmk = "\\arabicfont{}"..rtlmk
table.insert(arbmarks, {a = abbr, b = rtlmk, c = ltrmk})
@@ -1017,7 +1019,7 @@ local function isintable(table, element)
return false
end
-function processarbmarks(str, dir)
+function arabluatex.processarbmarks(str, dir)
str = "@"..str
if not isintable(arbmarks, str) then
str = "\\LR{<??>}"..atletter.."\\al@wrong@mark{}"..atother
@@ -1042,17 +1044,17 @@ function processarbmarks(str, dir)
end
if export_utf == "yes" then
tofile = str
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = str
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
return ""
end
-function uc(str)
+function arabluatex.uc(str)
str = string.gsub(str, "(\\txtrans.?)(%b{})", function(tag, body)
body = string.sub(body, 2, -2)
return string.format("%s", body)
@@ -1113,10 +1115,10 @@ function uc(str)
str = string.gsub(str, "\\@al@cb", "}")
if export_utf == "yes" then
tofile = str
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
elseif export_utf == "arabverse" then
tofile = str
- tooutfile(tofile)
+ arabluatex.tooutfile(tofile)
else
return str
end
@@ -1126,7 +1128,7 @@ end
-- this function is adapted from an 'obsolete project' of Khaled
-- Hosny's that dates back to 2010. Thanks to him.
-- See https://github.com/khaledhosny/lualatex-arabic
-function abjadify(n)
+function arabluatex.abjadify(n)
local abjadnum = ""
n = tonumber(n)
if n >= 1000 then
@@ -1149,7 +1151,7 @@ function abjadify(n)
return "\\arb[novoc]{"..abjadnum.."}"
end
-function abraces(str)
+function arabluatex.abraces(str)
if tex.textdir == "TRT" then
str = "\\}"..str.."\\{"
elseif tex.textdir == "TLT" then
@@ -1158,7 +1160,7 @@ function abraces(str)
return str
end
-function aemph(str, opt)
+function arabluatex.aemph(str, opt)
if tex.textdir == "TRT" then
str = "\\oline{\\textdir TRT{}"..str.."}"
elseif tex.textdir == "TLT" then
@@ -1171,7 +1173,7 @@ function aemph(str, opt)
return str
end
-function ayah(str)
+function arabluatex.ayah(str)
if tonumber(str) ~= nil and str.len(str) < 4 then
if tex.textdir == "TRT" then
str = indnum(str).."^^^^06dd"
diff --git a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty
index ebe1ff2a831..f5d9d08fbe6 100644
--- a/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty
+++ b/Master/texmf-dist/tex/lualatex/arabluatex/arabluatex.sty
@@ -41,7 +41,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{arabluatex}
- [2019/03/22 v1.16 An ArabTeX-like interface for LuaLaTeX]
+ [2019/03/24 v1.17 An ArabTeX-like interface for LuaLaTeX]
\RequirePackage{ifluatex}
\ifluatex\else
\PackageError{arabluatex}{lualatex needed}{%
@@ -57,9 +57,9 @@
\DeclareOptionX{trans}{\def\al@mode{trans}}
\define@boolkey{arabluatex.sty}[@pkg@]{export}[true]{%
\if@pkg@export%
- \AtBeginDocument{\luadirect{al_openstream()}%
+ \AtBeginDocument{\luadirect{arabluatex.openstream()}%
\MkArbBreak{@al@ob,@al@cb,@al@cb@sp}}
- \AtEndDocument{\luadirect{al_closestream()}}
+ \AtEndDocument{\luadirect{arabluatex.closestream()}}
\else\fi}
\ExecuteOptionsX{voc}
\ProcessOptionsX\relax
@@ -74,7 +74,6 @@
\RequirePackage{fontspec}
\RequirePackage{luacode}
\RequirePackage{xparse}
-\RequirePackage{environ}
\RequirePackage{adjustbox}
\RequirePackage{xstring}
\PassOptionsToPackage{normalem}{ulem}
@@ -85,8 +84,10 @@
\PackageWarning{arabluatex}{\string\arabicfont\ is not defined.^^J
I will try to load Amiri}%
\newfontfamily\arabicfont[Script=Arabic]{Amiri}\fi}%
-\AtBeginDocument{\def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT}}
-\AtBeginDocument{\def\setLR{\boolfalse{al@rlmode}\pardir TLT\textdir TLT}}
+\AtBeginDocument{\def\setRL{\booltrue{al@rlmode}\pardir TRT%
+ \textdir TRT}}
+\AtBeginDocument{\def\setLR{\boolfalse{al@rlmode}\pardir TLT%
+ \textdir TLT}}
\AtBeginDocument{\ifdef{\LR}%
{\RenewDocumentCommand{\LR}{m}{\bgroup\textdir TLT\rmfamily#1\egroup}}
{\NewDocumentCommand{\LR}{m}{\bgroup\textdir TLT\rmfamily#1\egroup}}}
@@ -95,8 +96,8 @@
{\NewDocumentCommand{\RL}{m}{\bgroup\textdir TRT#1\rmfamily\egroup}}}
\NewDocumentCommand{\MkArbBreak}{s m}{%
\IfBooleanTF{#1}
- {\luadirect{mkarbbreak(\luastringN{#2}, "out")}}
- {\luadirect{mkarbbreak(\luastringN{#2}, "dflt")}}
+ {\luadirect{arabluatex.mkarbbreak(\luastringN{#2}, "out")}}
+ {\luadirect{arabluatex.mkarbbreak(\luastringN{#2}, "dflt")}}
}
\def\oline{\@ifstar\@oline\@@oline}
\def\@oline#1{\ensuremath{\overline{\mbox{#1}}}}
@@ -104,12 +105,16 @@
\AtBeginDocument{\ifdef{\aemph}%
{\RenewDocumentCommand{\aemph}{s m}{%
\IfBooleanTF{#1}{%
- \luadirect{tex.sprint(aemph(\luastringN{#2}, "over"))}}
- {\luadirect{tex.sprint(aemph(\luastringN{#2}, "dflt"))}}}}
+ \luadirect{tex.sprint(arabluatex.aemph(\luastringN{#2},
+ "over"))}}
+ {\luadirect{tex.sprint(arabluatex.aemph(\luastringN{#2},
+ "dflt"))}}}}
{\NewDocumentCommand{\aemph}{s m}{%
\IfBooleanTF{#1}{%
- \luadirect{tex.sprint(aemph(\luastringN{#2}, "over"))}}
- {\luadirect{tex.sprint(aemph(\luastringN{#2}, "dflt"))}}}}}
+ \luadirect{tex.sprint(arabluatex.aemph(\luastringN{#2},
+ "over"))}}
+ {\luadirect{tex.sprint(arabluatex.aemph(\luastringN{#2},
+ "dflt"))}}}}}
\NewDocumentCommand{\arbcolor}{o m}{%
\IfNoValueTF{#1}{#2}{\textcolor{#1}{#2}}}
\def\al@input@scheme{arabtex}
@@ -128,15 +133,17 @@
\def\al@trans@style{\itshape}%
\NewDocumentCommand{\SetTranslitStyle}{m}{\def\al@trans@style{#1}}
\def\al@trans@convention{dmg}
-\NewDocumentCommand{\SetTranslitConvention}{m}{\def\al@trans@convention{#1}}
-\NewDocumentCommand{\al@arbup@dflt}{m}{\textsuperscript{\thinspace#1}}%
+\NewDocumentCommand{\SetTranslitConvention}{m}{%
+ \def\al@trans@convention{#1}}
+\NewDocumentCommand{\al@arbup@dflt}{m}{\textsuperscript{#1}}%
\NewDocumentCommand{\al@arbup}{m}{\al@arbup@dflt{#1}}
\NewDocumentCommand{\arbup}{m}{\al@arbup{#1}}
\NewDocumentCommand{\ArbUpDflt}{}{\let\al@arbup=\al@arbup@dflt}
\NewDocumentCommand{\NoArbUp}{}{\RenewDocumentCommand{\al@arbup}{m}{##1}}
-\NewDocumentCommand{\SetArbUp}{m}{\RenewDocumentCommand{\al@arbup}{m}{#1}}
+\NewDocumentCommand{\SetArbUp}{m}{%
+ \RenewDocumentCommand{\al@arbup}{m}{#1}}
\NewDocumentCommand{\uc}{m}%
- {\luadirect{tex.sprint(uc(\luastringN{#1}))}}
+ {\luadirect{tex.sprint(arabluatex.uc(\luastringN{#1}))}}
\let\Uc\uc
\NewDocumentCommand{\prname}{s m}{%
\bgroup\SetTranslitStyle{\relax}%
@@ -153,22 +160,22 @@
{\edef\@tempa{#1}%
\ifx\@tempa\al@mode@voc%
\bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processvoc(\luastringN{#2},
+ \luadirect{tex.sprint(arabluatex.processvoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@fullvoc%
\bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processfullvoc(\luastringN{#2},
+ \luadirect{tex.sprint(arabluatex.processfullvoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@novoc%
\bgroup\booltrue{al@rlmode}\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processnovoc(\luastringN{#2},
+ \luadirect{tex.sprint(arabluatex.processnovoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@trans%
\bgroup\textdir TLT\al@trans@font\al@trans@style%
- \luadirect{tex.sprint(processtrans(\luastringN{#2},
+ \luadirect{tex.sprint(arabluatex.processtrans(\luastringN{#2},
\luastringO{\al@trans@convention},
\luastringO{\al@arb@rules},
\luastringO{\al@input@scheme}))}\egroup%
@@ -177,38 +184,39 @@
\NewDocumentCommand{\arbmark}{O{} m}{%
\bgroup%
\SetInputScheme{arabtex}%
- \luadirect{tex.sprint(processarbmarks(\luastringN{#2},
+ \luadirect{tex.sprint(arabluatex.processarbmarks(\luastringN{#2},
\luastringN{#1}))}%
\egroup}
\NewDocumentCommand{\newarbmark}{m m m}{%
- \luadirect{newarbmark(\luastringN{#1}, \luastringN{#2}, \luastringN{#3})}}
-\NewEnviron{arab}[1][\al@mode]%
+ \luadirect{arabluatex.newarbmark(\luastringN{#1}, \luastringN{#2},
+ \luastringN{#3})}}
+\NewDocumentEnvironment{arab}{O{\al@mode} +b}%
{\par\edef\@tempa{#1}%
\ifx\@tempa\al@mode@voc%
\booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processvoc(\luastringO{\BODY},
+ \luadirect{tex.sprint(arabluatex.processvoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@fullvoc%
\booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processfullvoc(\luastringO{\BODY},
+ \luadirect{tex.sprint(arabluatex.processfullvoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@novoc%
\booltrue{al@rlmode}%
\bgroup\pardir TRT\textdir TRT\arabicfont%
- \luadirect{tex.sprint(processnovoc(\luastringO{\BODY},
+ \luadirect{tex.sprint(arabluatex.processnovoc(\luastringN{#2},
\luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup%
\else%
\ifx\@tempa\al@mode@trans%
\bgroup\pardir TLT\textdir TLT\al@trans@font\al@trans@style%
- \luadirect{tex.sprint(processtrans(\luastringO{\BODY},
+ \luadirect{tex.sprint(arabluatex.processtrans(\luastringN{#2},
\luastringO{\al@trans@convention},
\luastringO{\al@arb@rules},
\luastringO{\al@input@scheme}))}\egroup%
- \else \fi\fi\fi\fi}[\par]
+ \else \fi\fi\fi\fi}{\par}
\newlength{\al@bayt@width}
\newlength{\al@gutter@width}
\setlength{\al@bayt@width}{.3\textwidth}
@@ -230,11 +238,11 @@
\if@pkg@export\ifal@verse@export%
\ArbOutFile{\begin{arabverse}}%
% \ifx\al@mode\al@mode@trans%
- % \luadirect{tooutfile(\luastringN{[#1]})}%
+ % \luadirect{arabluatex.tooutfile(\luastringN{[#1]})}%
% \else%
\IfSubStr[1]{#1}{utf}%
- {\luadirect{tooutfile(\luastringN{[#1]})}}%
- {\luadirect{tooutfile(\luastringN{[#1, utf]})}}%
+ {\luadirect{arabluatex.tooutfile(\luastringN{[#1]})}}%
+ {\luadirect{arabluatex.tooutfile(\luastringN{[#1, utf]})}}%
% \fi
\else\fi\else\fi\egroup%
\par\centering\noindent\bgroup\setkeys[al]{verse}[metre]{#1}%
@@ -246,7 +254,7 @@
\else%
\ifx\al@mode\al@mode@trans\setLR\else\setRL\fi%
\fi%
- \arab@v@export{#1}
+ \arab@v@export[#1]
}%
{\endarab@v@export
\hfill\setkeys[al]{verse}[width, gutter, color, utf, delim, mode,
@@ -293,19 +301,21 @@
\ifdefined\abjad%
\RenewDocumentCommand{\abjad}{m}%
{\ifbool{al@rlmode}%
- {\oline*{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
- {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
+ {\oline*{%
+ \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
+ {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
\else%
\NewDocumentCommand{\abjad}{m}%
{\ifbool{al@rlmode}%
- {\oline*{\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
- {\luadirect{tex.sprint(abjadify(\luastring{#1}))}}}
+ {\oline*{%
+ \luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
+ {\luadirect{tex.sprint(arabluatex.abjadify(\luastring{#1}))}}}
\fi}
\NewDocumentCommand{\ayah}{m}{%
- \luadirect{tex.sprint(ayah(\luastringN{#1}))}}
+ \luadirect{tex.sprint(arabluatex.ayah(\luastringN{#1}))}}
\NewDocumentCommand{\arbnull}{m}{\relax}
\NewDocumentCommand{\abraces}{+m}{%
- \luadirect{tex.sprint(abraces(\luastringN{#1}))}}
+ \luadirect{tex.sprint(arabluatex.abraces(\luastringN{#1}))}}
\DeclareDocumentCommand{\LRmarginpar}{o m}{%
\IfNoValueTF{#1}
{\marginpar{\textdir TLT #2}}
@@ -316,37 +326,39 @@
TRT\textdir TRT\footnote{#1}\egroup}
\NewDocumentCommand{\FixArbFtnmk}{}{%
\@ifpackageloaded{scrextend}%
- {\AtBeginDocument{\deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}%
+ {\AtBeginDocument{%
+ \deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}%
{\RequirePackage{scrextend}
- \AtBeginDocument{\deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}}
+ \AtBeginDocument{%
+ \deffootnote{2em}{1.6em}{\LR{\thefootnotemark}.\enskip}}}}
\NewDocumentCommand{\SetArbOutSuffix}{m}{
- \luadirect{al_utffilesuffix(\luastringN{#1})}}
+ \luadirect{arabluatex.utffilesuffix(\luastringN{#1})}}
\NewDocumentCommand{\ArbOutFile}{s O{no} +m}{%
\if@pkg@export%
\IfBooleanTF{#1}{%
- #3\luadirect{tooutfile(\luastringN{#3}, "#2")}}{%
- \luadirect{tooutfile(\luastringN{#3}, "#2")}}%
+ #3\luadirect{arabluatex.tooutfile(\luastringN{#3}, "#2")}}{%
+ \luadirect{arabluatex.tooutfile(\luastringN{#3}, "#2")}}%
\else\IfBooleanTF{#1}{#3}{}\fi}
-\NewEnviron{arabexport}{%
+\NewDocumentEnvironment{arabexport}{+b}{%
\if@pkg@export%
\par
- \BODY
- \luadirect{al_doexport("yes")}
- \luadirect{tex.sprint(arbtoutf(\luastringO{\BODY}))}
- \luadirect{al_doexport("no")}
- \else\par\BODY\fi
- }[\par]
-\NewEnviron{arab@v@export}[1]{%
+ #1
+ \luadirect{arabluatex.doexport("yes")}
+ \luadirect{tex.sprint(arabluatex.arbtoutf(\luastringN{#1}))}
+ \luadirect{arabluatex.doexport("no")}
+ \else\par#1\fi
+ }{\par}
+\NewDocumentEnvironment{arab@v@export}{O{} +b}{%
\setkeys[al]{verse}[width, gutter, color, utf, delim, mode,
metre]{#1}
\if@pkg@export\ifal@verse@export%
\par
- \BODY
- \luadirect{al_doexport("arabverse")}
- \luadirect{tex.sprint(arbtoutf(\luastringO{\BODY}))}
- \luadirect{al_doexport("no")}
- \else\par\BODY\fi\else\par\BODY\fi
-}[\par]
+ #2
+ \luadirect{arabluatex.doexport("arabverse")}
+ \luadirect{tex.sprint(arabluatex.arbtoutf(\luastringN{#2}))}
+ \luadirect{arabluatex.doexport("no")}
+ \else\par#2\fi\else\par#2\fi
+}{\par}
\NewDocumentCommand{\arbpardir}{}{%
\ifx\al@mode\al@mode@trans\setLR\else\setRL\fi}
\newcommand{\al@warning}[1]{\PackageWarning{arabluatex}{#1}}