Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits / Group-contents.awk
blob: d984eefa6e2a2dadd36bc90f2cb4192a0e1d8cea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# == About ==
# 
# This script surrounds the "Contents" heading, as well as the list itself, in a div wrapper element
# For it to work properly, the contents heading must be h2 and have it's id as "contents",
# and there must be a paragraph element after the item list

BEGIN {
	started = 0
}

/h2 id="contents"/ {
	print "<div id=\"contents-container\">"
	started = 1
}

started == 1 && /<p>/ {
	print "</div>"
	started = 0
}