From 5243297448992d442c3ad388a16b6cb44d83a4fc Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sun, 13 May 2018 10:10:44 +0200
Subject: accept any command that is not \arb{} and has an optional argument

---
 arabluatex.lua | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arabluatex.lua b/arabluatex.lua
index 5e88b96..b2c651c 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -130,6 +130,13 @@ local function breakcmd(str)
 	body = string.sub(body, 2, -2)
 	return string.format("}\\%s{%s}\\arb{", tag, body)
 	end)
+   -- any command that is not \arb{} and has an optional argument
+   str = string.gsub(str, "\\([^a][^r][^b].-)(%b[])(%b{})",
+    function(tag, opt, body)
+    opt = string.sub(opt, 2, -2)
+    body = string.sub(body, 2, -2)
+    return string.format("}\\%s[%s]{\\arb{%s}}\\arb{", tag, opt, body)
+   end)
    return str
 end
 
-- 
cgit v1.2.3