diff options
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r-- | ekdosis.dtx | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index 9978cd0..16c332e 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -1545,17 +1545,17 @@ function ekdosis.newenvtotag(env, tag, attr, closep) | |||
1545 | -- "Please pick another environment name.}}") | 1545 | -- "Please pick another environment name.}}") |
1546 | local index = get_a_index(env, envtotags) | 1546 | local index = get_a_index(env, envtotags) |
1547 | table.remove(envtotags, index) | 1547 | table.remove(envtotags, index) |
1548 | table.insert(envtotags, {a = env, b = tag, c = " "..attr}) | 1548 | table.insert(envtotags, {a = env, b = tag, c = " "..attr, d = closep}) |
1549 | table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end) | 1549 | table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end) |
1550 | if closep == "yes" then | 1550 | -- if closep == "yes" then |
1551 | table.insert(close_p, tag) | 1551 | -- table.insert(close_p, tag) |
1552 | else end | 1552 | -- else end |
1553 | else | 1553 | else |
1554 | table.insert(envtotags, {a = env, b = tag, c = " "..attr}) | 1554 | table.insert(envtotags, {a = env, b = tag, c = " "..attr, d = closep}) |
1555 | table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end) | 1555 | table.sort(envtotags, function(a ,b) return(#a.a > #b.a) end) |
1556 | if closep == "yes" then | 1556 | -- if closep == "yes" then |
1557 | table.insert(close_p, tag) | 1557 | -- table.insert(close_p, tag) |
1558 | else end | 1558 | -- else end |
1559 | end | 1559 | end |
1560 | return true | 1560 | return true |
1561 | end | 1561 | end |
@@ -1774,7 +1774,7 @@ local function envtotei(str) | |||
1774 | do | 1774 | do |
1775 | if envtotags[i].b ~= "" | 1775 | if envtotags[i].b ~= "" |
1776 | then | 1776 | then |
1777 | if isfound(close_p, envtotags[i].b) | 1777 | if isfound(close_p, envtotags[i].b) or envtotags[i].d == "yes" |
1778 | then | 1778 | then |
1779 | -- if envtotags[i].b == "p" | 1779 | -- if envtotags[i].b == "p" |
1780 | -- then | 1780 | -- then |
@@ -2154,7 +2154,16 @@ local function close_ndivs_at_end(str) | |||
2154 | end | 2154 | end |
2155 | 2155 | ||
2156 | local function close_ekddivs_in_between(str) | 2156 | local function close_ekddivs_in_between(str) |
2157 | for ndivi = 1, 7 | 2157 | local maxdepth = 1 |
2158 | for i in string.gmatch(str, "<div.-depth=\"(%d)\".->", "%1") | ||
2159 | do | ||
2160 | if tonumber(i) > tonumber(maxdepth) | ||
2161 | then | ||
2162 | maxdepth = i | ||
2163 | else | ||
2164 | end | ||
2165 | end | ||
2166 | for ndivi = 1, maxdepth | ||
2158 | do | 2167 | do |
2159 | str = string.gsub(str, "(<div .-depth%=\")("..ndivi..")(\".->)(.-)(<div .-depth%=\")(%d)(\".->)", | 2168 | str = string.gsub(str, "(<div .-depth%=\")("..ndivi..")(\".->)(.-)(<div .-depth%=\")(%d)(\".->)", |
2160 | function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) | 2169 | function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) |
@@ -2183,7 +2192,7 @@ local function close_ekddivs_in_between(str) | |||
2183 | end | 2192 | end |
2184 | 2193 | ||
2185 | local function close_ndivs_in_between(str) | 2194 | local function close_ndivs_in_between(str) |
2186 | for ndivi = 0, 6 | 2195 | for ndivi = 1, 6 |
2187 | do | 2196 | do |
2188 | str = string.gsub(str, "(<div)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", | 2197 | str = string.gsub(str, "(<div)("..ndivi..")(.->)(.-)(<div)([1-6])(.->)", |
2189 | function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) | 2198 | function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii) |