Skip to content

Commit

Permalink
fix: Error when a digit immediately follows a code tag
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Nov 1, 2020
1 parent 80f4c6c commit 3ace124
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mkdocstrings/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def store(self, value: str) -> str:
Returns:
The ID under which the text is stored.
"""
new_id = f"{self.seed}{len(self._store)}"
new_id = f"\x02{self.seed}{len(self._store)}\x03"
self._store.append(value)
return new_id

Expand Down Expand Up @@ -78,7 +78,7 @@ def restore_code_tags(self, soup_str: str) -> str:
Returns:
The same HTML text with placeholders replaced by their respective original code nodes.
"""
return re.sub(rf"{self.seed}(\d+)", self._replace_id_with_value, soup_str)
return re.sub(rf"\x02{self.seed}(\d+)\x03", self._replace_id_with_value, soup_str)

def _replace_id_with_value(self, match):
return self._store[int(match.group(1))]
Expand Down

0 comments on commit 3ace124

Please sign in to comment.