aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-09-21 00:39:15 +0200
committerGravatar Numerlor <[email protected]>2020-09-21 00:39:15 +0200
commit3eed4af70fa24e5daef6c5e6d2d145094b9e672f (patch)
treec2038bcc8011ae34d331265aaa35d59b161106d3
parentProperly truncate description markdown (diff)
Use f strings instead of c style on copied code
The code copied over from MarkdownConverter's implementation used c style string formatting, there is no reason to keep the style of strings in our code
-rw-r--r--bot/cogs/doc/markdown.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/bot/cogs/doc/markdown.py b/bot/cogs/doc/markdown.py
index a95e94991..ba35a84c4 100644
--- a/bot/cogs/doc/markdown.py
+++ b/bot/cogs/doc/markdown.py
@@ -14,18 +14,18 @@ class DocMarkdownConverter(MarkdownConverter):
def convert_li(self, el: PageElement, text: str) -> str:
"""Fix markdownify's erroneous indexing in ol tags."""
parent = el.parent
- if parent is not None and parent.name == 'ol':
+ if parent is not None and parent.name == "ol":
li_tags = parent.find_all("li")
- bullet = '%s.' % (li_tags.index(el)+1)
+ bullet = f"{li_tags.index(el)+1}."
else:
depth = -1
while el:
- if el.name == 'ul':
+ if el.name == "ul":
depth += 1
el = el.parent
- bullets = self.options['bullets']
+ bullets = self.options["bullets"]
bullet = bullets[depth % len(bullets)]
- return '%s %s\n' % (bullet, text or '')
+ return f"{bullet} {text}\n"
def convert_hn(self, _n: int, el: PageElement, text: str) -> str:
"""Convert h tags to bold text with ** instead of adding #."""
@@ -33,11 +33,11 @@ class DocMarkdownConverter(MarkdownConverter):
def convert_code(self, el: PageElement, text: str) -> str:
"""Undo `markdownify`s underscore escaping."""
- return f"`{text}`".replace('\\', '')
+ return f"`{text}`".replace("\\", "")
def convert_pre(self, el: PageElement, text: str) -> str:
"""Wrap any codeblocks in `py` for syntax highlighting."""
- code = ''.join(el.strings)
+ code = "".join(el.strings)
return f"```py\n{code}```"
def convert_a(self, el: PageElement, text: str) -> str: