Skip to content

Commit

Permalink
append incrementing number to header id
Browse files Browse the repository at this point in the history
  • Loading branch information
snscltt committed Jun 30, 2015
1 parent d071dcb commit 990414e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ahrf.awk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BEGIN { FS = "\n"; RS = "" }
gsub(/ +/,"-",anc)
# length($0) would also work
if (cnt <= 6 && $0 != "") {
printf("<h%d id=\"%s\">%s</h%d>\n", cnt, anc, $0, cnt)
printf("<h%d id=\"%s-%s\">%s</h%d>\n", cnt, anc, n_id++, $0, cnt)

This comment has been minimized.

Copy link
@Ypnose

Ypnose Sep 2, 2015

Your n_id is not initialized. You should do it in BEGIN for better readability and correctness.

This comment has been minimized.

Copy link
@alexh-name

alexh-name Sep 3, 2015

Of course, thanks. See 0cf9574.

}
next
}
Expand Down

0 comments on commit 990414e

Please sign in to comment.