diff options
author | Johnathan Corgan | 2012-04-07 19:32:10 -0700 |
---|---|---|
committer | Johnathan Corgan | 2012-04-07 19:32:10 -0700 |
commit | 9bef26c9271a7b9253075bda3c1fc7c8078c0343 (patch) | |
tree | a6c1329bb902c95c8ab9970f38ec5fb46d79167c /docs/howto-write-a-block/make_numbered_listing.py | |
parent | f621a52f779381cfe550b4278b83e701a747944c (diff) | |
parent | ef72dc714840dfb8fe3f918dda243f74453b6cc7 (diff) | |
download | gnuradio-9bef26c9271a7b9253075bda3c1fc7c8078c0343.tar.gz gnuradio-9bef26c9271a7b9253075bda3c1fc7c8078c0343.tar.bz2 gnuradio-9bef26c9271a7b9253075bda3c1fc7c8078c0343.zip |
Merge branch 'next'
Diffstat (limited to 'docs/howto-write-a-block/make_numbered_listing.py')
-rwxr-xr-x | docs/howto-write-a-block/make_numbered_listing.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/docs/howto-write-a-block/make_numbered_listing.py b/docs/howto-write-a-block/make_numbered_listing.py deleted file mode 100755 index 889c2d78d..000000000 --- a/docs/howto-write-a-block/make_numbered_listing.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 ('<?xml version="1.0" encoding="ISO-8859-1"?>\n') - # outf.write ('<example id="%s">\n' % (input_filename,)) - # if not title: - # title = input_filename - # outf.write ('<title>') - # outf.write (title) - # outf.write ('</title>\n') - outf.write ('<programlisting>\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 ('</programlisting>\n') - # outf.write ('</example>\n') - - -def main (): - for file in sys.argv[1:]: - generate_listing (file) - -if __name__ == '__main__': - main () - |