Esempio n. 1
0
from sphinx.addnodes import (desc, desc_signature, desc_content)
try:
    from sphinx.addnodes import module as section_prelude_end_class
except ImportError:
    from sphinx.addnodes import index as section_prelude_end_class

from docutils.nodes import (section, literal, reference, paragraph, title,
                            document, Text, TextElement, inline,
                            table, tgroup, colspec, tbody, row, entry,
                            whitespace_normalize_name, SkipNode)
import os
import re
from collections import deque

DOT = as_unicode('.')
SPACE = as_unicode(' ')
EMDASH = as_unicode(r'\u2014')

def setup(app): 
    # This extension uses indexer collected tables.
    app.setup_extension('ext.indexer')

    # Documents to leave untransformed by boilerplate
    app.add_config_value('boilerplate_skip_transform', [], '')

    # The stages of adding boilerplate markup.
    app.connect('doctree-resolved', transform_document)
    app.connect('html-page-context', inject_template_globals)

    # Internal nodes.
Esempio n. 2
0
<type>: (str) an object's type: the desctype attribute.
<summary>: (str) a summary line as identified by a :summaryline: role.
           This corresponds to the first line of a docstring.
<sigs>: (list of str) an object's signatures, in document order.
<toc>: (list of str) refids of an object's children, in document order.

"""

from ext.utils import (Visitor, get_fullname, get_refid, as_refid, geterror,
                       GetError, EMPTYSTR, as_unicode)

from collections import deque

import os.path

MODULE_ID_PREFIX = as_unicode(r'module-')


def setup(app):
    app.connect('env-purge-doc', prep_document_info)
    app.connect('doctree-read', collect_document_info)


def prep_document_info(app, env, docname):
    try:
        env.pyg_sections = [
            e for e in env.pyg_sections if e['docname'] != docname
        ]
    except AttributeError:
        pass
    except KeyError:
Esempio n. 3
0
from sphinx.addnodes import (desc, desc_signature, desc_content)
try:
    from sphinx.addnodes import module as section_prelude_end_class
except ImportError:
    from sphinx.addnodes import index as section_prelude_end_class
from sphinx.domains.python import PyClasslike

from docutils.nodes import (section, literal, reference, paragraph, title,
                            document, Text, TextElement, inline, table, tgroup,
                            colspec, tbody, row, entry,
                            whitespace_normalize_name, SkipNode)
import os
import re
from collections import deque

DOT = as_unicode('.')
SPACE = as_unicode(' ')
EMDASH = as_unicode(r'\u2014')


class PyGameClasslike(PyClasslike):
    """
    No signature prefix for classes.
    """
    def get_signature_prefix(self, sig):
        return '' if self.objtype == 'class' else PyClasslike(self, sig)


def setup(app):
    # This extension uses indexer collected tables.
    app.setup_extension('ext.indexer')
Esempio n. 4
0
<id>: (str) unique desc id, the first entry in the ids attribute list.
<type>: (str) an object's type: the desctype attribute.
<summary>: (str) a summary line as identified by a :summaryline: role.
           This corresponds to the first line of a docstring.
<sigs>: (list of str) an object's signatures, in document order.
<toc>: (list of str) refids of an object's children, in document order.

"""

from ext.utils import (Visitor, get_fullname, get_refid, as_refid,
                       geterror, GetError, EMPTYSTR, as_unicode)

from collections import deque


MODULE_ID_PREFIX = as_unicode(r'module-')


def setup(app):
    app.connect('env-purge-doc', prep_document_info)
    app.connect('doctree-read', collect_document_info)


def prep_document_info(app, env, docname):
    try:
        env.pyg_sections = [e for e in env.pyg_sections
                            if e['docname'] != docname]
    except AttributeError:
        pass
    except KeyError:
        pass