aboutsummaryrefslogtreecommitdiff
path: root/ekdosis.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'ekdosis.dtx')
-rw-r--r--ekdosis.dtx23
1 files changed, 18 insertions, 5 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 5c142e2..5ec9df1 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -1874,12 +1874,25 @@ local function close_divs_at_end(str)
1874end 1874end
1875 1875
1876local function close_divs_in_between(str) 1876local function close_divs_in_between(str)
1877 for i = 0, 9 1877 for ndivi = 0, 9
1878 do 1878 do
1879 str = string.gsub(str, "(<div"..i..".->)(.-)(<div"..i..".->)", function(divi, between, divii) 1879 str = string.gsub(str, "(<div)("..ndivi..")(.->)(.-)(<div)(%d)(.->)",
1880 between = close_divs_in_between(between) 1880 function(bdivi, ndivi, edivi, between, bdivii, ndivii, edivii)
1881 return string.format("%s%s</div%s>%s", divi, between, i, divii) 1881 firstdiv = tonumber(ndivi)
1882 end) 1882 lastdiv = tonumber(ndivii)
1883 local closedivs = ""
1884 if firstdiv >= lastdiv
1885 then
1886 while firstdiv >= lastdiv
1887 do
1888 closedivs = closedivs.."</div"..firstdiv..">"
1889 firstdiv = firstdiv - 1
1890 end
1891 end
1892 return string.format("%s%s%s%s%s%s%s%s",
1893 bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii)
1894
1895 end)
1883 end 1896 end
1884 return str 1897 return str
1885end 1898end