From: W. Trevor King
Date: Fri, 14 Feb 2014 16:48:52 +0000 (-0800)
Subject: nmbug-status: Color threads in HTML output
X-Git-Tag: 0.18_rc0~144
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1aa56c2ac54369dbf195914772415c8c71aee6eb;p=notmuch.git
nmbug-status: Color threads in HTML output
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
---
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 1c390e6d..a8bacabe 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',
)