diff options
author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 20:44:25 +0000 |
---|---|---|
committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-01-09 20:44:25 +0000 |
commit | d77fdfef70e08114f57cbef5d91707df8717ea9f (patch) | |
tree | 49444e3486c0c333cb7b33dfa721296c08ee4ece /sandbox/tibs/pysource/rjhack.py | |
parent | 53cd16ca6ca5f638cbe5956988e88f9339e355cf (diff) | |
parent | 3993c4097756e9885bcfbd07cb1cc1e4e95e50e4 (diff) | |
download | docutils-0.4.tar.gz |
Release 0.4: tagging released revisiondocutils-0.4
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.4@4268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/tibs/pysource/rjhack.py')
-rwxr-xr-x | sandbox/tibs/pysource/rjhack.py | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/sandbox/tibs/pysource/rjhack.py b/sandbox/tibs/pysource/rjhack.py deleted file mode 100755 index 6046312ac..000000000 --- a/sandbox/tibs/pysource/rjhack.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Author: Richard Jones -# Contact: richard@users.sourceforge.net -# Revision: $Revision$ -# Date: $Date$ -# Copyright: This module has been placed in the public domain. - -""" -A front end to the Docutils Publisher, taking Python source and producing HTML. -""" - -import os, locale -try: - locale.setlocale(locale.LC_ALL, '') -except: - pass - -import visit, transform - -from docutils.parsers.rst import Parser -class SourceParser(Parser): - supported = ('pysource',) - settings_spec = ( - 'PySource Parser Options', - None, - (('Be verbose while parsing', ['--verbose-parse'], - {'action': 'store_true'}), - )) + Parser.settings_spec - def parse(self, filename, document): - if os.path.isdir(filename): - thing = visit.Package(document.settings, filename) - else: - thing = visit.Module(document.settings, filename) - process = transform.Process(with_groups=0, document=document) - process(thing) - -from docutils.readers import Reader -class SourceReader(Reader): - def read(self, source, parser, settings): - self.source = source - if not self.parser: - self.parser = parser - self.settings = settings - # we want the input as the filename, not the file content - self.source.source.close() - self.input = self.source.source_path - self.parse() - return self.document - -from docutils.core import publish_cmdline, default_description -description = ('Generates (X)HTML documents from Python sources. ' - + default_description) -parser = SourceParser() -reader = SourceReader(parser, 'pysource') -publish_cmdline(reader=reader, parser=parser, writer_name='html', - description=description) - |