summaryrefslogtreecommitdiff
path: root/test/test_readers/test_python/showdoc
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-08-17 13:59:12 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-08-17 13:59:12 +0000
commita4bc0d09f3d1f633a5780976d1f913e083c9564a (patch)
tree1777475e88463b08438f0719be97cc087554eadd /test/test_readers/test_python/showdoc
parent60c69f8cf97125135948a3d35b7698ee80921137 (diff)
parent2818db9a234cc37008c5f2bb0e821f9b1fa92de2 (diff)
downloaddocutils-0.3.9.tar.gz
re-added docutils-0.3.9 tag one level deeper (without web/ and sandboxes/)docutils-0.3.9
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.3.9@3815 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_readers/test_python/showdoc')
-rwxr-xr-xtest/test_readers/test_python/showdoc33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_readers/test_python/showdoc b/test/test_readers/test_python/showdoc
new file mode 100755
index 000000000..6461960f8
--- /dev/null
+++ b/test/test_readers/test_python/showdoc
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+
+"""
+This is a tool for exploring module documentation trees generated by
+``docutils.readers.python.moduleparser.parse_module()`` from test data in
+docutils/test/test_readers/test_python/test_parser or stdin.
+
+Usage::
+
+ showdoc <key> <index>
+
+ showdoc < <module.py>
+
+Where ``<key>`` is the key to the ``totest`` dictionary, and ``<index>`` is
+the index of the list ``totest[key]``. If no arguments are given, stdin is
+used for input.
+"""
+
+import sys
+from docutils.readers.python.moduleparser import parse_module
+import test_parser
+
+if len(sys.argv) > 1:
+ key, caseno = sys.argv[1:]
+ print 'totest["%s"][%s][0]:\n' % (key, caseno)
+ input_text = test_parser.totest[key][int(caseno)][0]
+ input_source = "test_parser.totest['%s'][%s][0]" % (key, caseno)
+else:
+ input_text = sys.stdin.read()
+ input_source = '<stdin>'
+print input_text
+module = parse_module(input_text, input_source)
+print module,