summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-04-15 08:22:29 -0300
committerEuAndreh <eu@euandre.org>2025-04-15 08:22:29 -0300
commitba74f8bde87dada9ecb046a122529c551ddc3322 (patch)
tree5c8f152ec31bc510554394f7c9c3442bfd9d21ec
parentsrc/adoc: Rewrite as a pipeline with cat(1) at the start (diff)
downloadadoc-ba74f8bde87dada9ecb046a122529c551ddc3322.tar.gz
adoc-ba74f8bde87dada9ecb046a122529c551ddc3322.tar.xz
src/adoc: Add `fix_header_anchor_position()` stage
-rwxr-xr-xsrc/adoc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/adoc b/src/adoc
index bb47807..468b3aa 100755
--- a/src/adoc
+++ b/src/adoc
@@ -46,6 +46,10 @@ plaintext_links() {
}'
}
+fix_header_anchor_position() {
+ sed 's|^\(<h2 .*\)\(<a .*</a>\)\(.*\)\(</h2>\)$|\1\3\2\4|'
+}
+
runtidy() {
statusconv 1:0 tidy \
-quiet \
@@ -65,6 +69,7 @@ indent_4_blocks() {
}
cat "$FILENAME" |
- plaintext_links |
- asciidoctor -s - |
+ plaintext_links |
+ asciidoctor -s - |
+ fix_header_anchor_position |
indent_4_blocks