Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions decode-spam-headers.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6648,14 +6648,11 @@ def formatToHtml(body, headers):
body = body.replace(testEnd, '</div>')

body = body.replace('\n', '<br/>\n').replace('\t', '\t' + '&nbsp;' * 4).replace(' ', '&nbsp;')
headers = headers.replace('\n', '<br/>\n').replace('\t', '\t' + '&nbsp;' * 4).replace(' ', '&nbsp;')
body2 = body

for m in re.finditer(r'(<[^>]+>)', body, re.I):
a = m.group(1)
b = a.replace('&nbsp;', ' ')
body2 = body2.replace(a, b)

body = body2

outputHtml = f'''
Expand Down Expand Up @@ -6781,7 +6778,7 @@ def formatToHtml(body, headers):
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 18.5714px;
line-height: 18.5714px;
}}

a {{
Expand All @@ -6804,9 +6801,9 @@ def formatToHtml(body, headers):
<details>
<summary>Original SMTP Headers</summary>
<blockquote>
<code>
{headers}
</code>
<code><pre>
{escape(headers)}
</pre></code>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added wrapping into <pre> allows to simply ditch the \n<br/>\n shenanigans — within <pre>, the contained (html-escaped) html blob will render as-is.

</blockquote>
</details>
</article>
Expand All @@ -6815,7 +6812,7 @@ def formatToHtml(body, headers):
{body}
</body>
</html>
'''
'''
return outputHtml

def colorizeOutput(out, headers):
Expand Down