#!/usr/bin/sed
#
# Prepend a TOC
# Print an extra first heading
# Delete from 'On this page...' to the *first* first heading
# BEWARE the non-breaking spaces!
#
/On this page.../{
	i [[_TOC_]]\n
};

/# 1.  /p
/On this page/,/# 1./d
/javascript:toggle/d
/ #toc/d
s/^\(#\+\)\s\+[0-9.]\+\s\+/\1 /
/?action=edit/d
s%http://markferry.net/pmwiki/pmwiki.php?n=%%
