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

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

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

行番号 
1# Author: Martin Blais
2# Contact: blais@furius.ca
3# Revision: $Revision: 4006 $
4# Date: $Date: 2005-11-08 03:38:20 +0100 (Tue, 08 Nov 2005) $
5# Copyright: This module has been placed in the public domain.
6
7"""Reader for existing document trees."""
8
9from docutils import readers, utils, transforms
10
11
12class Reader(readers.ReReader):
13
14    """
15    Adapt the Reader API for an existing document tree.
16
17    The existing document tree must be passed as the ``source`` parameter to
18    the `docutils.core.Publisher` initializer, wrapped in a
19    `docutils.io.DocTreeInput` object::
20
21        pub = docutils.core.Publisher(
22            ..., source=docutils.io.DocTreeInput(document), ...)
23
24    The original document settings are overridden; if you want to use the
25    settings of the original document, pass ``settings=document.settings`` to
26    the Publisher call above.
27    """
28
29    supported = ('doctree',)
30
31    config_section = 'doctree reader'
32    config_section_dependencies = ('readers',)
33
34    def parse(self):
35        """
36        No parsing to do; refurbish the document tree instead.
37        Overrides the inherited method.
38        """
39        self.document = self.input
40        # Create fresh Transformer object, to be populated from Writer
41        # component.
42        self.document.transformer = transforms.Transformer(self.document)
43        # Replace existing settings object with new one.
44        self.document.settings = self.settings
45        # Create fresh Reporter object because it is dependent on
46        # (new) settings.
47        self.document.reporter = utils.new_reporter(
48            self.document.get('source', ''), self.document.settings)
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。