diff --git a/daemon.py b/daemon.py
index f131949a5..cb1c75e2d 100644
--- a/daemon.py
+++ b/daemon.py
@@ -5797,7 +5797,7 @@ class PubServer(BaseHTTPRequestHandler):
# if there is no theme-specific help image then use the default one
if not os.path.isfile(mediaFilename):
mediaFilename = \
- baseDir + '/theme/default/helpimages/' + iconFilename
+ baseDir + '/theme/default/helpimages/' + iconFilename
if self._etag_exists(mediaFilename):
# The file has not changed
self._304()
diff --git a/tests.py b/tests.py
index 9fee74c7d..db321f23c 100644
--- a/tests.py
+++ b/tests.py
@@ -3288,6 +3288,11 @@ def testMarkdownToHtml():
markdown = 'This is just plain text'
assert markdownToHtml(markdown) == markdown
+ markdown = 'This is a quotation:\n' + \
+ '> Some quote or other'
+ assert markdownToHtml(markdown) == 'This is a quotation:
' + \
+ '
Some quote or other' + markdown = 'This is **bold**' assert markdownToHtml(markdown) == 'This is bold' diff --git a/webapp_utils.py b/webapp_utils.py index b8519bb90..29c965100 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -66,8 +66,33 @@ def _markdownEmphasisHtml(markdown: str) -> str: return markdown +def _markdownReplaceQuotes(markdown: str) -> str: + """Replaces > quotes with html blockquote + """ + if '> ' not in markdown: + return markdown + lines = markdown.split('\n') + result = '' + for line in lines: + if '> ' not in line: + result += line + '\n' + continue + lineStr = line.strip() + if not lineStr.startswith('> '): + result += line + '\n' + continue + lineStr = lineStr.replace('> ', '', 1).strip() + result += '
' + lineStr + '\n' + + if result.endswith('\n') and \ + not markdown.endswith('\n'): + result = result[:len(result) -1] + return result + + def _markdownReplaceLinks(markdown: str, images=False) -> str: """Replaces markdown links with html + Optionally replace image links """ replaceLinks = {} text = markdown @@ -106,6 +131,7 @@ def _markdownReplaceLinks(markdown: str, images=False) -> str: def markdownToHtml(markdown: str) -> str: """Converts markdown formatted text to html """ + markdown = _markdownReplaceQuotes(markdown) markdown = _markdownEmphasisHtml(markdown) markdown = _markdownReplaceLinks(markdown, True) markdown = _markdownReplaceLinks(markdown)