diff options
| author | 2020-10-04 18:34:50 +0300 | |
|---|---|---|
| committer | 2020-10-04 18:34:50 +0300 | |
| commit | 08140e8ceab3ab46a1c956b7a4c90b771064d3c6 (patch) | |
| tree | a8bc360a5b3da5a39bc11efb88b8a0989cf17fe7 | |
| parent | Added interleaving text in code blocks option (diff) | |
Improved style and fixed comment.
| -rw-r--r-- | bot/exts/utils/snekbox.py | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/bot/exts/utils/snekbox.py b/bot/exts/utils/snekbox.py index e1839bdf7..e782ed745 100644 --- a/bot/exts/utils/snekbox.py +++ b/bot/exts/utils/snekbox.py @@ -88,7 +88,7 @@ class Snekbox(Cog):          """Extract code from the Markdown, format it, and insert it into the code template."""          match = FORMATTED_CODE_REGEX.fullmatch(code) -        # Despite the wildcard being lazy, this is a fullmatch so we need to check the presence of the delim explicitly. +        # Despite the wildcard being lazy, the pattern is from start to end and will eat any delimiters in the middle.          if match and match.group("delim") not in match.group("code"):              code, block, lang, delim = match.group("code", "block", "lang", "delim")              code = textwrap.dedent(code) @@ -100,7 +100,7 @@ class Snekbox(Cog):          else:              code_parts = CODE_BLOCK_REGEX.finditer(code) -            merge = '\n'.join(map(lambda part: part.group("code"), code_parts)) +            merge = '\n'.join(part.group("code") for part in code_parts)              if merge:                  code = textwrap.dedent(merge)                  log.trace(f"Merged one or more code blocks from text combined with code:\n{code}") | 
