本文整理匯總了Python中sphinx.__version__方法的典型用法代碼示例。如果您正苦於以下問題:Python sphinx.__version__方法的具體用法?Python sphinx.__version__怎麽用?Python sphinx.__version__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sphinx
的用法示例。
在下文中一共展示了sphinx.__version__方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _str_references
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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
示例2: _str_references
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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
示例3: pytest_report_header
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
def pytest_report_header(config, startdir):
"""Add information to the pytest run header."""
return 'Sphinx: %s (%s)' % (sphinx.__version__, sphinx.__file__)
示例4: setup
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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)
示例5: __init__
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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')
示例6: setup
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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)
示例7: resolve_name
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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]
示例8: check_sphinx_version
# 需要導入模塊: import sphinx [as 別名]
# 或者: from sphinx import __version__ [as 別名]
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.