From fce459b48be4d43749a1900577390ca9a9da398e Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 15 Feb 2014 08:48:52 +1600
Subject: [PATCH] [PATCH v4 1/4] nmbug-status: Color threads in HTML output
---
3e/c7d003187a99d6f3ce476a5cc7587ad9d33438 | 188 ++++++++++++++++++++++
1 file changed, 188 insertions(+)
create mode 100644 3e/c7d003187a99d6f3ce476a5cc7587ad9d33438
diff --git a/3e/c7d003187a99d6f3ce476a5cc7587ad9d33438 b/3e/c7d003187a99d6f3ce476a5cc7587ad9d33438
new file mode 100644
index 000000000..ec70a45e2
--- /dev/null
+++ b/3e/c7d003187a99d6f3ce476a5cc7587ad9d33438
@@ -0,0 +1,188 @@
+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 1F1AB431FC2
+ for ; Fri, 14 Feb 2014 08:52:21 -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 Xw4i8B8aHNuj for ;
+ Fri, 14 Feb 2014 08:52:13 -0800 (PST)
+Received: from qmta08.westchester.pa.mail.comcast.net
+ (qmta08.westchester.pa.mail.comcast.net [76.96.62.80])
+ by olra.theworths.org (Postfix) with ESMTP id 573A2431FBC
+ for ; Fri, 14 Feb 2014 08:52:13 -0800 (PST)
+Received: from omta14.westchester.pa.mail.comcast.net ([76.96.62.60])
+ by qmta08.westchester.pa.mail.comcast.net with comcast
+ id SEvt1n0061HzFnQ58GsCoN; Fri, 14 Feb 2014 16:52:13 +0000
+Received: from odin.tremily.us ([24.18.63.50])
+ by omta14.westchester.pa.mail.comcast.net with comcast
+ id SGqB1n00R152l3L3aGqCfR; Fri, 14 Feb 2014 16:50:13 +0000
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])
+ by odin.tremily.us (Postfix) with ESMTPS id 6290B103A9A0;
+ Fri, 14 Feb 2014 08:50:11 -0800 (PST)
+Received: (nullmailer pid 18383 invoked by uid 1000);
+ Fri, 14 Feb 2014 16:48:57 -0000
+From: "W. Trevor King"
+To: notmuch@notmuchmail.org
+Subject: [PATCH v4 1/4] nmbug-status: Color threads in HTML output
+Date: Fri, 14 Feb 2014 08:48:52 -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=1392396733;
+ bh=38zNAfzgI9JTABLqHGVuexbLAvczTWS39FsLjXEa3u4=;
+ h=Received:Received:Received:Received:From:To:Subject:Date:
+ Message-Id;
+ b=HcyF61ppZL1JIUhYGoG8dFN1HyoHtIzyhHLq+fXjdTeoBazmq6IJAiHPT/AnLbSRn
+ tiwcCGWfY2fDwRxLURvX1lRrsDBNRGJPClGB0DeQMws6gI4ikCt3ucf3Umg7pn48VD
+ Saiz+KdevkNEGZyYiVNHLEnYT1juINgzf9rKMb/mKw0jbsWjn99WrrM6IRdrZKsVyQ
+ XNHiJ5k9Xbc0HbQOesHUba5ETCE1fS4OT5ZWLpeSRthCQT6qLT8P03grdEhcCA+m7k
+ U/ZxIgYgYlry2F1y5lTsCd+29zJb+Ya7+OzALSRg4hpTDbKZoRPFskC3DrQ/0adsO6
+ Jx8aU6A+fZXMg==
+Cc: Tomi Ollila
+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: Fri, 14 Feb 2014 16:52:21 -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 | 55 +++++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 43 insertions(+), 12 deletions(-)
+
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
+index 1c390e6..a8bacab 100755
+--- a/devel/nmbug/nmbug-status
++++ b/devel/nmbug/nmbug-status
+@@ -205,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'
+- ' {date} | \n'
+- ' {message-id-term} | \n'
+- '
\n'
+- '\n'
+- ' {from} | \n'
+- ' {subject} | \n'
+- '
\n'
++ ' \n'
++ ' {date} | \n'
++ ' {message-id-term} | \n'
++ '
\n'
++ ' \n'
++ ' {from} | \n'
++ ' {subject} | \n'
++ '
\n'
+ ).format(**message_display_data))
++ stream.write(' \n')
+ if thread != threads[-1]:
+- stream.write('
|
\n')
++ stream.write(
++ '
|
\n')
+ stream.write('
\n')
+
+ def _message_display_data(self, *args, **kwargs):
+@@ -246,8 +249,35 @@ _PAGES['html'] = HtmlPage(
+ header='''
+
+
+-
+-Notmuch Patches
++
++ Notmuch Patches
++
+
+
+ Notmuch Patches
+@@ -256,7 +286,8 @@ Generated: {date}
+ For more infomation see nmbug
+
+ Views
+-'''.format(date=datetime.datetime.utcnow().date()),
++'''.format(date=datetime.datetime.utcnow().date(),
++ border_radius='0.5em'),
+ footer='\n\n',
+ )
+
+--
+1.8.5.2.8.g0f6c0d1
+
--
2.26.2