Fix markdown test

main
Bob Mottram 2022-11-10 09:52:38 +00:00
parent d0b9441c91
commit 697021fcad
1 changed files with 8 additions and 8 deletions

View File

@ -275,7 +275,7 @@ def _markdown_replace_code(markdown: str) -> str:
line_ctr = 0 line_ctr = 0
changed = False changed = False
section_active = False section_active = False
urlencode = False url_encode = False
html_escape_table = { html_escape_table = {
"&": "&", "&": "&",
'"': """, '"': """,
@ -291,13 +291,13 @@ def _markdown_replace_code(markdown: str) -> str:
if line.startswith('```'): if line.startswith('```'):
if not section_active: if not section_active:
if 'html' in line or 'xml' in line or 'rdf' in line: if 'html' in line or 'xml' in line or 'rdf' in line:
urlencode = True url_encode = True
start_line = line_ctr start_line = line_ctr
section_active = True section_active = True
else: else:
lines[start_line] = '<code>' lines[start_line] = '<code>'
lines[line_ctr] = '</code>' lines[line_ctr] = '</code>'
if urlencode: if url_encode:
lines[start_line] = '<pre>\n<code>' lines[start_line] = '<pre>\n<code>'
lines[line_ctr] = '</code>\n</pre>' lines[line_ctr] = '</code>\n</pre>'
for line_num in range(start_line + 1, line_ctr): for line_num in range(start_line + 1, line_ctr):
@ -306,7 +306,7 @@ def _markdown_replace_code(markdown: str) -> str:
for char in lines[line_num]) for char in lines[line_num])
section_active = False section_active = False
changed = True changed = True
urlencode = False url_encode = False
line_ctr += 1 line_ctr += 1
if not changed: if not changed: