--- /dev/null
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 56615431FC3\r
+ for <notmuch@notmuchmail.org>; Thu, 13 Feb 2014 08:50:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id IDLMxb92iHMn for <notmuch@notmuchmail.org>;\r
+ Thu, 13 Feb 2014 08:50:45 -0800 (PST)\r
+Received: from qmta02.westchester.pa.mail.comcast.net\r
+ (qmta02.westchester.pa.mail.comcast.net [76.96.62.24])\r
+ by olra.theworths.org (Postfix) with ESMTP id 553A9431FB6\r
+ for <notmuch@notmuchmail.org>; Thu, 13 Feb 2014 08:50:45 -0800 (PST)\r
+Received: from omta22.westchester.pa.mail.comcast.net ([76.96.62.73])\r
+ by qmta02.westchester.pa.mail.comcast.net with comcast\r
+ id Rrur1n0081ap0As51sqlvu; Thu, 13 Feb 2014 16:50:45 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta22.westchester.pa.mail.comcast.net with comcast\r
+ id Rsok1n005152l3L3isoljD; Thu, 13 Feb 2014 16:48:45 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+ by odin.tremily.us (Postfix) with ESMTPS id 1BC1F102DA02;\r
+ Thu, 13 Feb 2014 08:48:43 -0800 (PST)\r
+Received: (nullmailer pid 17985 invoked by uid 1000);\r
+ Thu, 13 Feb 2014 16:47:29 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 2/8] nmbug-status: Slug the title when using it as an id\r
+Date: Thu, 13 Feb 2014 08:47:17 -0800\r
+Message-Id:\r
+ <4755c683a14500c996683ef5cf271be3c7f4f9f3.1392309570.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1392309570.git.wking@tremily.us>\r
+References: <cover.1392309570.git.wking@tremily.us>\r
+In-Reply-To: <cover.1392309570.git.wking@tremily.us>\r
+References: <cover.1392309570.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20121106; t=1392310245;\r
+ bh=U4aJhZgQIh74J6bF214XjQxBHvdfqkJPm6GPKWzusQc=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=fpTKngdzz2RzRIbH1opy9CLlM+YrWTB/8BtLvZA8UG55+Ovj1NITj2K5oCrKt5iJ0\r
+ 25BxmIppmmonfwr048MT1/sMNFczyJL5xdO2ybCKrNo0GlFIXKQhL/uXB4llsjgrVw\r
+ dIxuNNmg68Dtd9GG3u0s1g2Y5IzbPPOeo4x1aAjPOaWxYlgm5Jjpu2tLHPsKvphFGo\r
+ IAs8s6JIEqBSGwCn7mpjB0Gc1IDbE22YQL8C+v13hNbdkQU1T6sA+cmqQE7i4xCt6b\r
+ k+L4O8ZrGdZlPNomd0h3Q8JDDHZNW/76n/kAbUZhIUqkSPIr2OmwStnE9eGaT1qXiD\r
+ dc/LHROC+aOhA==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 13 Feb 2014 16:50:51 -0000\r
+\r
+Also allow manual id overrides from the JSON config. Sluggin avoids\r
+errors like:\r
+\r
+ Bad value '#Possible bugs' for attribute href on element a:\r
+ Whitespace in fragment component. Use %20 in place of spaces.\r
+\r
+from http://validator.w3.org.\r
+\r
+I tried just quoting the titles (e.g. 'Possible%20bugs'), but that\r
+didn't work (at least with Firefox 24.2.0). Slugging avoids any\r
+ambiguity over when the quotes are expanded in the client. The specs\r
+are unclear about quoting, saying only [1]:\r
+\r
+ Value: Any string, with the following restrictions:\r
+\r
+ must be at least one character long\r
+ must not contain any space characters\r
+\r
+[1]: http://dev.w3.org/html5/markup/global-attributes.html#common.attrs.id\r
+---\r
+ devel/nmbug/nmbug-status | 12 ++++++++++--\r
+ 1 file changed, 10 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 40e6896..9fde20e 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -21,6 +21,7 @@ except ImportError: # Python 2\r
+ import json\r
+ import argparse\r
+ import os\r
++import re\r
+ import sys\r
+ import subprocess\r
+ \r
+@@ -168,16 +169,20 @@ class Page (object):\r
+ \r
+ \r
+ class HtmlPage (Page):\r
++ _slug_regexp = re.compile('\W+')\r
++\r
+ def _write_header(self, views, stream):\r
+ super(HtmlPage, self)._write_header(views=views, stream=stream)\r
+ stream.write('<ul>\n')\r
+ for view in views:\r
++ if 'id' not in view:\r
++ view['id'] = self._slug(view['title'])\r
+ stream.write(\r
+- '<li><a href="#{title}">{title}</a></li>\n'.format(**view))\r
++ '<li><a href="#{id}">{title}</a></li>\n'.format(**view))\r
+ stream.write('</ul>\n')\r
+ \r
+ def _write_view_header(self, view, stream):\r
+- stream.write('<h3 id="{title}">{title}</h3>\n'.format(**view))\r
++ stream.write('<h3 id="{id}">{title}</h3>\n'.format(**view))\r
+ if 'comment' in view:\r
+ stream.write(view['comment'])\r
+ stream.write('\n')\r
+@@ -224,6 +229,9 @@ class HtmlPage (Page):\r
+ ).format(**d)\r
+ return (running_data, display_data)\r
+ \r
++ def _slug(self, string):\r
++ return self._slug_regexp.sub('-', string)\r
++\r
+ \r
+ _PAGES['text'] = Page()\r
+ _PAGES['html'] = HtmlPage(\r
+-- \r
+1.8.5.2.8.g0f6c0d1\r
+\r