X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug-status;h=c4532f1873799e1693fd9d3c60b979f444019f7e;hb=ffed8f2866a567d52eebeca02d3c362de07efc9d;hp=6a156af28250e5309a968d1791be38da29c2e00a;hpb=aa32d2579b0aa4c8c8a31a1d6060445b254b2be2;p=notmuch diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index 6a156af2..c4532f18 100755 --- a/devel/nmbug/nmbug-status +++ b/devel/nmbug/nmbug-status @@ -24,6 +24,7 @@ import os import re import sys import subprocess +import xml.sax.saxutils _ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding() @@ -89,7 +90,7 @@ class Page (object): byte_stream = sys.stdout.buffer except AttributeError: # Python 2 byte_stream = sys.stdout - stream = codecs.getwriter(encoding='UTF-8')(stream=byte_stream) + stream = codecs.getwriter(encoding=_ENCODING)(stream=byte_stream) self._write_header(views=views, stream=stream) for view in views: self._write_view(database=database, view=view, stream=stream) @@ -204,19 +205,22 @@ class HtmlPage (Page): return stream.write('\n') for thread in threads: + stream.write(' \n') for message_display_data in thread: stream.write(( - '\n' - ' \n' - ' \n' - '\n' - '\n' - ' \n' - ' \n' - '\n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' ).format(**message_display_data)) + stream.write(' \n') if thread != threads[-1]: - stream.write('\n') + stream.write( + ' \n') stream.write('
{date}{message-id-term}
{from}{subject}
{date}{message-id-term}
{from}{subject}


\n') def _message_display_data(self, *args, **kwargs): @@ -226,11 +230,14 @@ class HtmlPage (Page): 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'] = ( '{subject}' ).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): @@ -242,8 +249,41 @@ _PAGES['html'] = HtmlPage( header=''' - -Notmuch Patches + + Notmuch Patches +

Notmuch Patches

@@ -252,7 +292,10 @@ Generated: {date}
For more infomation see nmbug

Views

-'''.format(date=datetime.datetime.utcnow().date()), +'''.format(date=datetime.datetime.utcnow().date(), + encoding=_ENCODING, + inter_message_padding='0.25em', + border_radius='0.5em'), footer='\n\n', )