From 6efb1bccc1c98f55af0d2579dae22e643e80e1c1 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 15 Mar 2021 09:52:25 +0100
Subject: versetotei(): move first gsubs(str) as arg(str)

---
 ekdosis.dtx | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index bd95000..bb02250 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -3673,7 +3673,7 @@ argument of the
   It is an ancient Mariner,\\
   And he stoppeth one of three.\\
   ‘By thy long grey beard and glittering eye,\\
-  Now wherefore stopp'st thou me?\\[\parskip]
+  Now wherefore stopp'st thou me?\\[2ex]
   %
   The Bridegroom's doors are opened wide,\\
   And I am next of kin;\\
@@ -3685,6 +3685,10 @@ argument of the
 %</example>
 % \fi
 %
+% As can be seen, stanzas are visually separated from one another by
+% an additional vertical space of \unit[2]{ex} (l.~5), while the
+% subsequent line is rendered inert.
+%
 % \begingroup
 % \setcolumnwidth{0.6\textwidth}
 % \setlength{\leftmargini}{0em}
@@ -9022,11 +9026,11 @@ end
 
 -- better use lpeg: look into this later
 local function versetotei(str)
-   str = string.gsub(str, "\\begin%s?%{patverse%}", "")
-   str = string.gsub(str, "\\end%s?%{patverse%}", "")
-   str = string.gsub(str, "\\indentpattern%s?%b{}", "")
    str = string.gsub(str, "\\begin%s?%{ekdverse%}(%b[])(.-)\\end%s?%{ekdverse%}", function(opt, arg)
 			arg = string.gsub(arg, "\\par%s?", "")
+			arg = string.gsub(arg, "\\begin%s?%{patverse%}", "")
+			arg = string.gsub(arg, "\\end%s?%{patverse%}", "")
+			arg = string.gsub(arg, "\\indentpattern%s?%b{}", "")
 			opt = string.sub(opt, 2, -2)
 			teitype = get_attr_value(opt, "type")
 			if teitype ~= "" then teitype = " type=\""..teitype.."\"" else end
-- 
cgit v1.2.3

