diff options
Diffstat (limited to 'sphinx/writers/_html4.py')
-rw-r--r-- | sphinx/writers/_html4.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/writers/_html4.py b/sphinx/writers/_html4.py index 56ad5b554..7aec4c892 100644 --- a/sphinx/writers/_html4.py +++ b/sphinx/writers/_html4.py @@ -36,7 +36,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}" # RemovedInSphinx70Warning @@ -45,7 +45,7 @@ class HTML4Translator(SphinxTranslator, BaseTranslator): Our custom HTML translator. """ - builder: "StandaloneHTMLBuilder" + builder: StandaloneHTMLBuilder def __init__(self, document: nodes.document, builder: Builder) -> None: super().__init__(document, builder) @@ -261,7 +261,7 @@ class HTML4Translator(SphinxTranslator, BaseTranslator): elif isinstance(node.parent, nodes.section): if self.builder.name == 'singlehtml': docname = self.docnames[-1] - anchorname = "%s/#%s" % (docname, node.parent['ids'][0]) + anchorname = f"{docname}/#{node.parent['ids'][0]}" if anchorname not in self.builder.secnumbers: anchorname = "%s/" % docname # try first heading which has no anchor else: @@ -283,7 +283,7 @@ class HTML4Translator(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 @@ -402,7 +402,7 @@ class HTML4Translator(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): |