summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-17 16:01:37 -0300
committerEuAndreh <eu@euandre.org>2025-04-17 16:01:37 -0300
commitfab32a816259c943802ffa4c041ac63ac34e646a (patch)
tree28df038ce2c996499a000da5618ddc6946bc5d05
parentsrc/adoc(fix_footnotes()): Add <p> to <li> content (diff)
downloadadoc-fab32a816259c943802ffa4c041ac63ac34e646a.tar.gz
adoc-fab32a816259c943802ffa4c041ac63ac34e646a.tar.xz
src/adoc(fix_footnotes()): Fix emission of </ol> tag
-rwxr-xr-xsrc/adoc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/adoc b/src/adoc
index 58d08db..81ce7f1 100755
--- a/src/adoc
+++ b/src/adoc
@@ -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 }
'
}