From 0e618d97132539f0263d3c7183eabeb4f5824658 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Fri, 24 Aug 2018 09:41:39 +0200 Subject: al_closestream() gobbled spaces after opening braces. also removed nested \txarb --- arabluatex.dtx | 11 ++++++----- arabluatex.lua | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index a45b3bd..aa46115 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -4392,11 +4392,12 @@ wa-ya.sIru ta.hta 'l-jild-i % \end{macrocode} % \end{macro} % \begin{macro}{\arbmark} -% \changes{v1.11}{2018/03/31}{New command for inserting additional -% marks in Arabic environments} \cs{arbmark} takes one argument from a -% list of defined elements. This command is coded in -% Lua. \changes{v1.13}{2018/08/23}{New optional argument: either -% \texttt{rl} or \texttt{lr}} +% \changes{v1.11}{2018/03/31}{New command for inserting additional +% marks in Arabic environments} \cs{arbmark} takes one argument from +% a list of defined elements. \changes{v1.13}{2018/08/23}{New +% optional argument: either \texttt{rl} or \texttt{lr}} The mark to +% be inserted is determined by contextual analysis or by an +% optional argument, either |rl| or |lr|. This command is coded in Lua. % \begin{macrocode} \NewDocumentCommand{\arbmark}{O{} m}{% \bgroup% diff --git a/arabluatex.lua b/arabluatex.lua index 8bb9572..f717cb4 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -805,7 +805,7 @@ function al_closestream() local t = f:read("*a") t = string.gsub(t, "\\arabicfont{}", "") t = string.gsub(t, "\\par ", "\n\n") - t = string.gsub(t, "(\\@al@ob%s?)", "{") + t = string.gsub(t, "(\\@al@ob)", "{") t = string.gsub(t, "(\\@al@cb@sp)", "} ") t = string.gsub(t, "(\\@al@cb)(%s?)", "}") t = gsub(t, lpeg.Cs("\\begin") * spcenc^-1 * bcbraces * cmdargs, "\n%1%2%3\n") @@ -817,6 +817,7 @@ function al_closestream() t = string.gsub(t, "(\\end%s?)(%b{})", "%1%2\n") t = string.gsub(t, "([^\n]%s-)(\\end)%s?(%b{})", "%1\n%2%3") t = string.gsub(t, "\n\n\n", "\n\n") + t = string.gsub(t, "(\\txarb%s?%{)(\\txarb%s?%b{})(%})", "%2") if string.find(t, "\\begin%s?{document}.-\\arb%s?[%[%{]") or string.find(t, "\\begin%s?{document}.-\\[Uu]c%s?%b{}") then -- cgit v1.2.3