diff options
author | EuAndreh <eu@euandre.org> | 2025-04-17 16:01:37 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-17 16:01:37 -0300 |
commit | fab32a816259c943802ffa4c041ac63ac34e646a (patch) | |
tree | 28df038ce2c996499a000da5618ddc6946bc5d05 | |
parent | src/adoc(fix_footnotes()): Add <p> to <li> content (diff) | |
download | adoc-fab32a816259c943802ffa4c041ac63ac34e646a.tar.gz adoc-fab32a816259c943802ffa4c041ac63ac34e646a.tar.xz |
src/adoc(fix_footnotes()): Fix emission of </ol> tag
-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 } ' } |