Merge branch 'woorst-bugfix_markdown'

This commit is contained in:
Michael Lazar
2019-02-02 19:03:01 -05:00
2 changed files with 10 additions and 1 deletions

View File

@@ -911,7 +911,8 @@ class Terminal(object):
# Pattern can span multiple lines, allows dot to match newline chars
flags = re.MULTILINE | re.DOTALL
pattern = '<!--{token}(.*?){token}-->'.format(token=TOKEN)
return re.sub(pattern, '', text, flags=flags).strip()
text = re.sub(pattern, '', text, flags=flags)
return re.sub( '^[\s\n]*\n', '', text, flags=flags).rstrip()
def clear_screen(self):
"""

View File

@@ -701,6 +701,14 @@ def test_terminal_strip_instructions(terminal):
text = '<!--{0} instructions {0}--><!-- An HTML comment -->'.format(TOKEN)
assert terminal.strip_instructions(text) == '<!-- An HTML comment -->'
# Whitespace at the start of the first line should be preserved
text = ' code\n block\n'
assert terminal.strip_instructions(text) == ' code\n block'
# But blank lines should be stripped
text = '\n \n code\n block\n'
assert terminal.strip_instructions(text) == ' code\n block'
def test_terminal_get_link_pages(terminal):