[PATCH 4/7] doc/prerst2man.py: Fix 'os.system' -> 'system' typo

2014-04-05 Thread W. Trevor King
Avoid: $ make HAVE_SPHINX=0 HAVE_RST2MAN=1 build-man python ./doc/prerst2man.py ./doc doc/_build/man Traceback (most recent call last): File "./doc/prerst2man.py", line 65, in os.system('set -x; rst2man {0} {1}/{2}.{3}' NameError: name 'os' is not defined make: ***

[PATCH 3/7] doc/prerst2man.py: Use Python-3-compatible octal notation

2014-04-05 Thread W. Trevor King
Python 3 only supports the 0oXXX notation for octal literals [1,2], which have also been supported in 2.x since 2.6 [2]. [1]: https://docs.python.org/3.0/whatsnew/3.0.html#integers [2]: http://legacy.python.org/dev/peps/pep-3127/ --- doc/prerst2man.py | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH 2/7] doc/mkdocdeps.py: Use "with" statement for the output file

2014-04-05 Thread W. Trevor King
Before this patch, the open was unnecessarily early and relied on the process cleanup to close. Neither one of these was a real problem, but PEP 343's context managers (which landed in Python 2.5) make proper cleanup very easy. [1]: http://legacy.python.org/dev/peps/pep-0343/ ---

[PATCH 1/7] doc/mkdocdeps.py: Convert execfile to import

2014-04-05 Thread W. Trevor King
excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, mkdocdeps.py is compatible with both Python 2 and 3. [1]:

[PATCH 0/7] doc: Python 3 compat, rst2man.py support, etc.

2014-04-05 Thread W. Trevor King
ll 3s). I haven't checked the logic though, and I'm not running 3.2 locally anymore, so it's not a big priority for me. Cheers, Trevor [1]: https://docs.python.org/3/whatsnew/3.3.html#pep-414-explicit-unicode-literals [2]: from __future__ import unicode_literals W. Trevor King (7): doc/mkdocdeps.p

[PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-04-05 Thread W. Trevor King
On Sun, Feb 16, 2014 at 07:46:29PM -0400, David Bremner wrote: > pushed the last 4. It looks like there's still a nmbug-status branch on git://notmuchmail.org/git/notmuch. It's an ancestor of debian/0.17-4, and nmbug-status development seems to have calmed back down, so that branch can probably

Re: [PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-04-05 Thread W. Trevor King
On Sun, Feb 16, 2014 at 07:46:29PM -0400, David Bremner wrote: pushed the last 4. It looks like there's still a nmbug-status branch on git://notmuchmail.org/git/notmuch. It's an ancestor of debian/0.17-4, and nmbug-status development seems to have calmed back down, so that branch can probably

[PATCH 0/7] doc: Python 3 compat, rst2man.py support, etc.

2014-04-05 Thread W. Trevor King
haven't checked the logic though, and I'm not running 3.2 locally anymore, so it's not a big priority for me. Cheers, Trevor [1]: https://docs.python.org/3/whatsnew/3.3.html#pep-414-explicit-unicode-literals [2]: from __future__ import unicode_literals W. Trevor King (7): doc/mkdocdeps.py

[PATCH 1/7] doc/mkdocdeps.py: Convert execfile to import

2014-04-05 Thread W. Trevor King
excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, mkdocdeps.py is compatible with both Python 2 and 3. [1]:

[PATCH 4/7] doc/prerst2man.py: Fix 'os.system' - 'system' typo

2014-04-05 Thread W. Trevor King
Avoid: $ make HAVE_SPHINX=0 HAVE_RST2MAN=1 build-man python ./doc/prerst2man.py ./doc doc/_build/man Traceback (most recent call last): File ./doc/prerst2man.py, line 65, in module os.system('set -x; rst2man {0} {1}/{2}.{3}' NameError: name 'os' is not defined make: ***

[PATCH 2/7] doc/mkdocdeps.py: Use with statement for the output file

2014-04-05 Thread W. Trevor King
Before this patch, the open was unnecessarily early and relied on the process cleanup to close. Neither one of these was a real problem, but PEP 343's context managers (which landed in Python 2.5) make proper cleanup very easy. [1]: http://legacy.python.org/dev/peps/pep-0343/ ---

[PATCH 7/7] doc/INSTALL: Remove rst2man reference and other updates

2014-04-05 Thread W. Trevor King
The rst2man target was removed in 9d9a700 (doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN, 2014-03-13), but a reference in the install docs slipped through. While I was removing that reference, I also: * Converted doc/INSTALL to reStructuredText, so I can link to Sphinx

[PATCH 6/7] doc/prerst2man.py: Convert execfile to import

2014-04-05 Thread W. Trevor King
excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, prerst2man.py is compatible with both Python 2 and 3. [1]:

[PATCH 3/7] doc/prerst2man.py: Use Python-3-compatible octal notation

2014-04-05 Thread W. Trevor King
Python 3 only supports the 0oXXX notation for octal literals [1,2], which have also been supported in 2.x since 2.6 [2]. [1]: https://docs.python.org/3.0/whatsnew/3.0.html#integers [2]: http://legacy.python.org/dev/peps/pep-3127/ --- doc/prerst2man.py | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH 7/7] doc/INSTALL: Remove rst2man reference and other updates

2014-04-05 Thread W. Trevor King
On Sat, Apr 05, 2014 at 05:35:49PM -0300, David Bremner wrote: W. Trevor King writes: -- You can build build and install man pages with 'make install-man' + make build-{man|info|html|pdf} most of those those targets now start with sphinx- Ah, looks like that happended

Re: [PATCH 0/2] nmbug-status: make title/blurb configurable

2014-03-13 Thread W. Trevor King
On Thu, Mar 13, 2014 at 01:04:03PM +0100, Jani Nikula wrote: This lets me use nmbug-status for publishing search views in html outside of the nmbug context. I'm sure especially 2/2 can be done better. If someone wants to use their mad python skillz to improve this, it would be great. ;) Both

v3 of boolean folder: patches

2014-03-10 Thread W. Trevor King
On Mon, Mar 10, 2014 at 08:24:50PM +0200, Jani Nikula wrote: > On Mon, 10 Mar 2014, "W. Trevor King" wrote: > > Since patches 06/15 and 07/15 never made it to the list [1] (or gmane > > [2]), I think we need to untag 06/15 in nmbug. It was tagged in > > b3

v3 of boolean folder: patches

2014-03-10 Thread W. Trevor King
On Sat, Mar 08, 2014 at 05:40:45PM -0400, David Bremner wrote: > David Bremner writes: > > > > > I decided that the benefits of being to really apply and test the > > patch series outweighed the fact that one of patchs is about > > 150K. Apologies to those of you on GSM modems and the like. > >

[PATCH v2] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-09 Thread W. Trevor King
With two branches getting fetched (master and config), the branch referenced by FETCH_HEAD is ambiguous. For example, I have: $ cat FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 \ not-for-merge branch 'config' of http://nmbug.tethera.net/git/nmbug-tags

[PATCH v2] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-09 Thread W. Trevor King
With two branches getting fetched (master and config), the branch referenced by FETCH_HEAD is ambiguous. For example, I have: $ cat FETCH_HEAD 41d7bfa7184cc93c9dac139d1674e9530799e3b0 \ not-for-merge branch 'config' of http://nmbug.tethera.net/git/nmbug-tags

[PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:26:33AM -0800, W. Trevor King wrote: > That's going to create ~/.nmbug/.git though, if we want to preserve > the current bare-style ~/.nmbug/ layout, we'd need something like: > > $ TEMPDIR=$(mktemp -d) > $ git clone --no-checkout --separate-g

[PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:43:26AM -0400, David Bremner wrote: > W. Trevor King writes: > > +sub do_clone { > > + my $repository = shift; > > + system ('git', 'clone', '--bare', $repository, $NMBGIT) == 0 > > +or die "'git clone' exited with nonzero v

Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:43:26AM -0400, David Bremner wrote: W. Trevor King writes: +sub do_clone { + my $repository = shift; + system ('git', 'clone', '--bare', $repository, $NMBGIT) == 0 +or die 'git clone' exited with nonzero value\n; + my $branch = git ('symbolic-ref

Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream}

2014-03-08 Thread W. Trevor King
On Sat, Mar 08, 2014 at 08:26:33AM -0800, W. Trevor King wrote: That's going to create ~/.nmbug/.git though, if we want to preserve the current bare-style ~/.nmbug/ layout, we'd need something like: $ TEMPDIR=$(mktemp -d) $ git clone --no-checkout --separate-git-dir=~/.nmbug \ http

Re: [PATCH 1/1] nmbug-status: replace __values__() with values() in OrderedDict stub

2014-02-18 Thread W. Trevor King
On Tue, Feb 18, 2014 at 08:34:52PM +0200, Tomi Ollila wrote: -def __values__(self): +def values(self): Looks good to me. I'm not sure why I used __values__ in the first place; probably just in the __ zone after __init__ and __setitem__. Cheers, Trevor -- This email may be

[PATCH v4 4/4] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-14 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v4 3/4] nmbug-status: Encode output using the user's locale

2014-02-14 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

[PATCH v4 2/4] nmbug-status: Add inter-message padding

2014-02-14 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-02-14 Thread W. Trevor King
.mail.notmuch.general/17225 [4]: id:"87ha8127g8.fsf at zancas.localnet" http://article.gmane.org/gmane.mail.notmuch.general/17239 W. Trevor King (4): nmbug-status: Color threads in HTML output nmbug-status: Add inter-message padding nmbug-status: Encode output using the user

[PATCH v4 4/4] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-14 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v4 0/4] nmbug-status: Python-3-compatibility and general refactoring

2014-02-14 Thread W. Trevor King
.fsf@zancas.localnet http://article.gmane.org/gmane.mail.notmuch.general/17239 W. Trevor King (4): nmbug-status: Color threads in HTML output nmbug-status: Add inter-message padding nmbug-status: Encode output using the user's locale nmbug-status: Hardcode UTF-8 instead of using

[PATCH v4 1/4] nmbug-status: Color threads in HTML output

2014-02-14 Thread W. Trevor King
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

[PATCH v4 3/4] nmbug-status: Encode output using the user's locale

2014-02-14 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff

[PATCH v4 2/4] nmbug-status: Add inter-message padding

2014-02-14 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 10:13:42PM -0400, David Bremner wrote: > I tested patches 1-6, but my fix for patch 4 broke patch 7. > > So maybe it's best if you regenerate the series. The concept of the last > two patches seems OK. Sure. Sorry I botched v3 :/. Do you want to nibble off patches one

[PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 09:58:43PM -0400, David Bremner wrote: > W. Trevor King writes: > > + > > + > /> > > looks like a bad rebase there. Oops. Fixed in my branch and queued for v4. Thanks, Trevor -- This email may be signed or encrypted with GnuPG (http

[PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 08:47:22AM -0800, W. Trevor King wrote: > '''.format(date=datetime.datetime.utcnow().date(), > + encoding=_ENCODING), > inter_message_padding='0.25em', > border_radius='0.5em'), Oops, that should be: encodi

[PATCH v3 8/8] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-13 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v3 5/8] nmbug-status: Escape &, <, and > in HTML display data

2014-02-13 Thread W. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML

[PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
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

[PATCH v3 3/8] nmbug-status: Use and markup where appropriate

2014-02-13 Thread W. Trevor King
* Wrap free text in tags. * Convert to for query strings. * Wrap message-id-term (id:"...") in . The tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The tags don't have much effect without attached CSS, but bare text (phrasing content [2]) in (which

[PATCH v3 2/8] nmbug-status: Slug the title when using it as an id

2014-02-13 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Sluggin avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. I tried just quoting the titles (e.g.

[PATCH v3 1/8] nmbug-status: Anchor with h3 ids instead of a names

2014-02-13 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v3 0/8] nmbug-status: Python-3-compatibility and general refactoring

2014-02-13 Thread W. Trevor King
.guru-group.fi" http://article.gmane.org/gmane.mail.notmuch.general/17209 W. Trevor King (8): nmbug-status: Anchor with h3 ids instead of a names nmbug-status: Slug the title when using it as an id nmbug-status: Use and markup where appropriate nmbug-status: Color threads in HTML output nmbug-statu

[PATCH v3 0/8] nmbug-status: Python-3-compatibility and general refactoring

2014-02-13 Thread W. Trevor King
@zancas.localnet http://thread.gmane.org/gmane.mail.notmuch.general/17167/focus=17200 [4]: id:m2sirpu46i@guru.guru-group.fi http://article.gmane.org/gmane.mail.notmuch.general/17191 [5]: id:m2vbwj79lu@guru.guru-group.fi http://article.gmane.org/gmane.mail.notmuch.general/17209 W. Trevor

[PATCH v3 1/8] nmbug-status: Anchor with h3 ids instead of a names

2014-02-13 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v3 8/8] nmbug-status: Hardcode UTF-8 instead of using the user's locale

2014-02-13 Thread W. Trevor King
David [1] and Tomi [2] both feel that the user's choice of LANG is not explicit enough to have such a strong effect on nmbug-status. For example, cron jobs usually default to LANG=C, and that is going to give you ASCII output: $ LANG=C python -c 'import locale;

[PATCH v3 2/8] nmbug-status: Slug the title when using it as an id

2014-02-13 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Sluggin avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. I tried just quoting the titles (e.g.

[PATCH v3 3/8] nmbug-status: Use code and p markup where appropriate

2014-02-13 Thread W. Trevor King
* Wrap free text in p tags. * Convert blockquote to pcode for query strings. * Wrap message-id-term (id:...) in code. The code tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The p tags don't have much effect without attached CSS, but bare text (phrasing

[PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
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

[PATCH v3 5/8] nmbug-status: Escape , , and in HTML display data

2014-02-13 Thread W. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML

[PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

Re: [PATCH v3 7/8] nmbug-status: Encode output using the user's locale

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 08:47:22AM -0800, W. Trevor King wrote: '''.format(date=datetime.datetime.utcnow().date(), + encoding=_ENCODING), inter_message_padding='0.25em', border_radius='0.5em'), Oops, that should be: encoding=_ENCODING, not: encoding

Re: [PATCH v3 4/8] nmbug-status: Color threads in HTML output

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 09:58:43PM -0400, David Bremner wrote: W. Trevor King writes: + meta http-equiv=Content-Type content=text/html; charset=utf-8 / + meta http-equiv=Content-Type content=text/html; charset={encoding} / looks like a bad rebase there. Oops. Fixed in my branch

Re: [PATCH v3 6/8] nmbug-status: Add inter-message padding

2014-02-13 Thread W. Trevor King
On Thu, Feb 13, 2014 at 10:13:42PM -0400, David Bremner wrote: I tested patches 1-6, but my fix for patch 4 broke patch 7. So maybe it's best if you regenerate the series. The concept of the last two patches seems OK. Sure. Sorry I botched v3 :/. Do you want to nibble off patches one

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 10:13:50PM -0400, David Bremner wrote: > W. Trevor King writes: > > I don't understand why your choice of LANG should depend on the > > interactive-ness of an invocation. > > It's not the choice of LANG, but rather the acceptability of > cr

[PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 07:35:19PM -0400, David Bremner wrote: > W. Trevor King writes: > > HTML 5 for the win :). I also de-namespaced the language; the HTML 5 > > spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I > > stripped it. > > I

Re: [PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 07:35:19PM -0400, David Bremner wrote: W. Trevor King writes: HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. I pushed the first 13 patches in the series

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-12 Thread W. Trevor King
On Wed, Feb 12, 2014 at 10:13:50PM -0400, David Bremner wrote: W. Trevor King writes: I don't understand why your choice of LANG should depend on the interactive-ness of an invocation. It's not the choice of LANG, but rather the acceptability of crashing with an unhandled exception. I'd

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 06:02:09PM -0400, David Bremner wrote: > W. Trevor King writes: > > If a user has set LANG=C, I expect that's what we should use for > > output (in which case dying with an encoding error is the right > > thing to do). > > Perhaps for an intera

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 04:14:45PM +0200, Tomi Ollila wrote: > On Tue, Feb 11 2014, David Bremner wrote: > > W. Trevor King writes: > >> Instead of always writing UTF-8, allow the user to configure the > >> output encoding using their locale. This is useful

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 04:14:45PM +0200, Tomi Ollila wrote: On Tue, Feb 11 2014, David Bremner wrote: W. Trevor King writes: Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal

Re: [PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-11 Thread W. Trevor King
On Tue, Feb 11, 2014 at 06:02:09PM -0400, David Bremner wrote: W. Trevor King writes: If a user has set LANG=C, I expect that's what we should use for output (in which case dying with an encoding error is the right thing to do). Perhaps for an interactive tool, intended mainly to be run

[PATCH v2 20/20] nmbug-status: Add inter-message padding

2014-02-10 Thread W. Trevor King
We already had the tbody with a blank row separating threads (which is not colored); this commit adds a bit of spacing to separate messages within a thread. It will also add a bit of colored padding above the first message and below the final message, but the main goal is to add padding *between*

[PATCH v2 19/20] nmbug-status: Escape &, <, and > in HTML display data

2014-02-10 Thread W. Trevor King
'message-id' and 'from' now have sensitive characters escaped using xml.sax.saxutils.escape [1]. The 'subject' data was already being converted to a link into Gmane; I've escape()d that too, so it doesn't need to be handled ain the same block as 'message-id' and 'from'. This prevents broken HTML

[PATCH v2 18/20] nmbug-status: Color threads in HTML output

2014-02-10 Thread W. Trevor King
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

[PATCH v2 17/20] nmbug-status: Use and markup where appropriate

2014-02-10 Thread W. Trevor King
* Wrap free text in tags. * Convert to for query strings. * Wrap message-id-term (id:"...") in . The tags get nicer default markup (smaller monospace font) for notmuch query terms [1]. The tags don't have much effect without attached CSS, but bare text (phrasing content [2]) in (which

[PATCH v2 16/20] nmbug-status: Slug the title when using it as an id

2014-02-10 Thread W. Trevor King
Also allow manual id overrides from the JSON config. Sluggin avoids errors like: Bad value '#Possible bugs' for attribute href on element a: Whitespace in fragment component. Use %20 in place of spaces. from http://validator.w3.org. I tried just quoting the titles (e.g.

[PATCH v2 15/20] nmbug-status: Anchor with h3 ids instead of a names

2014-02-10 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-10 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-10 Thread W. Trevor King
HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. This shouldn't break anything at tethera, which already serves the status as text/html: $ wget -S http://nmbug.tethera.net/status/

[PATCH v2 12/20] nmbug-status: Normalize table HTML indentation

2014-02-10 Thread W. Trevor King
I don't think I've ever seen '{value}\n' before :p. The new formatting avoids mixing tag levels and content across lines. --- devel/nmbug/nmbug-status | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 11/20] nmbug-status: Add an OrderedDict stub for Python 2.6

2014-02-10 Thread W. Trevor King
Tomi Ollila and David Bremner (and presumably others) are running Python 2.6 on their nmbug-status boxes, so it makes sense to keep support for that version. This commit adds a really minimal OrderedDict stub (e.g. it doesn't handle key removal), but it gets the job done for Page._get_threads.

[PATCH v2 10/20] nmbug-status: Add Page and HtmlPage for modular rendering

2014-02-10 Thread W. Trevor King
I was having trouble understanding the logic of the longish print_view function, so I refactored the output generation into modular bits. The basic text rendering is handled by Page, which has enough hooks that HtmlPage can borrow the logic and slot-in HTML generators. By modularizing the logic

[PATCH v2 09/20] nmbug-status: Add a Python-3-compatible urllib.parse.quote import

2014-02-10 Thread W. Trevor King
Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python 3 [2]. [1]: http://docs.python.org/2/library/urllib.html#urllib.quote [2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote --- devel/nmbug/nmbug-status | 9 ++--- 1 file changed, 6 insertions(+), 3

[PATCH v2 08/20] nmbug-status: Consolidate HTML header printing

2014-02-10 Thread W. Trevor King
Make this all one big string, using '...{date}...'.format(date=...) to inject the date [1]. This syntax was added in Python 2.6, and is preferred to %-formatting in Python 3 [1]. [1]: http://docs.python.org/2/library/stdtypes.html#str.format --- devel/nmbug/nmbug-status | 13 ++--- 1

[PATCH v2 07/20] nmbug-status: Don't require write access

2014-02-10 Thread W. Trevor King
The database in only used for notmuch.Query, so there's no need for write access. This allows nmbug-status to run while the database is being updated, without raising: A Xapian exception occurred opening database: Unable to get write lock on ?: already locked Traceback (most recent call

[PATCH v2 06/20] nmbug-status: Consolidate functions and main code

2014-02-10 Thread W. Trevor King
The definitions of Thread, output_with_separator, and print_view were between the main argparse and view-printing code. Group them together with our existing read_config at the top of the module, which makes for easier reading in the main section. I also: * Made 'headers' a print_view argument

[PATCH v2 04/20] nmbug-status: Factor config-loading out into read_config

2014-02-10 Thread W. Trevor King
By isolating this peripheral handling, we make the core logic of nmbug-status easier to read. --- devel/nmbug/nmbug-status | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 03/20] nmbug-status: Decode Popen output using the user's locale

2014-02-10 Thread W. Trevor King
Avoid: $ ./nmbug-status --list-views Traceback (most recent call last): File "./nmbug-status", line 47, in 'cat-file', 'blob', sha1+':status-config.json'], TypeError: can't concat bytes to str by explicitly converting the byte-stream read from Popen into a Unicode string. On

[PATCH v2 02/20] nmbug-status: Use email.utils instead of rfc822

2014-02-10 Thread W. Trevor King
rfc822 has been deprecated since Python 2.3, and it's gone in Python 3 [1]. [1]: http://docs.python.org/2/library/rfc822.html --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 01/20] nmbug-status: Convert to Python-3-compatible print functions

2014-02-10 Thread W. Trevor King
We shouldn't require folks to install Python 2 to run nmbug-status. --- devel/nmbug/nmbug-status | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index 934c895..b1feee9 100755 ---

[PATCH v2 00/20] nmbug-status: Python-3-compatibility and general refactoring

2014-02-10 Thread W. Trevor King
8190923.GE14197 at odin.tremily.us" http://article.gmane.org/gmane.mail.notmuch.general/17151 [5]: id="20140208221925.GD17142 at odin.tremily.us" http://article.gmane.org/gmane.mail.notmuch.general/17153 [6]: id="20140208231804.GE17142 at odin.tremily.us" http://

[PATCH v2 06/20] nmbug-status: Consolidate functions and main code

2014-02-10 Thread W. Trevor King
The definitions of Thread, output_with_separator, and print_view were between the main argparse and view-printing code. Group them together with our existing read_config at the top of the module, which makes for easier reading in the main section. I also: * Made 'headers' a print_view argument

[PATCH v2 00/20] nmbug-status: Python-3-compatibility and general refactoring

2014-02-10 Thread W. Trevor King
/gmane.mail.notmuch.general/17151 [5]: id=20140208221925.gd17...@odin.tremily.us http://article.gmane.org/gmane.mail.notmuch.general/17153 [6]: id=20140208231804.ge17...@odin.tremily.us http://article.gmane.org/gmane.mail.notmuch.general/17155 W. Trevor King (20): nmbug-status: Convert

[PATCH v2 07/20] nmbug-status: Don't require write access

2014-02-10 Thread W. Trevor King
The database in only used for notmuch.Query, so there's no need for write access. This allows nmbug-status to run while the database is being updated, without raising: A Xapian exception occurred opening database: Unable to get write lock on …: already locked Traceback (most recent call

[PATCH v2 11/20] nmbug-status: Add an OrderedDict stub for Python 2.6

2014-02-10 Thread W. Trevor King
Tomi Ollila and David Bremner (and presumably others) are running Python 2.6 on their nmbug-status boxes, so it makes sense to keep support for that version. This commit adds a really minimal OrderedDict stub (e.g. it doesn't handle key removal), but it gets the job done for Page._get_threads.

[PATCH v2 01/20] nmbug-status: Convert to Python-3-compatible print functions

2014-02-10 Thread W. Trevor King
We shouldn't require folks to install Python 2 to run nmbug-status. --- devel/nmbug/nmbug-status | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index 934c895..b1feee9 100755 ---

[PATCH v2 15/20] nmbug-status: Anchor with h3 ids instead of a names

2014-02-10 Thread W. Trevor King
HTML 5 allows id attributes on all HTML elements [1], but restricts names to particular cases [2]. Attaching the id attribute to the h3 element allows us to drop the anchor a element altogether. [1]: http://www.w3.org/TR/html5/dom.html#the-id-attribute [2]:

[PATCH v2 04/20] nmbug-status: Factor config-loading out into read_config

2014-02-10 Thread W. Trevor King
By isolating this peripheral handling, we make the core logic of nmbug-status easier to read. --- devel/nmbug/nmbug-status | 45 + 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 12/20] nmbug-status: Normalize table HTML indentation

2014-02-10 Thread W. Trevor King
I don't think I've ever seen '/tdtd{value}\n' before :p. The new formatting avoids mixing tag levels and content across lines. --- devel/nmbug/nmbug-status | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 14/20] nmbug-status: Encode output using the user's locale

2014-02-10 Thread W. Trevor King
Instead of always writing UTF-8, allow the user to configure the output encoding using their locale. This is useful for previewing output in the terminal, for poor souls that don't use UTF-8 locales ;). --- devel/nmbug/nmbug-status | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

[PATCH v2 02/20] nmbug-status: Use email.utils instead of rfc822

2014-02-10 Thread W. Trevor King
rfc822 has been deprecated since Python 2.3, and it's gone in Python 3 [1]. [1]: http://docs.python.org/2/library/rfc822.html --- devel/nmbug/nmbug-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index

[PATCH v2 05/20] nmbug-status: Add metavars for --config and --get-query

2014-02-10 Thread W. Trevor King
Now the suggested usage (listed by 'nmbug-status --help') is: usage: nmbug-status [-h] [--text] [--config PATH] [--list-views] [--get-query VIEW] instead of the less obvious: usage: nmbug-status [-h] [--text] [--config CONFIG] [--list-views]

[PATCH v2 09/20] nmbug-status: Add a Python-3-compatible urllib.parse.quote import

2014-02-10 Thread W. Trevor King
Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python 3 [2]. [1]: http://docs.python.org/2/library/urllib.html#urllib.quote [2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote --- devel/nmbug/nmbug-status | 9 ++--- 1 file changed, 6 insertions(+), 3

[PATCH v2 18/20] nmbug-status: Color threads in HTML output

2014-02-10 Thread W. Trevor King
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

[PATCH v2 13/20] nmbug-status: Convert from XHTML 1.0 to HTML 5

2014-02-10 Thread W. Trevor King
HTML 5 for the win :). I also de-namespaced the language; the HTML 5 spec allows a vestigial xml:lang attribute, but it's a no-op [1], so I stripped it. This shouldn't break anything at tethera, which already serves the status as text/html: $ wget -S http://nmbug.tethera.net/status/

<    1   2   3   4   5   >