From e1867b5ce3e63c851c5ac35af781ff6f8149a5f0 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 11 Jun 2018 15:11:27 +0200 Subject: a bit of tidy up. put back \textcolor{}{}--which has to be deprecated in Arabic environments--in holdcmd() --- arabluatex.lua | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/arabluatex.lua b/arabluatex.lua index b8ef9df..c2608c3 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -84,7 +84,6 @@ local albrkcmds = { "Footnote", "Marginpar", "arbmark", - "textcolor", "abjad" } local brkcmds = {} @@ -119,37 +118,25 @@ local function breakcmd(str) end) str = string.gsub(str, "(\\item)(%s+)", "%1{}%2") -- \textcolor - -- str = string.gsub(str, "\\(textcolor%s?)(%b{})(%b{})", - -- function(tag, bodycolor, bodytext) - -- bodycolor = string.sub(bodycolor, 2, -2) - -- bodytext = string.sub(bodytext, 2, -2) - -- return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) - -- end) + str = string.gsub(str, "\\(textcolor%s?)(%b{})(%b{})", + function(tag, bodycolor, bodytext) + bodycolor = string.sub(bodycolor, 2, -2) + bodytext = string.sub(bodytext, 2, -2) + return string.format("\\al@brk{\\%s{%s}{\\arb{%s}}}", tag, bodycolor, bodytext) + end) + -- \arbcolor str = string.gsub(str, "(.)(\\arbcolor%s?)(%b[])(%b{})(.)", - function (li, tag, opt, body, lii) - li = string.gsub(li, "%+", "‍") -- ^^^^200d - lii = string.gsub(lii, "%+", "‍") -- ^^^^200d - body = string.sub(body, 2, -2) - body = string.gsub(body, "%+", "‍") -- ^^^^200d - return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii) + function (li, tag, opt, body, lii) + li = string.gsub(li, "%+", "‍") -- ^^^^200d + lii = string.gsub(lii, "%+", "‍") -- ^^^^200d + body = string.sub(body, 2, -2) + body = string.gsub(body, "%+", "‍") -- ^^^^200d + return string.format("%s%s%s{%s}%s", li, tag, opt, body, lii) end) - -- Abjad - -- str = string.gsub(str, "\\(abjad%s?)(%b{})", - -- function(tag, body) - -- body = string.sub(body, 2, -2) - -- return string.format("\\al@brk{\\%s{%s}}", tag, body) - -- end) ----[[ -- to be taken out of \arb{}, as LR/RL footnotes and the like: for i = 1,#outofarb do str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, "}%1%2%3\\arb{") - -- str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * spcenc^-1 * bcbraces, - -- function(prefix, tag, body) - -- body = string.sub(body, 2, -2) - -- return string.format("}%s%s{%s}\\arb{", prefix, tag, body) - -- end) end ---]] -- commands set by default in albrkcmds for i = 1,#albrkcmds do str = gsub(str, dblbkslash * lpeg.Cs(albrkcmds[i]) * cmdargs, "\\al@brk{%1%2%3}") @@ -246,19 +233,10 @@ local function takeoutarb(str) for i = 1,#outofarb do str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * cmdargs, function(prefix, tag, body) --- body = string.sub(body, 2, -2) body = gsub(body, lpeg.P("\\arb"), "\\@rb") return string.format("%s%s%s", prefix, tag, body) end) end - -- for i = 1,#outofarb do - -- str = gsub(str, dblbkslash * lpeg.Cs(outofarb[i]) * spcenc^-1 * bcbraces, - -- function(prefix, tag, body) - -- body = string.sub(body, 2, -2) - -- body = gsub(body, lpeg.P("\\arb"), "\\@rb") - -- return string.format("%s%s{%s}", prefix, tag, body) - -- end) - -- end str = string.gsub(str, "(\\arb%s?)(%b{})", function(tag, body) body = string.sub(body, 2, -2) return string.format("%s", body) -- cgit v1.2.3