From fab32a816259c943802ffa4c041ac63ac34e646a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Apr 2025 16:01:37 -0300 Subject: src/adoc(fix_footnotes()): Fix emission of tag --- src/adoc | 18 ++++++++---------- 1 file 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("",i id) newmiddle = sup a num "" printf "%s%s%s\n", before, newmiddle, after - next + prev = $0; next } /^
$/ { if (has_ol == 0) { print "
    " has_ol = 1 } - next + prev = $0; next } match($0, /^[0-9]+<\/a>/) { id = IDS[FNIDX++] @@ -85,16 +85,14 @@ fix_footnotes() { li = sprintf("
  1. ", id) a = sprintf("", id) print li content " " a "↩

  2. " - next + prev = $0; next } - has_ol == 1 && /^<\/div>$/ { - divcount++ - if (divcount == 2) { + has_ol == 1 && $0 == "
" { + if (prev == $0) { print "" - has_ol = 0 - divcount = 0 + has_ol = -1 } - next + prev = $0; next } in_footnotes == 0 && $0 == "
" { in_footnotes = 1 @@ -102,7 +100,7 @@ fix_footnotes() { in_footnotes == 1 && $0 == "
" { next } - { print } + { print; prev = $0 } ' } -- cgit v1.2.3