From 7e5b8ff0ebd8a5fbe789ea5c80d0be1d3038ec5c Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 8 Sep 2022 14:36:46 +0200
Subject: teiexport: process TeX grouping inside braces

---
 ekdosis.dtx | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index a1c3bb0..fc39141 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -12051,6 +12051,29 @@ local function cmdtotei(str)
 			body = cmdtotei(body)
 			return string.format("<%s>%s</%s>", cmd, body, cmd)
    end)
+   str = string.gsub(str, "\\([%{%}])", function(brace)
+			if brace == "{"
+			then
+			   brace = "ekd@ob"
+			else
+			   brace = "ekd@cb"
+			end
+			return brace
+   end)
+   str = gsub(str, bcbraces, function(inbraces)
+		 inbraces = string.sub(inbraces, 2, -2)
+		 inbraces = cmdtotei(inbraces)
+		 return inbraces
+   end)
+   str = string.gsub(str, "ekd@([oc])b", function(oc)
+			if oc == "o"
+			then
+			   oc = "{"
+			else
+			   oc = "}"
+			end
+			return oc
+   end)
    str = string.gsub(str, "(%s)(%>)", "%2")
    return str
 end
-- 
cgit v1.2.3

