mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Rename attribute to better fit the purpose.
This commit is contained in:
parent
661101663a
commit
2524f31069
@ -80,7 +80,7 @@ default_substitutions = set([
|
|||||||
|
|
||||||
dummy_reporter = Reporter('', 4, 4)
|
dummy_reporter = Reporter('', 4, 4)
|
||||||
|
|
||||||
versioning_methods = {
|
versioning_conditions = {
|
||||||
'none': False,
|
'none': False,
|
||||||
'text': nodes.TextElement,
|
'text': nodes.TextElement,
|
||||||
'commentable': is_commentable,
|
'commentable': is_commentable,
|
||||||
@ -321,7 +321,7 @@ class BuildEnvironment:
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
# the method of doctree versioning; see set_versioning_method
|
# the method of doctree versioning; see set_versioning_method
|
||||||
self.versioning_method = None
|
self.versioning_condition = None
|
||||||
|
|
||||||
# the application object; only set while update() runs
|
# the application object; only set while update() runs
|
||||||
self.app = None
|
self.app = None
|
||||||
@ -398,14 +398,14 @@ class BuildEnvironment:
|
|||||||
raise an exception if the user tries to use an environment with an
|
raise an exception if the user tries to use an environment with an
|
||||||
incompatible versioning method.
|
incompatible versioning method.
|
||||||
"""
|
"""
|
||||||
if method not in versioning_methods:
|
if method not in versioning_conditions:
|
||||||
raise ValueError('invalid versioning method: %r' % method)
|
raise ValueError('invalid versioning method: %r' % method)
|
||||||
method = versioning_methods[method]
|
condition = versioning_conditions[method]
|
||||||
if self.versioning_method not in (None, method):
|
if self.versioning_condition not in (None, condition):
|
||||||
raise SphinxError('This environment is incompatible with the '
|
raise SphinxError('This environment is incompatible with the '
|
||||||
'selected builder, please choose another '
|
'selected builder, please choose another '
|
||||||
'doctree directory.')
|
'doctree directory.')
|
||||||
self.versioning_method = method
|
self.versioning_condition = condition
|
||||||
|
|
||||||
def warn(self, docname, msg, lineno=None):
|
def warn(self, docname, msg, lineno=None):
|
||||||
# strange argument order is due to backwards compatibility
|
# strange argument order is due to backwards compatibility
|
||||||
@ -781,7 +781,7 @@ class BuildEnvironment:
|
|||||||
# store time of build, for outdated files detection
|
# store time of build, for outdated files detection
|
||||||
self.all_docs[docname] = time.time()
|
self.all_docs[docname] = time.time()
|
||||||
|
|
||||||
if self.versioning_method:
|
if self.versioning_condition:
|
||||||
# get old doctree
|
# get old doctree
|
||||||
try:
|
try:
|
||||||
f = open(self.doc2path(docname,
|
f = open(self.doc2path(docname,
|
||||||
@ -795,10 +795,10 @@ class BuildEnvironment:
|
|||||||
|
|
||||||
# add uids for versioning
|
# add uids for versioning
|
||||||
if old_doctree is None:
|
if old_doctree is None:
|
||||||
list(add_uids(doctree, nodes.TextElement))
|
list(add_uids(doctree, self.versioning_condition))
|
||||||
else:
|
else:
|
||||||
list(merge_doctrees(
|
list(merge_doctrees(
|
||||||
old_doctree, doctree, self.versioning_method))
|
old_doctree, doctree, self.versioning_condition))
|
||||||
|
|
||||||
# make it picklable
|
# make it picklable
|
||||||
doctree.reporter = None
|
doctree.reporter = None
|
||||||
|
Loading…
Reference in New Issue
Block a user