Python sphinx.__version__() Examples

The following are 20 code examples of sphinx.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sphinx , or try the search function .
Example #1
Source File: docscrape_sphinx.py    From supersmoother with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #2
Source File: docscrape_sphinx.py    From dmipy with MIT License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #3
Source File: docscrape_sphinx.py    From noisyopt with MIT License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #4
Source File: docscrape_sphinx.py    From ProxImaL with MIT License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex', '']
            else:
                out += ['.. latexonly::', '']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #5
Source File: docscrape_sphinx.py    From dmriprep with Apache License 2.0 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #6
Source File: docscrape_sphinx.py    From gatspy with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #7
Source File: docscrape_sphinx.py    From niworkflows with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #8
Source File: docscrape_sphinx.py    From artview with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #9
Source File: docscrape_sphinx.py    From DMDpack with GNU General Public License v3.0 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #10
Source File: docscrape_sphinx.py    From brian2genn with GNU General Public License v2.0 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #11
Source File: docscrape_sphinx.py    From megaman with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #12
Source File: docscrape_sphinx.py    From queueing-tool with MIT License 6 votes vote down vote up
def _str_references(self):
        out = []
        if self['References']:
            out += self._str_header('References')
            if isinstance(self['References'], str):
                self['References'] = [self['References']]
            out.extend(self['References'])
            out += ['']
            # Latex collects all references to a separate bibliography,
            # so we need to insert links to it
            if sphinx.__version__ >= "0.6":
                out += ['.. only:: latex','']
            else:
                out += ['.. latexonly::','']
            items = []
            for line in self['References']:
                m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
                if m:
                    items.append(m.group(1))
            out += ['   ' + ", ".join(["[%s]_" % item for item in items]), '']
        return out 
Example #13
Source File: conf.py    From drizzlepac with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def check_sphinx_version(expected_version):
    sphinx_version = LooseVersion(sphinx.__version__)
    expected_version = LooseVersion(expected_version)
    if sphinx_version < expected_version:
        raise RuntimeError(
            "At least Sphinx version {0} is required to build this "
            "documentation.  Found {1}.".format(
                expected_version, sphinx_version))


# Configuration for intersphinx: refer to the Python standard library. 
Example #14
Source File: conftest.py    From sphinx-gallery with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def pytest_report_header(config, startdir):
    """Add information to the pytest run header."""
    return 'Sphinx:  %s (%s)' % (sphinx.__version__, sphinx.__file__) 
Example #15
Source File: conf.py    From xarray-simlab with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def resolve_name(self, modname, parents, path, base):
        if modname is None:
            if path:
                mod_cls = path.rstrip(".")
            else:
                mod_cls = None
                # if documenting a class-level object without path,
                # there must be a current class, either from a parent
                # auto directive ...
                mod_cls = self.env.temp_data.get("autodoc:class")
                # ... or from a class directive
                if mod_cls is None:
                    mod_cls = self.env.temp_data.get("py:class")
                # ... if still None, there's no way to know
                if mod_cls is None:
                    return None, []
            # HACK: this is added in comparison to ClassLevelDocumenter
            # mod_cls still exists of class.accessor, so an extra
            # rpartition is needed
            modname, accessor = rpartition(mod_cls, ".")
            modname, cls = rpartition(modname, ".")
            parents = [cls, accessor]
            # if the module name is still missing, get it like above
            if not modname:
                modname = self.env.temp_data.get("autodoc:module")
            if not modname:
                if sphinx.__version__ > "1.3":
                    modname = self.env.ref_context.get("py:module")
                else:
                    modname = self.env.temp_data.get("py:module")
            # ... else, it stays None, which means invalid
        return modname, parents + [base] 
Example #16
Source File: __init__.py    From sphinx-confluence with MIT License 5 votes vote down vote up
def setup(app):
    """
    :type app: sphinx.application.Sphinx
    """
    app.config.html_theme_path = [get_path()]
    app.config.html_theme = 'confluence'
    app.config.html_scaled_image_link = False
    if LooseVersion(sphinx.__version__) >= LooseVersion("1.4"):
        app.set_translator("html", HTMLConfluenceTranslator)
        app.set_translator("json", HTMLConfluenceTranslator)
    else:
        app.config.html_translator_class = 'sphinx_confluence.HTMLConfluenceTranslator'
    app.config.html_add_permalinks = ''

    jira_issue = JiraIssueRole('jira_issue', nodes.Inline)
    app.add_role(jira_issue.name, jira_issue)

    jira_user = JiraUserRole('jira_user', nodes.Inline)
    app.add_role(jira_user.name, jira_user)

    app.add_directive('image', ImageConf)
    app.add_directive('toctree', TocTree)
    app.add_directive('jira_issues', JiraIssuesDirective)
    app.add_directive('code-block', CaptionedCodeBlock)

    app.add_builder(JSONConfluenceBuilder) 
Example #17
Source File: __init__.py    From sphinx-confluence with MIT License 5 votes vote down vote up
def __init__(self, app):
        super(JSONConfluenceBuilder, self).__init__(app)
        if LooseVersion(sphinx.__version__) >= LooseVersion("1.4"):
            self.translator_class = HTMLConfluenceTranslator
        self.warn('json_conf builder is deprecated and will be removed in future releases') 
Example #18
Source File: astropyautosummary.py    From megaman with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setup(app):
    # need autosummary, of course
    app.setup_extension('sphinx.ext.autosummary')

    # Don't make the replacement if Sphinx is at least 1.2
    if LooseVersion(sphinx.__version__) < LooseVersion('1.2.0'):
        # this replaces the default autosummary with the astropy one
        app.add_directive('autosummary', AstropyAutosummary) 
Example #19
Source File: astropyautosummary.py    From gatspy with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setup(app):
    # need autosummary, of course
    app.setup_extension('sphinx.ext.autosummary')

    # Don't make the replacement if Sphinx is at least 1.2
    if LooseVersion(sphinx.__version__) < LooseVersion('1.2.0'):
        # this replaces the default autosummary with the astropy one
        app.add_directive('autosummary', AstropyAutosummary) 
Example #20
Source File: astropyautosummary.py    From supersmoother with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setup(app):
    # need autosummary, of course
    app.setup_extension('sphinx.ext.autosummary')

    # Don't make the replacement if Sphinx is at least 1.2
    if LooseVersion(sphinx.__version__) < LooseVersion('1.2.0'):
        # this replaces the default autosummary with the astropy one
        app.add_directive('autosummary', AstropyAutosummary)