import re
import sys
import subprocess
+import xml.sax.saxutils
_ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding()
def _write_view_header(self, view, stream):
stream.write('<h3 id="{id}">{title}</h3>\n'.format(**view))
+ stream.write('<p>\n')
if 'comment' in view:
stream.write(view['comment'])
stream.write('\n')
for line in [
'The view is generated from the following query:',
- '<blockquote>',
+ '</p>',
+ '<p>',
+ ' <code>',
view['query-string'],
- '</blockquote>',
+ ' </code>',
+ '</p>',
]:
stream.write(line)
stream.write('\n')
stream.write((
'<tr>\n'
' <td>{date}</td>\n'
- ' <td>{message-id-term}</td>\n'
+ ' <td><code>{message-id-term}</code></td>\n'
'</tr>\n'
'<tr>\n'
' <td>{from}</td>\n'
if 'subject' in display_data and 'message-id' in display_data:
d = {
'message-id': quote(display_data['message-id']),
- 'subject': display_data['subject'],
+ 'subject': xml.sax.saxutils.escape(display_data['subject']),
}
display_data['subject'] = (
'<a href="http://mid.gmane.org/{message-id}">{subject}</a>'
).format(**d)
+ for key in ['message-id', 'from']:
+ if key in display_data:
+ display_data[key] = xml.sax.saxutils.escape(display_data[key])
return (running_data, display_data)
def _slug(self, string):
</head>
<body>
<h2>Notmuch Patches</h2>
+<p>
Generated: {date}<br />
For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>
+</p>
<h3>Views</h3>
'''.format(date=datetime.datetime.utcnow().date()),
footer='</body>\n</html>\n',