Skip to content

Commit

Permalink
Move replace that's only for tests to test
Browse files Browse the repository at this point in the history
It does not make sense to put test-specific code in the code that runs
in production.  Escaping ' as ' is perfectly fine and CommonMark
compliant.  (The official CommonMark test suite actually performs HTML
normalization by default).
  • Loading branch information
not-my-profile committed Feb 14, 2022
1 parent 22ec204 commit ef9bd3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mistletoe/html_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def render_document(self, token: block_token.Document) -> str:

@staticmethod
def escape_html(raw: str) -> str:
return html.escape(raw).replace(''', "'")
return html.escape(raw)

@staticmethod
def escape_url(raw: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion test/specification/commonmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run_tests(test_entries, start=None, end=None,
def run_test(test_entry, quiet=False):
test_case = test_entry['markdown'].splitlines(keepends=True)
try:
output = markdown(test_case)
output = markdown(test_case).replace(''', "'")
success = test_entry['html'] == output
if not success and not quiet:
print_test_entry(test_entry, output)
Expand Down

0 comments on commit ef9bd3a

Please sign in to comment.