Re: Script to convert wiki FAQ to www.dragonflybsd.org FAQ
This is a multi-part message in MIME format.
--------------020106090803020100030201
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
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@backplane.com>
>
> 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
--------------020106090803020100030201
Content-Type: text/plain;
name="x"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="x"
#!/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@dragonflybsd.org
--------------020106090803020100030201--
討論串 (同標題文章)
完整討論串 (本文為第 7 之 9 篇):