From a267ab62997c9e8354f809a0b40e22f8e6af594f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 4 Feb 2014 02:59:35 +1600 Subject: [PATCH] [PATCH 17/17] nmbug-status: Color threads in HTML output --- 32/2e9fda7fea45f4adc6ad54a48175ddf9b5a7b7 | 177 ++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 32/2e9fda7fea45f4adc6ad54a48175ddf9b5a7b7 diff --git a/32/2e9fda7fea45f4adc6ad54a48175ddf9b5a7b7 b/32/2e9fda7fea45f4adc6ad54a48175ddf9b5a7b7 new file mode 100644 index 000000000..ca27402c3 --- /dev/null +++ b/32/2e9fda7fea45f4adc6ad54a48175ddf9b5a7b7 @@ -0,0 +1,177 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 0ED6E429E39 + for ; Mon, 3 Feb 2014 03:01:22 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 3SwRkF6JHdFF for ; + Mon, 3 Feb 2014 03:01:15 -0800 (PST) +Received: from qmta09.westchester.pa.mail.comcast.net + (qmta09.westchester.pa.mail.comcast.net [76.96.62.96]) + by olra.theworths.org (Postfix) with ESMTP id 5ED83431FDB + for ; Mon, 3 Feb 2014 03:00:47 -0800 (PST) +Received: from omta06.westchester.pa.mail.comcast.net ([76.96.62.51]) + by qmta09.westchester.pa.mail.comcast.net with comcast + id Mn0E1n00516LCl059n0myQ; Mon, 03 Feb 2014 11:00:46 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta06.westchester.pa.mail.comcast.net with comcast + id Mn0l1n00p152l3L3Sn0mjA; Mon, 03 Feb 2014 11:00:46 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id A2D49FB4D63; + Mon, 3 Feb 2014 03:00:45 -0800 (PST) +Received: (nullmailer pid 716 invoked by uid 1000); + Mon, 03 Feb 2014 10:59:42 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH 17/17] nmbug-status: Color threads in HTML output +Date: Mon, 3 Feb 2014 02:59:35 -0800 +Message-Id: + +X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1 +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20121106; t=1391425246; + bh=rB6hcxHENRH544GZz+amuY/2PGFzSEfouPR2fTv1f90=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=mtD4FNMjii2Dvx5jEvD0obzqj8C0XjDzZOrW48wv6GbZF+/mU6XbAxyd0myKyBvIT + 0RusQZpSHrN6NJoTWl54I6/eLKQRxrynMHJij1O6yrXhQnRpbwszEQcTtIm4Tu/BZP + +HZT02BjrODm38JtC4EQpZPNbx1tIEGqkgyBQczv8OcVd2QNzO5UgW3NnnN0pLjwy/ + 8MmHXPuHMgvHMNnm1WfXK5Dwa7UuwwRm67nkJQefTPIQNUKl/3MWc5a5kI8w6L03OE + +UiiXB5tgVryuz56F3i4DREkwQd10wdY6bRrmkiiAH1DLuW6Qg4/NsY28K5CrBck3J + STIUKCiORFjKg== +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 03 Feb 2014 11:01:22 -0000 + +Add tbody sections so we don't have to color every row. Multiple +tbody sections are allowed [1]. Use CSS 3's nth-child to handle +even/odd coloring (skipping the spacer rows) [2], which is supported +on the major browsers [3]. + +border-spacing is from CCS 2.1 [4,5]. I'm using it to avoid +whitespace between td cells. + +border-radius is from CCS 3 [6,7]. I'm using it to make the colored +sections a bit less harsh. I tried adding rounded borders to the +tbody itself doesn't work, but I couldn't get that to work without +setting the tbody's display to 'block'. That rounded the corners, but +collapsed the cell spacing (e.g. columns were no longer aligned). +This commit's by-corner-td approach is not particularly elegant, but +it works. The td padding entries just ensure that the cell body is +suitably far from the edges that it doesn't fall outside of the +rounded corners. + +The doubled-braces are escapes from Python's str.format. + +[1]: http://www.w3.org/TR/html5/tabular-data.html#the-table-element +[2]: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo +[3]: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#Browser_compatibility +[4]: http://www.w3.org/TR/CSS2/tables.html#propdef-border-spacing +[5]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing#Browser_compatibility +[6]: http://www.w3.org/TR/css3-background/#the-border-radius +[7]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#Browser_compatibility +--- + devel/nmbug/nmbug-status | 52 ++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 41 insertions(+), 11 deletions(-) + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index 21fb481..f1adf65 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -183,19 +183,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): +@@ -218,8 +221,35 @@ _PAGES['html'] = HtmlPage( + header=''' + + +- +-Notmuch Patches ++ ++ Notmuch Patches ++ + + +

Notmuch Patches

+-- +1.8.5.2.8.g0f6c0d1 + -- 2.26.2