aboutsummaryrefslogtreecommitdiffhomepage
path: root/sprinter-text.c
diff options
context:
space:
mode:
authorGravatar W. Trevor King <wking@tremily.us>2014-02-10 10:40:31 -0800
committerGravatar David Bremner <david@tethera.net>2014-02-10 22:51:03 -0400
commit98cb4779c02a07c0405073ca4a1e8a9006844904 (patch)
tree80ca4b3783c27699a56ecafaca0ee18afd6790d2 /sprinter-text.c
parent7b7a83cc32c90bc581256ea677d839adc85f1640 (diff)
nmbug-status: Add Page and HtmlPage for modular rendering
I was having trouble understanding the logic of the longish print_view function, so I refactored the output generation into modular bits. The basic text rendering is handled by Page, which has enough hooks that HtmlPage can borrow the logic and slot-in HTML generators. By modularizing the logic it should also be easier to build other renderers if folks want to customize the layout for other projects. Timezones ========= This commit has not effect on the output, except that some dates have been converted from the sender's timezone to UTC due to: - val = m.get_header(header) - ... - if header == 'date': - val = str.join(' ', val.split(None)[1:4]) - val = str(datetime.datetime.strptime(val, '%d %b %Y').date()) ... + value = str(datetime.datetime.utcfromtimestamp( + message.get_date()).date()) I also tweaked the HTML header date to be utcnow instead of the local now() to make all times independent of the generator's local time. This matches Gmane, which converts all Date headers to UTC (although they use a 'GMT' suffix). Notmuch uses g_mime_utils_header_decode_date to calculate the UTC timestamps, but uses a NULL tz_offset which drops the information we'd need to get back to the sender's local time [1]. With the generator's local time arbitrarily different from the sender's and viewer's local time, sticking with UTC seems the best bet. [1]: https://developer.gnome.org/gmime/stable/gmime-gmime-utils.html#g-mime-utils-header-decode-date
Diffstat (limited to 'sprinter-text.c')
0 files changed, 0 insertions, 0 deletions