From 26d9beb0b51945915798e75ab24051adaa46d083 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 3 Nov 2009 13:42:28 -0800 Subject: howto: moved osbsolete docs directory into limbo --- .../limbo/doc/make_numbered_listing.py | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 gr-howto-write-a-block/limbo/doc/make_numbered_listing.py (limited to 'gr-howto-write-a-block/limbo/doc/make_numbered_listing.py') diff --git a/gr-howto-write-a-block/limbo/doc/make_numbered_listing.py b/gr-howto-write-a-block/limbo/doc/make_numbered_listing.py new file mode 100755 index 000000000..889c2d78d --- /dev/null +++ b/gr-howto-write-a-block/limbo/doc/make_numbered_listing.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import sys +import os, os.path +from optparse import OptionParser + +def quote_line (line): + line = line.replace ('&', '&') + line = line.replace ('<', '<') + line = line.replace ('>', '>') + line = line.replace ("'", ''') + line = line.replace ('"', '"') + return line + +def generate_listing (input_filename, title=None): + inf = open (input_filename, "r") + output_filename = os.path.basename (input_filename) + '.xml' + outf = open (output_filename, "w") + outf.write ('\n') + # outf.write ('\n' % (input_filename,)) + # if not title: + # title = input_filename + # outf.write ('') + # outf.write (title) + # outf.write ('\n') + outf.write ('\n'); + + lineno = 0 + for line in inf: + line = line.expandtabs (8) + line = quote_line (line) + lineno = lineno + 1 + outf.write ('%3d %s' % (lineno, line)) + + outf.write ('\n') + # outf.write ('\n') + + +def main (): + for file in sys.argv[1:]: + generate_listing (file) + +if __name__ == '__main__': + main () + -- cgit