aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx1
-rw-r--r--arabluatex.lua13
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.
2811% 'a`\arbcolor[red]{^g}.aba-ka}. 2811% 'a`\arbcolor[red]{^g}.aba-ka}.
2812% 2812%
2813% |i^staraytu-hu| |bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN}| 2813% |i^staraytu-hu| |bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN}|
2814% \allowbreak
2814% |'a`\arbcolor[red]|\allowbreak|{^g}\arbcolor[blue]{.a}ba-ka| 2815% |'a`\arbcolor[red]|\allowbreak|{^g}\arbcolor[blue]{.a}ba-ka|
2815% \arb{i^staraytu-hu bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN} 2816% \arb{i^staraytu-hu bi-_tama\arbcolor[red]{n}\arbcolor[blue]{iN}
2816% 'a`\arbcolor[red]{^g}\arbcolor[blue]{.a}ba-ka} \linebreak 2817% '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("*"))
49local bsqbracketsii = lpeg.Cs(bsqbrackets^-2) 49local bsqbracketsii = lpeg.Cs(bsqbrackets^-2)
50local bcbracesii = lpeg.Cs(bcbraces^-2) 50local bcbracesii = lpeg.Cs(bcbraces^-2)
51local cmd = lpeg.Cs(dblbkslash * ascii^1 * cmdstar^-1) 51local cmd = lpeg.Cs(dblbkslash * ascii^1 * cmdstar^-1)
52local rawcmd = lpeg.Cs(dblbkslash * ascii^1)
53local aftercmd = lpeg.Cs(lpeg.S("*[{,.?;:'`\"") + dblbkslash)
52local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) 54local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1)
53local arbargs = lpeg.Cs(spce^-1 * bsqbrackets^-1 * bcbraces) 55local arbargs = lpeg.Cs(spce^-1 * bsqbrackets^-1 * bcbraces)
54local baytargs = lpeg.Cs(spce * bcbraces * bsqbrackets^-1 * bcbraces) 56local baytargs = lpeg.Cs(spce * bcbraces * bsqbrackets^-1 * bcbraces)
@@ -823,15 +825,6 @@ function tooutfile(str, nl)
823 return str 825 return str
824end 826end
825 827
826local function removespaceaftercmd(str)
827 str = gsub(str, cmd * spce^1 * bsqbracketsii * bcbraces, function(cmd, space, brackets, braces)
828 braces = string.sub(braces, 2, -2)
829 braces = removespaceaftercmd(braces)
830 return string.format("%s%s{%s}", cmd, brackets, braces)
831 end)
832 return str
833end
834
835function al_closestream() 828function al_closestream()
836 local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r") 829 local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r")
837 local o = io.open(tex.jobname..utffilesuffix..".tex", "w") 830 local o = io.open(tex.jobname..utffilesuffix..".tex", "w")
@@ -879,7 +872,7 @@ function al_closestream()
879 [[ and compile it one more time}}]]) 872 [[ and compile it one more time}}]])
880 -- 873 --
881 else end 874 else end
882 t = removespaceaftercmd(t) 875 t = gsub(t, rawcmd * spce^1 * aftercmd, "%1%3")
883 t = t.."\n\\end{document}" 876 t = t.."\n\\end{document}"
884 io.write(t) 877 io.write(t)
885 o:write(t) 878 o:write(t)