Author: | David Goodger, Günter Milde |
---|---|
Contact: | docutils-develop@lists.sourceforge.net |
Date: | 2022-04-02 |
Revision: | 9051 |
Copyright: | This document has been placed in the public domain. |
Contents
Docutils runtime settings are assembled from several sources:
Docutils overlays default and explicitly specified values from these sources such that settings behave the way we want and expect them to behave.
The sources are overlaid in the following order (later sources overwrite earlier ones):
For details see the docutils/__init__.py, docutils/core.py, and docutils.frontend.py modules and the implementation description in Runtime Settings Processing.
Note
Implementation details will change with the move to replace the deprecated optparse module with argparse.
The docutils.SettingsSpec base class is inherited by Docutils components and frontend.OptionParser. It defines the following six attributes:
a sequence of
For examples, see the source of frontend.OptionParser.settings_spec or the settings_spec attributes of the Docutils components.
The last two attributes define which configuration file sections are "active". See also Configuration File Sections & Entries.
Docutils front-ends and applications combine a selection of components of the Docutils Project Model.
All components inherit the SettingsSpec base class. This means that all instances of readers.Reader, parsers.Parser, and writers.Writer are also instances of docutils.SettingsSpec.
For the determination of runtime settings, frontend.OptionParser and the settings_spec parameter in application settings specifications are treated as components as well.
Applications usually deploy Docutils by one of the Publisher convenience functions.
All convenience functions accept the following optional parameters:
a frontend.Values instance. If present, it must be complete.
No further runtime settings processing is done and the following parameters have no effect.
the name of an application-specific configuration file section for this application.
Can be specified instead of a settings_spec (a new SettingsSpec instance that just defines a configuration section will be created) or in addition to a settings_spec (overriding its config_section attribute).
The name settings_spec may refer to