diff options
| author | 2020-10-18 03:04:29 +0200 | |
|---|---|---|
| committer | 2020-10-18 03:08:18 +0200 | |
| commit | 59f1fffb656447668f6e5a34fcc52697b152780a (patch) | |
| tree | 72d14dd1e653b67b097899b5e99e113a3c4db05c | |
| parent | Exclude headerlinks outside of current section (diff) | |
Handle escaped backslashes in strings
| -rw-r--r-- | bot/exts/info/doc/_parsing.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/info/doc/_parsing.py b/bot/exts/info/doc/_parsing.py index d31f26060..0883b9f42 100644 --- a/bot/exts/info/doc/_parsing.py +++ b/bot/exts/info/doc/_parsing.py @@ -66,7 +66,6 @@ def _split_parameters(parameters_string: str) -> List[str]: depth = 0 expected_end = None current_search = None - previous_character = "" for index, character in enumerate(parameters_string): if character in _BRACKET_PAIRS: @@ -79,7 +78,9 @@ def _split_parameters(parameters_string: str) -> List[str]: elif character in {"'", '"'}: if depth == 0: depth += 1 - elif not previous_character == "\\": + elif parameters_string[index-1] != "\\": + depth -= 1 + elif parameters_string[index-2] == "\\": depth -= 1 elif character == expected_end: @@ -91,7 +92,6 @@ def _split_parameters(parameters_string: str) -> List[str]: elif depth == 0 and character == ",": parameters_list.append(parameters_string[last_split:index]) last_split = index + 1 - previous_character = character parameters_list.append(parameters_string[last_split:]) return parameters_list |