Script to convert wiki FAQ to www.dragonflybsd.org FAQ

Max Okumoto okumoto at ucsd.edu
Fri Jan 14 17:27:34 PST 2005


Here is a first run for a script that extracts the
contents of the wiki FAQ so it can be posted to the
dragonfly website.
Any comments?  This script would be invoked via cron.
And would be used to keep the website and the FAQ
sync'ed.
TODO: add versioning so we can keep track of the changes
      we are importing and send diffs to submit mailing list.
Note: Some of this could be done in the wiki, but thats
      another project. :-)  Anyone know how to program in php?
				Max Okumoto
#!/bin/sh

fetch http://www.sitetronics.com/dfwiki/index.php/DragonFly_FAQ

cp FAQ.header FAQ.cgi

#
# 1. Extract content section from downloaded page.
# 2. Delete table of contents section.
# 3. Remove URLs to edit links.
# 4. Convert <h1> tags to bold.
#
cat DragonFly_FAQ | sed \
        -e '1,/<!-- start content -->/d' \
        -e '/<!-- end content -->/,$d' \
	-e '/<table border="0" id="toc">/,/<\/table>/d' \
	-e 's,^<div class="editsection" style="float:right;margin-left:5px;">.*<\/div>,,' \
	-e 's/<h1>/<b>/g' \
	-e 's/<\/h1>/<\/b>/g' \
	>> FAQ.cgi

cat FAQ.footer >> FAQ.cgi

chmod +x FAQ.cgi




More information about the Submit mailing list