diff options
| author | aa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2022-11-02 22:39:16 +0000 |
|---|---|---|
| committer | aa-turner <aa-turner@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2022-11-02 22:39:16 +0000 |
| commit | 0c25e5e170c8f4b4ed08e917f6610dd229b1b64f (patch) | |
| tree | 75d4a59e7939831fc61619f508d3bec06ca396fe /docutils | |
| parent | 59dbe27b300ef1a1b7d44749ee9d667f4b63251c (diff) | |
| download | docutils-0c25e5e170c8f4b4ed08e917f6610dd229b1b64f.tar.gz | |
Move ``quicktest`` to ``tools/dev``
The quicktest tool has not been substantively modified since 2006.
It may still be useful for generating test-cases, so move it to the
developer tools section and do not advertise it as a front-end tool.
Update documentation where relevant to remove mention of quicktest
as a front-end tool, and remove obsolete "EasyDialogs" code path.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9201 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
| -rw-r--r-- | docutils/docs/dev/hacking.txt | 1 | ||||
| -rw-r--r-- | docutils/docs/dev/todo.txt | 2 | ||||
| -rw-r--r-- | docutils/docs/user/tools.txt | 32 | ||||
| -rwxr-xr-x | docutils/tools/dev/quicktest.py (renamed from docutils/tools/quicktest.py) | 47 |
4 files changed, 25 insertions, 57 deletions
diff --git a/docutils/docs/dev/hacking.txt b/docutils/docs/dev/hacking.txt index 77c7d5644..30774c55b 100644 --- a/docutils/docs/dev/hacking.txt +++ b/docutils/docs/dev/hacking.txt @@ -259,7 +259,6 @@ on the Docutils-develop_ mailing list. .. _Docutils-develop: ../user/mailing-lists.html#docutils-develop -.. _quicktest.py: ../user/tools.html#quicktest-py .. |---| unicode:: 8212 .. em-dash :trim: diff --git a/docutils/docs/dev/todo.txt b/docutils/docs/dev/todo.txt index 5db8a331a..a70f39cbf 100644 --- a/docutils/docs/dev/todo.txt +++ b/docutils/docs/dev/todo.txt @@ -2285,7 +2285,7 @@ Unimplemented Transforms The advantage of the current way of doing things is that parse-time system messages don't require a transform; they're already in the document. This is valuable for testing (unit tests, - tools/quicktest.py). So if we do decide to make a change, I think + tools/dev/quicktest.py). So if we do decide to make a change, I think the insertion of parse-time system messages ought to remain as-is and the Messages transform ought to move all parse-time system messages (remove from their originally inserted positions, insert in diff --git a/docutils/docs/user/tools.txt b/docutils/docs/user/tools.txt index b0831e3d9..13cf42e1f 100644 --- a/docutils/docs/user/tools.txt +++ b/docutils/docs/user/tools.txt @@ -49,8 +49,7 @@ one argument (source) is specified, the standard output (stdout) is used for the destination. If no arguments are specified, the standard input (stdin) is used for the source. -.. [#] The exceptions are buildhtml.py_, quicktest.py_ and - rst2odt_prepstyles.py_. +.. [#] The exceptions are buildhtml.py_ and rst2odt_prepstyles.py_. Getting Help ============ @@ -524,33 +523,6 @@ External attributes for all elements are output, and internal attributes for any leftover "pending" elements are also given. -quicktest.py ------------- - -:Reader: N/A -:Parser: reStructuredText -:Writer: N/A - -The ``quicktest.py`` tool is used for testing the reStructuredText -parser. It does not use a Docutils Reader or Writer or the standard -Docutils command-line options. Rather, it does its own I/O and calls -the parser directly. No transforms are applied to the parsed -document. Possible output forms output include: - ---pretty Pretty-printed pseudo-XML (default) - ---test Test data (Python list of input and pseudo-XML output strings; - useful for creating new test cases) ---xml Pretty-printed native XML ---rawxml Raw native XML (with or without a stylesheet reference) ---help Usage hint and complete list of supported options. - -.. Caution:: ``quicktest.py`` uses Python's default encoding. - Input and output encoding depend on UTF-8 mode, - Python version, locale setting, and operating system - (cf. :PEP:`540`, :PEP:`538`, :PEP:`597`, and :PEP:`686`). - - --------------- Customization --------------- @@ -560,7 +532,7 @@ Most front-end tools support the options/settings from the generic (reader, writer, parser). [#]_ Some front-end tools also add application-specific settings. -.. [#] The exceptions are quicktest.py_ and rst2odt_prepstyles.py_. +.. [#] The exception is rst2odt_prepstyles.py_. Command-Line Options diff --git a/docutils/tools/quicktest.py b/docutils/tools/dev/quicktest.py index ccc8139eb..5248e368d 100755 --- a/docutils/tools/quicktest.py +++ b/docutils/tools/dev/quicktest.py @@ -5,6 +5,27 @@ # David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. +""" +The ``quicktest.py`` tool is used for testing the reStructuredText +parser. It does not use a Docutils Reader or Writer or the standard +Docutils command-line options. Rather, it does its own I/O and calls +the parser directly. No transforms are applied to the parsed +document. Possible output forms output include: + +--pretty Pretty-printed pseudo-XML (default) + +--test Test data (Python list of input and pseudo-XML output strings; + useful for creating new test cases) +--xml Pretty-printed native XML +--rawxml Raw native XML (with or without a stylesheet reference) +--help Usage hint and complete list of supported options. + +.. Caution:: ``quicktest.py`` uses Python's default encoding. + Input and output encoding depend on UTF-8 mode, + Python version, locale setting, and operating system + (cf. :PEP:`540`, :PEP:`538`, :PEP:`597`, and :PEP:`686`). +""" + try: import locale locale.setlocale(locale.LC_ALL, '') @@ -12,7 +33,6 @@ except Exception: pass import sys -import os import getopt import docutils from docutils import frontend @@ -128,13 +148,6 @@ def format(outputFormat, input, document, optargs): return formatter(input, document, optargs) -def getArgs(): - if os.name == 'mac' and len(sys.argv) <= 1: - return macGetArgs() - else: - return posixGetArgs(sys.argv[1:]) - - def posixGetArgs(argv): outputFormat = 'pretty' # convert fancy_getopt style option list to getopt.getopt() arguments @@ -187,25 +200,9 @@ def posixGetArgs(argv): return inputFile, outputFile, outputFormat, optargs -def macGetArgs(): - import EasyDialogs - EasyDialogs.Message("""\ -Use the next dialog to build a command line: - -1. Choose an output format from the [Option] list -2. Click [Add] -3. Choose an input file: [Add existing file...] -4. Save the output: [Add new file...] -5. [OK]""") - optionlist = [(longopt, description) - for (longopt, shortopt, description) in options] - argv = EasyDialogs.GetArgv(optionlist=optionlist, addfolder=0) - return posixGetArgs(argv) - - def main(): # process cmdline arguments: - inputFile, outputFile, outputFormat, optargs = getArgs() + inputFile, outputFile, outputFormat, optargs = posixGetArgs(sys.argv[1:]) settings = frontend.get_default_settings(Parser) settings.debug = optargs['debug'] parser = Parser() |
