aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2020-06-10 08:08:58 +0200
committerRobert Alessi <alessi@robertalessi.net>2020-06-10 08:08:58 +0200
commit66a3577bf279ef34458035d41f8727b6f58cf95d (patch)
tree66106a2b1b27dae7127e9f87460edd1f18e98b98
parent21ee508d93ad4ca79dfda63ab027780fb8d80c69 (diff)
downloadekdosis-66a3577bf279ef34458035d41f8727b6f58cf95d.tar.gz
sort texpatttotags table. envtotei(): handle up to two optional arguments between square brackets
-rw-r--r--ekdosis.dtx10
1 files changed, 7 insertions, 3 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx
index 3c0de48..6f77144 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -136,6 +136,9 @@ Running "make install" installs the files in the local TeX tree.
136%<*driver> 136%<*driver>
137\documentclass{ltxdoc} 137\documentclass{ltxdoc}
138\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} 138\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
139\usepackage{dox}
140\doxitem{Option}{option}{options}
141\usepackage{microtype}
139\usepackage{fontspec} 142\usepackage{fontspec}
140\usepackage[english]{babel} 143\usepackage[english]{babel}
141\babelfont{rm}{Old Standard} 144\babelfont{rm}{Old Standard}
@@ -1538,6 +1541,7 @@ function ekdosis.newpatttotag(pat, repl)
1538 pat = string.gsub(pat, "%#[1-9]", "(.-)") 1541 pat = string.gsub(pat, "%#[1-9]", "(.-)")
1539 repl = string.gsub(repl, "%#([1-9])", "%%%1") 1542 repl = string.gsub(repl, "%#([1-9])", "%%%1")
1540 table.insert(texpatttotags, { a = pat, b = repl }) 1543 table.insert(texpatttotags, { a = pat, b = repl })
1544 table.sort(texpatttotags, function(a ,b) return(#a.a > #b.a) end)
1541 return true 1545 return true
1542end 1546end
1543 1547
@@ -1711,7 +1715,7 @@ local function envtotei(str)
1711 then 1715 then
1712 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{") 1716 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
1713 * lpeg.Cs(envtotags[i].a) * lpeg.P("}") 1717 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
1714 * bcbracesii * spcenc^-1, 1718 * bsqbracketsii * bcbracesii * spcenc^-1,
1715 "\\p@rb <"..envtotags[i].b..envtotags[i].c..">") 1719 "\\p@rb <"..envtotags[i].b..envtotags[i].c..">")
1716 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{") 1720 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
1717 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"), 1721 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),
@@ -1719,7 +1723,7 @@ local function envtotei(str)
1719 else 1723 else
1720 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{") 1724 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
1721 * lpeg.Cs(envtotags[i].a) * lpeg.P("}") 1725 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
1722 * bcbracesii * spcenc^-1, 1726 * bsqbracketsii * bcbracesii * spcenc^-1,
1723 "<"..envtotags[i].b..envtotags[i].c..">") 1727 "<"..envtotags[i].b..envtotags[i].c..">")
1724 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{") 1728 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
1725 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"), 1729 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),
@@ -1728,7 +1732,7 @@ local function envtotei(str)
1728 else 1732 else
1729 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{") 1733 str = gsub(str, lpeg.P("\\begin") * spcenc^-1 * lpeg.P("{")
1730 * lpeg.Cs(envtotags[i].a) * lpeg.P("}") 1734 * lpeg.Cs(envtotags[i].a) * lpeg.P("}")
1731 * bcbracesii * spcenc^-1, 1735 * bsqbracketsii * bcbracesii * spcenc^-1,
1732 "") 1736 "")
1733 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{") 1737 str = gsub(str, spcenc^-1 * lpeg.P("\\end") * spcenc^-1 * lpeg.P("{")
1734 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"), 1738 * lpeg.Cs(envtotags[i].a) * lpeg.P("}"),