diff options
| author | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-06-27 01:24:56 +0000 |
|---|---|---|
| committer | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-06-27 01:24:56 +0000 |
| commit | 7d332ce48ef75ddc1d63aa789d87cacc2cf9da44 (patch) | |
| tree | 60c36f8f4ab87e3beba3bb9ce70817aafafd1953 /docutils/tools/quicktest.py | |
| parent | 64bc7d305c9dacafe6f7ad1ca15cd7cadb81a824 (diff) | |
| download | docutils-7d332ce48ef75ddc1d63aa789d87cacc2cf9da44.tar.gz | |
Added the "--attributes" option, hacked a bit.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@213 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/tools/quicktest.py')
| -rwxr-xr-x | docutils/tools/quicktest.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/docutils/tools/quicktest.py b/docutils/tools/quicktest.py index d76845023..cf3884875 100755 --- a/docutils/tools/quicktest.py +++ b/docutils/tools/quicktest.py @@ -13,7 +13,8 @@ import sys import os import getopt -import docutils.utils +from docutils.frontend import OptionParser +from docutils.utils import new_document from docutils.parsers.rst import Parser @@ -37,6 +38,7 @@ options = [('pretty', 'p', ('styledxml=', 's', 'output raw XML with XSL style sheet reference ' '(filename supplied in the option argument)'), ('xml', 'x', 'output pretty XML (indented)'), + ('attributes', '', 'dump document attributes after processing'), ('debug', 'd', 'debug mode (lots of output)'), ('help', 'h', 'show help text')] """See distutils.fancy_getopt.FancyGetopt.__init__ for a description of the @@ -127,7 +129,7 @@ def posixGetArgs(argv): except getopt.GetoptError: usage() sys.exit(2) - optargs = {'debug': 0} + optargs = {'debug': 0, 'attributes': 0} for o, a in opts: if o in ['-h', '--help']: usage() @@ -143,6 +145,8 @@ def posixGetArgs(argv): outputFormat = 'pretty' elif o in ['-t', '--test']: outputFormat = 'test' + elif o == '--attributes': + optargs['attributes'] = 1 elif o in ['-d', '--debug']: optargs['debug'] = 1 else: @@ -174,12 +178,17 @@ In the following window, please: def main(): inputFile, outputFormat, optargs = getArgs() # process cmdline arguments + options = OptionParser().get_default_values() + options.debug = optargs['debug'] parser = Parser() input = inputFile.read() - document = docutils.utils.new_document(debug=optargs['debug']) + document = new_document(options) parser.parse(input, document) output = format(outputFormat, input, document, optargs) print output, + if optargs['attributes']: + import pprint + pprint.pprint(document.__dict__) if __name__ == '__main__': |
