Cleanup: Use True/False for boolean values
[docutils.git] / docutils / readers / pep.py
blobb8f6c813818de7b8012d4c5ff63586abac7aac5c
1 # $Id$
2 # Author: David Goodger <goodger@python.org>
3 # Copyright: This module has been placed in the public domain.
5 """
6 Python Enhancement Proposal (PEP) Reader.
7 """
9 __docformat__ = 'reStructuredText'
12 from docutils.readers import standalone
13 from docutils.transforms import peps, references, misc, frontmatter
14 from docutils.parsers import rst
17 class Reader(standalone.Reader):
19 supported = ('pep',)
20 """Contexts this reader supports."""
22 settings_spec = (
23 'PEP Reader Option Defaults',
24 'The --pep-references and --rfc-references options (for the '
25 'reStructuredText parser) are on by default.',
26 ())
28 config_section = 'pep reader'
29 config_section_dependencies = ('readers', 'standalone reader')
31 def get_transforms(self):
32 transforms = standalone.Reader.get_transforms(self)
33 # We have PEP-specific frontmatter handling.
34 transforms.remove(frontmatter.DocTitle)
35 transforms.remove(frontmatter.SectionSubTitle)
36 transforms.remove(frontmatter.DocInfo)
37 transforms.extend([peps.Headers, peps.Contents, peps.TargetNotes])
38 return transforms
40 settings_default_overrides = {'pep_references': 1, 'rfc_references': 1}
42 inliner_class = rst.states.Inliner
44 def __init__(self, parser=None, parser_name=None):
45 """`parser` should be ``None``."""
46 if parser is None:
47 parser = rst.Parser(rfc2822=True, inliner=self.inliner_class())
48 standalone.Reader.__init__(self, parser, '')