From 364e7a86bf391a4d382d1e6d21eaeef873c5bb55 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sat, 16 Feb 2019 20:02:27 +0100 Subject: [80d0376]: in the end, no recursion was needed --- arabluatex.dtx | 1 + arabluatex.lua | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index 6ec43b0..839d4a8 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -2811,6 +2811,7 @@ word that \cs{arbnull} is applied to. % 'a`\arbcolor[red]{^g}.aba-ka}. % % |i^staraytu-hu| |bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN}| +% \allowbreak % |'a`\arbcolor[red]|\allowbreak|{^g}\arbcolor[blue]{.a}ba-ka| % \arb{i^staraytu-hu bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN} % 'a`\arbcolor[red]{^g}\arbcolor[blue]{.a}ba-ka} \linebreak diff --git a/arabluatex.lua b/arabluatex.lua index 292c01c..9d83438 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -49,6 +49,8 @@ local cmdstar = lpeg.Cs(spce * lpeg.P("*")) local bsqbracketsii = lpeg.Cs(bsqbrackets^-2) local bcbracesii = lpeg.Cs(bcbraces^-2) local cmd = lpeg.Cs(dblbkslash * ascii^1 * cmdstar^-1) +local rawcmd = lpeg.Cs(dblbkslash * ascii^1) +local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash) local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) local arbargs = lpeg.Cs(spce^-1 * bsqbrackets^-1 * bcbraces) local baytargs = lpeg.Cs(spce * bcbraces * bsqbrackets^-1 * bcbraces) @@ -823,15 +825,6 @@ function tooutfile(str, nl) return str end -local function removespaceaftercmd(str) - str = gsub(str, cmd * spce^1 * bsqbracketsii * bcbraces, function(cmd, space, brackets, braces) - braces = string.sub(braces, 2, -2) - braces = removespaceaftercmd(braces) - return string.format("%s%s{%s}", cmd, brackets, braces) - end) - return str -end - function al_closestream() local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r") local o = io.open(tex.jobname..utffilesuffix..".tex", "w") @@ -879,7 +872,7 @@ function al_closestream() [[ and compile it one more time}}]]) -- else end - t = removespaceaftercmd(t) + t = gsub(t, rawcmd * spce^1 * aftercmd, "%1%3") t = t.."\n\\end{document}" io.write(t) o:write(t) -- cgit v1.2.3