Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / e3 / a20007d501ef0aafc692e3dfa5a83d6d6ed300
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
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \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
14         autolearn=disabled\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
38 Message-Id:\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
49         Message-Id;\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
55         L5LzIfgkJ+Ucg==\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
59 Precedence: list\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
70 \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
75 \r
76 border-spacing is from CCS 2.1 [4,5].  I'm using it to avoid\r
77 whitespace between td cells.\r
78 \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
87 rounded corners.\r
88 \r
89 The doubled-braces are escapes from Python's str.format.\r
90 \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
98 ---\r
99  devel/nmbug/nmbug-status | 56 +++++++++++++++++++++++++++++++++++++-----------\r
100  1 file changed, 44 insertions(+), 12 deletions(-)\r
101 \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
107              return\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
112                  stream.write((\r
113 -                    '<tr>\n'\r
114 -                    '  <td>{date}</td>\n'\r
115 -                    '  <td><code>{message-id-term}</code></td>\n'\r
116 -                    '</tr>\n'\r
117 -                    '<tr>\n'\r
118 -                    '  <td>{from}</td>\n'\r
119 -                    '  <td>{subject}</td>\n'\r
120 -                    '</tr>\n'\r
121 +                    '    <tr>\n'\r
122 +                    '      <td>{date}</td>\n'\r
123 +                    '      <td><code>{message-id-term}</code></td>\n'\r
124 +                    '    </tr>\n'\r
125 +                    '    <tr>\n'\r
126 +                    '      <td>{from}</td>\n'\r
127 +                    '      <td>{subject}</td>\n'\r
128 +                    '    </tr>\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
133 +                stream.write(\r
134 +                    '  <tbody><tr><td colspan="2"><br /></td></tr></tbody>\n')\r
135          stream.write('</table>\n')\r
136  \r
137      def _message_display_data(self, *args, **kwargs):\r
138 @@ -242,8 +245,36 @@ _PAGES['html'] = HtmlPage(\r
139      header='''<!DOCTYPE html>\r
140  <html lang="en">\r
141  <head>\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
148 +    table {{\r
149 +      border-spacing: 0;\r
150 +    }}\r
151 +    td {{\r
152 +      padding-left: {border_radius};\r
153 +      padding-right: {border_radius};\r
154 +    }}\r
155 +    tr:first-child td:first-child {{\r
156 +      border-top-left-radius: {border_radius};\r
157 +    }}\r
158 +    tr:first-child td:last-child {{\r
159 +      border-top-right-radius: {border_radius};\r
160 +    }}\r
161 +    tr:last-child td:first-child {{\r
162 +      border-bottom-left-radius: {border_radius};\r
163 +    }}\r
164 +    tr:last-child td:last-child {{\r
165 +      border-bottom-right-radius: {border_radius};\r
166 +    }}\r
167 +    tbody:nth-child(4n+1) tr td {{\r
168 +      background-color: #ffd96e;\r
169 +    }}\r
170 +    tbody:nth-child(4n+3) tr td {{\r
171 +      background-color: #bce;\r
172 +    }}\r
173 +  </style>\r
174  </head>\r
175  <body>\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
179  </p>\r
180  <h3>Views</h3>\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
185      )\r
186  \r
187 -- \r
188 1.8.5.2.8.g0f6c0d1\r
189 \r