summaryrefslogtreecommitdiff
path: root/sphinx/writers/html5.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2023-01-02 00:01:14 +0000
committerGitHub <noreply@github.com>2023-01-02 00:01:14 +0000
commit4032070e8131f518bbb8a04e8d63c5af4df9b59d (patch)
tree47b14f58d5337448e8358029264ebcd6d1ae7351 /sphinx/writers/html5.py
parentede68fa423107fbab74d07b307d7dcb03c00dfbd (diff)
downloadsphinx-git-4032070e8131f518bbb8a04e8d63c5af4df9b59d.tar.gz
Run pyupgrade (#11070)
Diffstat (limited to 'sphinx/writers/html5.py')
-rw-r--r--sphinx/writers/html5.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py
index e07e86ab4..edf8bdc23 100644
--- a/sphinx/writers/html5.py
+++ b/sphinx/writers/html5.py
@@ -39,7 +39,7 @@ def multiply_length(length: str, scale: int) -> str:
else:
amount, unit = matched.groups()
result = float(amount) * scale / 100
- return "%s%s" % (int(result), unit)
+ return f"{int(result)}{unit}"
class HTML5Translator(SphinxTranslator, BaseTranslator):
@@ -47,7 +47,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
Our custom HTML translator.
"""
- builder: "StandaloneHTMLBuilder"
+ builder: StandaloneHTMLBuilder
# Override docutils.writers.html5_polyglot:HTMLTranslator
# otherwise, nodes like <inline classes="s">...</inline> will be
# converted to <s>...</s> by `visit_inline`.
@@ -267,7 +267,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
if isinstance(node.parent, nodes.section):
if self.builder.name == 'singlehtml':
docname = self.docnames[-1]
- anchorname = "%s/#%s" % (docname, node.parent['ids'][0])
+ anchorname = "{}/#{}".format(docname, node.parent['ids'][0])
if anchorname not in self.builder.secnumbers:
anchorname = "%s/" % docname # try first heading which has no anchor
else:
@@ -289,7 +289,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
def add_fignumber(self, node: Element) -> None:
def append_fignumber(figtype: str, figure_id: str) -> None:
if self.builder.name == 'singlehtml':
- key = "%s/%s" % (self.docnames[-1], figtype)
+ key = f"{self.docnames[-1]}/{figtype}"
else:
key = figtype
@@ -388,7 +388,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
elif close_tag.startswith('</a></h'):
self.body.append('</a><a class="headerlink" href="#%s" ' %
node.parent['ids'][0] +
- 'title="%s">%s' % (
+ 'title="{}">{}'.format(
_('Permalink to this heading'),
self.config.html_permalinks_icon))
elif isinstance(node.parent, nodes.table):