From 24ee8b967d423d9aeebd31fd9c4f9486ee3584fb Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 5 Nov 2018 16:58:45 +0100 Subject: better exporting of transliterated Arabic --- arabluatex.dtx | 25 +++++++++++++++---------- arabluatex.lua | 28 ++++++++++++++-------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index 854fd98..5ccf530 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -261,7 +261,7 @@ % % \fi % -% \CheckSum{899} +% \CheckSum{0} % % \CharacterTable % {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 @@ -4643,7 +4643,7 @@ wa-ya.sIru ta.hta 'l-jild-i \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@trans% - \bgroup\textdir TLT\al@trans@style% + \bgroup\textdir TLT\al@trans@font\al@trans@style% \luadirect{tex.sprint(processtrans(\luastringN{#2}, \luastringO{\al@trans@convention}, \luastringO{\al@arb@rules}, @@ -4707,7 +4707,7 @@ wa-ya.sIru ta.hta 'l-jild-i \luastringO{\al@arb@rules}, \luastringO{\al@input@scheme}))}\egroup% \else% \ifx\@tempa\al@mode@trans% - \bgroup\pardir TLT\textdir TLT\al@trans@style% + \bgroup\pardir TLT\textdir TLT\al@trans@font\al@trans@style% \luadirect{tex.sprint(processtrans(\luastringO{\BODY}, \luastringO{\al@trans@convention}, \luastringO{\al@arb@rules}, @@ -4748,18 +4748,23 @@ wa-ya.sIru ta.hta 'l-jild-i metre]{#1}% \if@pkg@export\ifal@verse@export% \ArbOutFile{\begin{arabverse}}% - \ifx\al@mode\al@mode@trans% - \luadirect{tooutfile(\luastringN{[#1]})}% - \else% + % \ifx\al@mode\al@mode@trans% + % \luadirect{tooutfile(\luastringN{[#1]})}% + % \else% \IfSubStr[1]{#1}{utf}% {\luadirect{tooutfile(\luastringN{[#1]})}}% {\luadirect{tooutfile(\luastringN{[#1, utf]})}}% - \fi + % \fi \else\fi\else\fi\egroup% \par\centering\noindent\bgroup\setkeys[al]{verse}[metre]{#1}% - \ifx\al@mode\al@mode@trans% - \ifal@verse@utf\setRL\else\setLR\fi% - \else\setRL\fi% + % \ifx\al@mode\al@mode@trans% + % \ifal@verse@utf\setRL\else\setLR\fi% + % \else\setRL\fi% + \ifal@verse@utf% + \ifx\al@mode\al@mode@trans\setLR\else\setRL\fi% + \else% + \ifx\al@mode\al@mode@trans\setLR\else\setRL\fi% + \fi% \arab@v@export{#1} }% {\endarab@v@export diff --git a/arabluatex.lua b/arabluatex.lua index 09c1acb..2c8dc77 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -487,7 +487,7 @@ local function novoc(str) inside = indnum(inside) return string.format("\\arabicfont{}%s", inside) end) -return str + return str end local function novoceasy(str) @@ -523,7 +523,7 @@ local function novoceasy(str) inside = indnum(inside) return string.format("\\arabicfont{}%s", inside) end) -return str + return str end local function transdmg(str, rules) @@ -561,9 +561,9 @@ local function transdmg(str, rules) for i = 1,#nulltr do inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) end - return string.format("\\txtrans{%s}", inside) + return string.format("%s", inside) end) -return str + return str end local function transloc(str) @@ -599,9 +599,9 @@ local function transloc(str) for i = 1,#nulltr do inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) end - return string.format("\\txtrans{%s}", inside) + return string.format("%s", inside) end) -return str + return str end local function transarabica(str) @@ -634,9 +634,9 @@ local function transarabica(str) for i = 1,#nulltr do inside = string.gsub(inside, nulltr[i].a, nulltr[i].b) end - return string.format("\\txtrans{%s}", inside) + return string.format("%s", inside) end) -return str + return str end local function processbuckw(str) @@ -647,7 +647,7 @@ local function processbuckw(str) end return string.format("\\arb{%s}", inside) end) -return str + return str end -- The following functions produce a copy of the original .tex source @@ -985,10 +985,10 @@ function processtrans(str, mode, rules, scheme) end str = unprotectarb(str) if export_utf == "yes" then - tofile = str + tofile = "\\txtrans{"..str.."}" tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = str + tofile = "\\txtrans{"..str.."}" tooutfile(tofile) else return str @@ -1100,13 +1100,13 @@ function uc(str) str = string.gsub(str, "(%s[%(%<%[]?)"..lcuc[i].a, "%1"..lcuc[i].b) end if export_utf == "yes" then - tofile = "\\txtrans{"..str.."}" + tofile = str tooutfile(tofile) elseif export_utf == "arabverse" then - tofile = "\\txtrans{"..str.."}" + tofile = str tooutfile(tofile) else - return "\\txtrans{"..str.."}" + return str end return "" end -- cgit v1.2.3