Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits / Group-contents.awk
blob: 43fa460937d395ee4ac0048640ce20006eb393da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# .*(blog|slides|teaching|tutorials|misc)/.*/.*html
#
# == About ==
#
# Some pages contain contents info, comprised of a "Contents" heading (h2) and a
# (usually ordered) list of anchors to headings in the current page.
# This script groups that heading and list into a wrapper element with id
# "contents-container", which can then be handled more specifically.
#
# In my case, the contents appear on the right of remaining text.

BEGIN {
	started = 0
}

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

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