From f4be60fa0064e9c1ad06fb6e474ae3812ce70f7b Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 8 Nov 2000 18:46:43 +0000 Subject: FAQ to .ht generator --- admin/bin/faq2ht.py | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 admin/bin/faq2ht.py diff --git a/admin/bin/faq2ht.py b/admin/bin/faq2ht.py new file mode 100755 index 000000000..84d2659f7 --- /dev/null +++ b/admin/bin/faq2ht.py @@ -0,0 +1,101 @@ +#! /usr/bin/env python + +"""Convert the plain text FAQ file to its .ht template. + +Requires Python 2.0 +""" + +import sys +import os +import re + + + +def main(): + faqfile = sys.argv[1] + fp = open(faqfile) + lines = fp.readlines() + fp.close() + + outfile = sys.argv[2] + if outfile == '-': + closep = 0 + out = sys.stdout + else: + closep = 1 + out = open(outfile, 'w') + + # skip over cruft in FAQ file + lineno = 0 + while not lines[lineno].startswith('FREQUENTLY'): + lineno += 1 + lineno += 1 + + # skip blanks + while not lines[lineno].strip(): + lineno += 1 + + # first print out standard .ht boilerplate + print >> out, '''\ +Title: Mailman Frequently Asked Questions + +
', + else: + print >> out, line + + if closep: + out.close() + + + +if __name__ == '__main__': + main() -- cgit v1.3.1