diff options
| author | 2020-07-20 02:28:25 +0200 | |
|---|---|---|
| committer | 2020-07-20 02:28:25 +0200 | |
| commit | 4560f0f89b52cfcb8b18abeb1efa707c334a86d4 (patch) | |
| tree | 6b797008a6d8629e48648ddb027be0037e04fc71 | |
| parent | Rename parser.py to parsing.py. (diff) | |
Remove permalink from truncated markdown.
The permalink serves no functional purpose in the embed,
as it is already included in the title. But it does
add the complexity of passing in the url to the parser.
| -rw-r--r-- | bot/cogs/doc/cog.py | 2 | ||||
| -rw-r--r-- | bot/cogs/doc/parsing.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/bot/cogs/doc/cog.py b/bot/cogs/doc/cog.py index 4e4f3b737..36fbe9010 100644 --- a/bot/cogs/doc/cog.py +++ b/bot/cogs/doc/cog.py @@ -270,7 +270,7 @@ class DocCog(commands.Cog): self.bot.stats.incr(f"doc_fetches.{symbol_obj.package.lower()}") signatures = scraped_html[0] permalink = symbol_obj.url - description = truncate_markdown(markdownify(scraped_html[1], url=permalink), permalink, 1000) + description = truncate_markdown(markdownify(scraped_html[1], url=permalink), 1000) description = WHITESPACE_AFTER_NEWLINES_RE.sub('', description) if signatures is None: # If symbol is a module, don't show signature. diff --git a/bot/cogs/doc/parsing.py b/bot/cogs/doc/parsing.py index 010826a96..3b79e0a93 100644 --- a/bot/cogs/doc/parsing.py +++ b/bot/cogs/doc/parsing.py @@ -83,7 +83,7 @@ def find_all_children_until_tag( return text -def truncate_markdown(markdown: str, permalink: str, max_length: int) -> str: +def truncate_markdown(markdown: str, max_length: int) -> str: """ Truncate `markdown` to be at most `max_length` characters. @@ -108,7 +108,7 @@ def truncate_markdown(markdown: str, permalink: str, max_length: int) -> str: if markdown.count("```") % 2: codeblock_start = markdown.rfind('```py') markdown = markdown[:codeblock_start].rstrip() - markdown += f"... [read more]({permalink})" + markdown += "... read more" return markdown |