Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 2 insertions, 3 deletions
-rw-r--r--awk-edits/Heading-anchors.awk5
diff --git a/awk-edits/Heading-anchors.awk b/awk-edits/Heading-anchors.awk
index 56e522e..29c35fe 100644
--- a/awk-edits/Heading-anchors.awk
+++ b/awk-edits/Heading-anchors.awk
@@ -6,7 +6,6 @@
# hyperlink is required (except for h1).
/[ \t]*<h[23456]/ {
- id = substr($0, index($0, "id=\"") + 4)
- id = substr(id, 0, index(id, "\"") - 1)
- gsub(/$/, ORS "<a class=\"h-anchor\" href=\"#" id "\" aria-hidden=\"true\">\\&#x00A7;</a>")
+ match($0, /id="[^"]*"/);
+ $0 = $0 ORS "<a class=\"h-anchor\" href=\"#" substr($0, RSTART + 4, RLENGTH - 5) "\" aria-hidden=\"true\">&#x00A7;</a>";
}