aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2018-05-28 13:57:58 +0200
committerRobert Alessi <alessi@robertalessi.net>2018-05-28 13:57:58 +0200
commit3f1f2d11ce0b89e7084905c4a0111b7d84455a60 (patch)
treefd8cbcb81c5af97e027b2011a5ef7a80a0ab4f77
parent9db04636dc0a1c4cd0dff49e1c48a1612a8233e8 (diff)
downloadarabluatex-3f1f2d11ce0b89e7084905c4a0111b7d84455a60.tar.gz
tightened some Pegs
-rw-r--r--arabluatex.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 3e7dd96..b99fbca 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -81,7 +81,7 @@ local bsqbrackets = lpeg.Cs{ "[" * ((1 - lpeg.S"[]") + lpeg.V(1))^0 * "]" }
81local bcbraces = lpeg.Cs{ "{" * ((1 - lpeg.S"{}") + lpeg.V(1))^0 * "}" } 81local bcbraces = lpeg.Cs{ "{" * ((1 - lpeg.S"{}") + lpeg.V(1))^0 * "}" }
82local spce = lpeg.P(" ") 82local spce = lpeg.P(" ")
83local bsqbracketsii = lpeg.Cs(bsqbrackets^-2) 83local bsqbracketsii = lpeg.Cs(bsqbrackets^-2)
84local bcbracesii = lpeg.Cs(spce^-1 * bcbraces * spce^-1 * bcbraces^-1) 84local bcbracesii = lpeg.Cs(bcbraces * bcbraces^-1)
85 85
86local function breakcmd(str) 86local function breakcmd(str)
87 for i = 1,#albrkcmds do 87 for i = 1,#albrkcmds do
@@ -95,7 +95,7 @@ local function breakcmd(str)
95 str = gsub(str, dblbkslash * lpeg.Cs(brkcmds[i]) * spce^-1 * bsqbracketsii * bcbracesii, "}%1%2%3%4\\arb{") 95 str = gsub(str, dblbkslash * lpeg.Cs(brkcmds[i]) * spce^-1 * bsqbracketsii * bcbracesii, "}%1%2%3%4\\arb{")
96 end 96 end
97 end 97 end
98 -- process \item[], then \item[] 98 -- process \item[], then \item
99 str = string.gsub(str, "\\(item.?)(%b[])", 99 str = string.gsub(str, "\\(item.?)(%b[])",
100 function(tag, body) 100 function(tag, body)
101 body = string.sub(body, 2, -2) 101 body = string.sub(body, 2, -2)