DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

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


From: Max Okumoto <okumoto@xxxxxxxx>
Date: Sat, 15 Jan 2005 00:28:16 -0800

Max Okumoto wrote:
Matthew Dillon wrote:

: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

    Looks good.  I need FAQ.header and FAQ.footer.  Once I get those
    I will make a few other modifications and commit it all into the
    site source, then set up the cron job.

-Matt
Matthew Dillon <dillon@xxxxxxxxxxxxx>

FAQ.header was just the top FAQ.cgi. FAQ.footer is empty since, you didn't have anything there.


Here is a update to the script. It now fixes relative links that might be contained in the Wiki FAQ. For people worried about content we can send diffs between the current FAQ and the new faq to a watchers list. If someone sees a problem we can reject the change. (and correct the wiki).

Max

#!/bin/sh

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

cp FAQ.header FAQ.cgi.new

#
# 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.
# 5. Fix relitive references. 
# 6. Remove footer at bottom of page.
#
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' \
	-e 's,a href="/dfwiki/index\.php/,a href="http://www.sitetronics.com/dfwiki/index.php/,g' \
	-e '/<\/p><div class="printfooter">/,/<\/dvi>/d' \
	>> FAQ.cgi.new
echo '</p>' >> FAQ.cgi.new

cat FAQ.footer >> FAQ.cgi.new

chmod +x FAQ.cgi.new

diff -u FAQ.cgi FAQ.cgi.new \
	| mail faq_watchers@xxxxxxxxxxxxxxxx


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]