root/galaxy-central/eggs/docutils-0.4-py2.6.egg/docutils/readers/pep.py

リビジョン 3, 1.6 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1# Author: David Goodger
2# Contact: goodger@users.sourceforge.net
3# Revision: $Revision: 3892 $
4# Date: $Date: 2005-09-20 22:04:53 +0200 (Tue, 20 Sep 2005) $
5# Copyright: This module has been placed in the public domain.
6
7"""
8Python Enhancement Proposal (PEP) Reader.
9"""
10
11__docformat__ = 'reStructuredText'
12
13
14from docutils.readers import standalone
15from docutils.transforms import peps, references, misc, frontmatter
16from docutils.parsers import rst
17
18
19class Reader(standalone.Reader):
20
21    supported = ('pep',)
22    """Contexts this reader supports."""
23
24    settings_spec = (
25        'PEP Reader Option Defaults',
26        'The --pep-references and --rfc-references options (for the '
27        'reStructuredText parser) are on by default.',
28        ())
29
30    config_section = 'pep reader'
31    config_section_dependencies = ('readers', 'standalone reader')
32
33    def get_transforms(self):
34        transforms = standalone.Reader.get_transforms(self)
35        # We have PEP-specific frontmatter handling.
36        transforms.remove(frontmatter.DocTitle)
37        transforms.remove(frontmatter.SectionSubTitle)
38        transforms.remove(frontmatter.DocInfo)
39        transforms.extend([peps.Headers, peps.Contents, peps.TargetNotes])
40        return transforms
41
42    settings_default_overrides = {'pep_references': 1, 'rfc_references': 1}
43
44    inliner_class = rst.states.Inliner
45
46    def __init__(self, parser=None, parser_name=None):
47        """`parser` should be ``None``."""
48        if parser is None:
49            parser = rst.Parser(rfc2822=1, inliner=self.inliner_class())
50        standalone.Reader.__init__(self, parser, '')
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。