diff options
Diffstat (limited to '')
-rwxr-xr-x | src/adoc | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -69,14 +69,14 @@ fix_footnotes() { a = sprintf("<a href=\"#fn:%s\" rel=\"footnote\">",i id) newmiddle = sup a num "</a></sup>" printf "%s%s%s\n", before, newmiddle, after - next + prev = $0; next } /^<div class="footnote" id="_footnotedef_[0-9]+">$/ { if (has_ol == 0) { print "<ol>" has_ol = 1 } - next + prev = $0; next } match($0, /^<a href="#_footnoteref_[0-9]+">[0-9]+<\/a>/) { id = IDS[FNIDX++] @@ -85,16 +85,14 @@ fix_footnotes() { li = sprintf("<li role=\"doc-endnote\" id=\"fn:%s\"><p>", id) a = sprintf("<a role=\"doc-backlink\" href=\"#ref:%s\">", id) print li content " " a "↩</a></p></li>" - next + prev = $0; next } - has_ol == 1 && /^<\/div>$/ { - divcount++ - if (divcount == 2) { + has_ol == 1 && $0 == "</div>" { + if (prev == $0) { print "</ol>" - has_ol = 0 - divcount = 0 + has_ol = -1 } - next + prev = $0; next } in_footnotes == 0 && $0 == "<div id=\"footnotes\">" { in_footnotes = 1 @@ -102,7 +100,7 @@ fix_footnotes() { in_footnotes == 1 && $0 == "<hr>" { next } - { print } + { print; prev = $0 } ' } |