1
1
# Author: David Goodger
2
# Contact: goodger@users.sourceforge.net
3
# Revision: $Revision: 1.32 $
4
# Date: $Date: 2004/05/09 16:23:54 $
2
# Contact: goodger@python.org
3
# Revision: $Revision: 4260 $
4
# Date: $Date: 2006-01-09 19:28:09 +0100 (Mon, 09 Jan 2006) $
5
5
# Copyright: This module has been placed in the public domain.
52
52
__docformat__ = 'reStructuredText'
55
"""``major.minor.micro`` version number. The micro number is bumped
56
any time there's a change in the API incompatible with one of the
57
front ends or significant new functionality, and at any alpha or beta
58
release. The minor number is bumped whenever there is a stable
59
project release. The major number will be bumped when the project is
60
feature-complete, and perhaps if there is a major change in the
55
"""``major.minor.micro`` version number. The micro number is bumped for API
56
changes, for new functionality, and for interim project releases. The minor
57
number is bumped whenever there is a significant project release. The major
58
number will be bumped when the project is feature-complete, and perhaps if
59
there is a major change in the design."""
61
__version_details__ = 'release'
62
"""Extra version details (e.g. 'snapshot 2005-05-29, r3410', 'repository',
63
'release'), modified automatically & manually."""
64
65
class ApplicationError(StandardError): pass
65
66
class DataError(ApplicationError): pass
77
78
"""Runtime settings specification. Override in subclasses.
79
Specifies runtime settings and associated command-line options, as used by
80
`docutils.frontend.OptionParser`. This tuple contains one or more sets of
81
option group title, description, and a list/tuple of tuples: ``('help
82
text', [list of option strings], {keyword arguments})``. Group title
83
and/or description may be `None`; a group title of `None` implies no
84
group, just a list of single options. The "keyword arguments" dictionary
85
contains arguments to the OptionParser/OptionGroup ``add_option`` method,
86
with the addition of a "validator" keyword (see the
87
`docutils.frontend.OptionParser.validators` instance attribute). Runtime
88
settings names are derived implicitly from long option names
89
("--a-setting" becomes ``settings.a_setting``) or explicitly from the
90
"dest" keyword argument."""
80
Defines runtime settings and associated command-line options, as used by
81
`docutils.frontend.OptionParser`. This is a tuple of:
83
- Option group title (string or `None` which implies no group, just a list
86
- Description (string or `None`).
88
- A sequence of option tuples. Each consists of:
92
- List of option strings (e.g. ``['-Q', '--quux']``).
94
- Dictionary of keyword arguments. It contains arguments to the
95
OptionParser/OptionGroup ``add_option`` method, possibly with the
96
addition of a 'validator' keyword (see the
97
`docutils.frontend.OptionParser.validators` instance attribute). Runtime
98
settings names are derived implicitly from long option names
99
('--a-setting' becomes ``settings.a_setting``) or explicitly from the
100
'dest' keyword argument. See optparse docs for more details.
102
- More triples of group title, description, options, as many times as
103
needed. Thus, `settings_spec` tuples can be simply concatenated.
92
106
settings_defaults = None
93
"""A dictionary of defaults for internal or inaccessible (by command-line
94
or config file) settings. Override in subclasses."""
107
"""A dictionary of defaults for settings not in `settings_spec` (internal
108
settings, intended to be inaccessible by command-line and config file).
109
Override in subclasses."""
96
111
settings_default_overrides = None
97
112
"""A dictionary of auxiliary defaults, to override defaults for settings
122
137
TransformSpec subclass objects used by `docutils.transforms.Transformer`.
140
def get_transforms(self):
141
"""Transforms required by this class. Override in subclasses."""
142
if self.default_transforms != ():
144
warnings.warn('default_transforms attribute deprecated.\n'
145
'Use get_transforms() method instead.',
147
return list(self.default_transforms)
150
# Deprecated; for compatibility.
125
151
default_transforms = ()
126
"""Transforms required by this class. Override in subclasses."""
128
153
unknown_reference_resolvers = ()
129
"""List of functions to try to resolve unknown references. Called when
130
FinalCheckVisitor is unable to find a correct target. The list should
131
contain functions which will try to resolve unknown references, with the
132
following signature::
154
"""List of functions to try to resolve unknown references. Unknown
155
references have a 'refname' attribute which doesn't correspond to any
156
target in the document. Called when FinalCheckVisitor is unable to find a
157
correct target. The list should contain functions which will try to
158
resolve unknown references, with the following signature::
134
160
def reference_resolver(node):
135
161
'''Returns boolean: true if resolved, false if not.'''
163
If the function is able to resolve the reference, it should also remove
164
the 'refname' attribute and mark the node as resolved::
137
169
Each function must have a "priority" attribute which will affect the order
138
170
the unknown_reference_resolvers are run::