1 Return-Path: <wking@tremily.us>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 141AC431FAE
\r
6 for <notmuch@notmuchmail.org>; Thu, 13 Feb 2014 08:50:59 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
13 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 2XQbE-PhYmYV for <notmuch@notmuchmail.org>;
\r
18 Thu, 13 Feb 2014 08:50:51 -0800 (PST)
\r
19 Received: from qmta12.westchester.pa.mail.comcast.net
\r
20 (qmta12.westchester.pa.mail.comcast.net [76.96.59.227])
\r
21 by olra.theworths.org (Postfix) with ESMTP id 55C54431FBD
\r
22 for <notmuch@notmuchmail.org>; Thu, 13 Feb 2014 08:50:46 -0800 (PST)
\r
23 Received: from omta16.westchester.pa.mail.comcast.net ([76.96.62.88])
\r
24 by qmta12.westchester.pa.mail.comcast.net with comcast
\r
25 id RqMu1n0011uE5Es5CsqlbU; Thu, 13 Feb 2014 16:50:45 +0000
\r
26 Received: from odin.tremily.us ([24.18.63.50])
\r
27 by omta16.westchester.pa.mail.comcast.net with comcast
\r
28 id Rsol1n00K152l3L3csomCE; Thu, 13 Feb 2014 16:48:46 +0000
\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])
\r
30 by odin.tremily.us (Postfix) with ESMTPS id 1CBE5102DA06;
\r
31 Thu, 13 Feb 2014 08:48:45 -0800 (PST)
\r
32 Received: (nullmailer pid 17989 invoked by uid 1000);
\r
33 Thu, 13 Feb 2014 16:47:29 -0000
\r
34 From: "W. Trevor King" <wking@tremily.us>
\r
35 To: notmuch@notmuchmail.org
\r
36 Subject: [PATCH v3 4/8] nmbug-status: Color threads in HTML output
\r
37 Date: Thu, 13 Feb 2014 08:47:19 -0800
\r
39 <8b9398c67286de027038a47db5925b558da0bf28.1392309570.git.wking@tremily.us>
\r
40 X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1
\r
41 In-Reply-To: <cover.1392309570.git.wking@tremily.us>
\r
42 References: <cover.1392309570.git.wking@tremily.us>
\r
43 In-Reply-To: <cover.1392309570.git.wking@tremily.us>
\r
44 References: <cover.1392309570.git.wking@tremily.us>
\r
45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
\r
46 s=q20121106; t=1392310245;
\r
47 bh=3sxTh78IUXAYTbl0NrkctvdJScbYFJ/4LBHZoq9tWxY=;
\r
48 h=Received:Received:Received:Received:From:To:Subject:Date:
\r
50 b=tGgJFzfC8p/JLrUz/sUaO6iZR/9ayETPcqBRZ+CI1oybQoSdvn0pPDavBr87m923Y
\r
51 BMukuY15QzuQ09o83V0PJsQRsuMRAyjaFWu7RkYBAr3mOCKx2wgfrxEQlRnscwK3cZ
\r
52 /+bKChLM+L9wUqIx3O7hYjjQQ/NgS6ygOw08brOoXFDcM/oU9RPD7me8DvPtfBZKaD
\r
53 pV763Hp/qdWpAwiwtT23Hyj8vlmj9IyA9NNOTRgXcg1rm7CCdI4jc4Au4MK+tPK+6a
\r
54 1AyNMD/2g5aJeA9kBSTFXodiURP7dX/0qtJYeErPqHJeqoyS+//uNVoSNtNJlyD44A
\r
56 Cc: Tomi Ollila <tomi.ollila@iki.fi>
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Thu, 13 Feb 2014 16:50:59 -0000
\r
71 Add tbody sections so we don't have to color every row. Multiple
\r
72 tbody sections are allowed [1]. Use CSS 3's nth-child to handle
\r
73 even/odd coloring (skipping the spacer rows) [2], which is supported
\r
74 on the major browsers [3].
\r
76 border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid
\r
77 whitespace between td cells.
\r
79 border-radius is from CCS 3 [6,7]. I'm using it to make the colored
\r
80 sections a bit less harsh. I tried adding rounded borders to the
\r
81 tbody itself doesn't work, but I couldn't get that to work without
\r
82 setting the tbody's display to 'block'. That rounded the corners, but
\r
83 collapsed the cell spacing (e.g. columns were no longer aligned).
\r
84 This commit's by-corner-td approach is not particularly elegant, but
\r
85 it works. The td padding entries just ensure that the cell body is
\r
86 suitably far from the edges that it doesn't fall outside of the
\r
89 The doubled-braces are escapes from Python's str.format.
\r
91 [1]: http://www.w3.org/TR/html5/tabular-data.html#the-table-element
\r
92 [2]: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo
\r
93 [3]: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#Browser_compatibility
\r
94 [4]: http://www.w3.org/TR/CSS2/tables.html#propdef-border-spacing
\r
95 [5]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing#Browser_compatibility
\r
96 [6]: http://www.w3.org/TR/css3-background/#the-border-radius
\r
97 [7]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#Browser_compatibility
\r
99 devel/nmbug/nmbug-status | 56 +++++++++++++++++++++++++++++++++++++-----------
\r
100 1 file changed, 44 insertions(+), 12 deletions(-)
\r
102 diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
\r
103 index 6a156af..92552a4 100755
\r
104 --- a/devel/nmbug/nmbug-status
\r
105 +++ b/devel/nmbug/nmbug-status
\r
106 @@ -204,19 +204,22 @@ class HtmlPage (Page):
\r
108 stream.write('<table>\n')
\r
109 for thread in threads:
\r
110 + stream.write(' <tbody>\n')
\r
111 for message_display_data in thread:
\r
114 - ' <td>{date}</td>\n'
\r
115 - ' <td><code>{message-id-term}</code></td>\n'
\r
118 - ' <td>{from}</td>\n'
\r
119 - ' <td>{subject}</td>\n'
\r
122 + ' <td>{date}</td>\n'
\r
123 + ' <td><code>{message-id-term}</code></td>\n'
\r
126 + ' <td>{from}</td>\n'
\r
127 + ' <td>{subject}</td>\n'
\r
129 ).format(**message_display_data))
\r
130 + stream.write(' </tbody>\n')
\r
131 if thread != threads[-1]:
\r
132 - stream.write('<tr><td colspan="2"><br /></td></tr>\n')
\r
134 + ' <tbody><tr><td colspan="2"><br /></td></tr></tbody>\n')
\r
135 stream.write('</table>\n')
\r
137 def _message_display_data(self, *args, **kwargs):
\r
138 @@ -242,8 +245,36 @@ _PAGES['html'] = HtmlPage(
\r
139 header='''<!DOCTYPE html>
\r
142 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
143 -<title>Notmuch Patches</title>
\r
144 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
145 + <meta http-equiv="Content-Type" content="text/html; charset={encoding}" />
\r
146 + <title>Notmuch Patches</title>
\r
147 + <style media="screen" type="text/css">
\r
149 + border-spacing: 0;
\r
152 + padding-left: {border_radius};
\r
153 + padding-right: {border_radius};
\r
155 + tr:first-child td:first-child {{
\r
156 + border-top-left-radius: {border_radius};
\r
158 + tr:first-child td:last-child {{
\r
159 + border-top-right-radius: {border_radius};
\r
161 + tr:last-child td:first-child {{
\r
162 + border-bottom-left-radius: {border_radius};
\r
164 + tr:last-child td:last-child {{
\r
165 + border-bottom-right-radius: {border_radius};
\r
167 + tbody:nth-child(4n+1) tr td {{
\r
168 + background-color: #ffd96e;
\r
170 + tbody:nth-child(4n+3) tr td {{
\r
171 + background-color: #bce;
\r
176 <h2>Notmuch Patches</h2>
\r
177 @@ -252,7 +283,8 @@ Generated: {date}<br />
\r
178 For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>
\r
181 -'''.format(date=datetime.datetime.utcnow().date()),
\r
182 +'''.format(date=datetime.datetime.utcnow().date(),
\r
183 + border_radius='0.5em'),
\r
184 footer='</body>\n</html>\n',
\r