--- /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 50D7E421160\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:45:08 -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 XNHEnDkSXNzy for <notmuch@notmuchmail.org>;\r
+ Mon, 10 Feb 2014 10:45:03 -0800 (PST)\r
+Received: from qmta13.westchester.pa.mail.comcast.net\r
+ (qmta13.westchester.pa.mail.comcast.net [76.96.59.243])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4A4B2429E41\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:44:03 -0800 (PST)\r
+Received: from omta15.westchester.pa.mail.comcast.net ([76.96.62.87])\r
+ by qmta13.westchester.pa.mail.comcast.net with comcast\r
+ id QeJC1n0031swQuc5Dik1Ad; Mon, 10 Feb 2014 18:44:01 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+ by omta15.westchester.pa.mail.comcast.net with comcast\r
+ id Qihz1n01A152l3L3bii0ft; Mon, 10 Feb 2014 18:42:00 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+ by odin.tremily.us (Postfix) with ESMTPS id 853D010167C1;\r
+ Mon, 10 Feb 2014 10:41:59 -0800 (PST)\r
+Received: (nullmailer pid 1278 invoked by uid 1000);\r
+ Mon, 10 Feb 2014 18:40:45 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 16/20] nmbug-status: Slug the title when using it as an id\r
+Date: Mon, 10 Feb 2014 10:40:37 -0800\r
+Message-Id:\r
+ <a0b13a24fabf443c7c4f954c1fda50cb2db761f8.1392056624.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1392056624.git.wking@tremily.us>\r
+References: <cover.1392056624.git.wking@tremily.us>\r
+In-Reply-To: <cover.1392056624.git.wking@tremily.us>\r
+References: <cover.1392056624.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20121106; t=1392057841;\r
+ bh=5c3DZNU92key6Fiks4Dxs8lHBDjvARDV5JrrIZJL45A=;\r
+ h=Received:Received:Received:Received:From:To:Subject:Date:\r
+ Message-Id;\r
+ b=PbK5sEN/0sxUuvbJEDy54SqrUxMCqx5FIfne9X6eeccAhfbaW6hwodelT9Ow8K6a8\r
+ DhiPrYJN/9JWeyBlXvcAkZd5VxUnMK9l3JAVcH6vF2mGTDgpqrsrviCsY/7GBvN3id\r
+ JSD0YO9biImgf4krl3KnHMdZesTHRjmXw1gV9MOaUMUIHxZU1NTmRFuK6bxY57dvH2\r
+ 7j3BtQ44qD5Pb+K+tl+RwwTI5xLL36ZOJhgMTOWD7ztg6ivIXXRL5Dj6Fn8z80YKhC\r
+ PmTWtusmWmdqL9pR2og2NySOPSpcF/5QMbxYcV1TajL0lEplDJQxbf7+iepHkznZf+\r
+ wCpu8BkgKqw1w==\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: Mon, 10 Feb 2014 18:45:08 -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 2b1f364..989d065 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