summaryrefslogtreecommitdiff
path: root/sphinx/util/docutils.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-16 01:00:18 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-16 01:55:46 +0900
commitc892a5abeb0c9a28650cc6e01bcc851f85d68a41 (patch)
treef7bbbc808a3fe5cd9b72222544c4ae23c59d846f /sphinx/util/docutils.py
parent66afbec97906d4238be2acc1e6bf5ab45ba89a8e (diff)
downloadsphinx-git-c892a5abeb0c9a28650cc6e01bcc851f85d68a41.tar.gz
refactor: Rename the first argument of roles to `name`
In docutils' document, it is called as name. So our base class should call it as "name" also.
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r--sphinx/util/docutils.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py
index 56f8d124a..31c959a0e 100644
--- a/sphinx/util/docutils.py
+++ b/sphinx/util/docutils.py
@@ -393,7 +393,7 @@ class SphinxRole:
This class is strongly coupled with Sphinx.
"""
- def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]):
+ def __call__(self, name, rawtext, text, lineno, inliner, options={}, content=[]):
# type: (str, str, str, int, Inliner, Dict, List[str]) -> Tuple[List[nodes.Node], List[nodes.system_message]] # NOQA
self.rawtext = rawtext
self.text = unescape(text)
@@ -403,13 +403,13 @@ class SphinxRole:
self.content = content
# guess role type
- if typ:
- self.type = typ.lower()
+ if name:
+ self.name = name.lower()
else:
- self.type = self.env.temp_data.get('default_role')
- if not self.type:
- self.type = self.env.config.default_role
- if not self.type:
+ self.name = self.env.temp_data.get('default_role')
+ if not self.name:
+ self.name = self.env.config.default_role
+ if not self.name:
raise SphinxError('cannot determine default role!')
return self.run()
@@ -449,7 +449,7 @@ class ReferenceRole(SphinxRole):
# \x00 means the "<" was backslash-escaped
explicit_title_re = re.compile(r'^(.+?)\s*(?<!\x00)<(.*?)>$', re.DOTALL)
- def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]):
+ def __call__(self, name, rawtext, text, lineno, inliner, options={}, content=[]):
# type: (str, str, str, int, Inliner, Dict, List[str]) -> Tuple[List[nodes.Node], List[nodes.system_message]] # NOQA
matched = self.explicit_title_re.match(text)
if matched:
@@ -461,7 +461,7 @@ class ReferenceRole(SphinxRole):
self.title = unescape(text)
self.target = unescape(text)
- return super().__call__(typ, rawtext, text, lineno, inliner, options, content)
+ return super().__call__(name, rawtext, text, lineno, inliner, options, content)
class SphinxTranslator(nodes.NodeVisitor):