[PATCH 15/17] nmbug-status: Quote the title when using it as an id
authorW. Trevor King <wking@tremily.us>
Mon, 3 Feb 2014 10:59:33 +0000 (02:59 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:38 +0000 (09:59 -0800)
38/b4a1503db6e605b70ca20244ab330fb542adac [new file with mode: 0644]

diff --git a/38/b4a1503db6e605b70ca20244ab330fb542adac b/38/b4a1503db6e605b70ca20244ab330fb542adac
new file mode 100644 (file)
index 0000000..f4fb317
--- /dev/null
@@ -0,0 +1,104 @@
+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 1237C429E5F\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:03:10 -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 d6lD6oAYIYAw for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Feb 2014 03:03:04 -0800 (PST)\r
+Received: from qmta05.westchester.pa.mail.comcast.net\r
+       (qmta05.westchester.pa.mail.comcast.net [76.96.62.48])\r
+       by olra.theworths.org (Postfix) with ESMTP id 70FAB429E4E\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:02:45 -0800 (PST)\r
+Received: from omta08.westchester.pa.mail.comcast.net ([76.96.62.12])\r
+       by qmta05.westchester.pa.mail.comcast.net with comcast\r
+       id Mmuy1n0010Fqzac55n2lSj; Mon, 03 Feb 2014 11:02:45 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta08.westchester.pa.mail.comcast.net with comcast\r
+       id Mn0k1n00F152l3L3Un0lt9; Mon, 03 Feb 2014 11:00:45 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 9F080FB4D5F;\r
+       Mon,  3 Feb 2014 03:00:44 -0800 (PST)\r
+Received: (nullmailer pid 712 invoked by uid 1000);\r
+       Mon, 03 Feb 2014 10:59:42 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 15/17] nmbug-status: Quote the title when using it as an id\r
+Date: Mon,  3 Feb 2014 02:59:33 -0800\r
+Message-Id:\r
+ <1e32bfd3b971aea8842fa29a3f7adc5a552a0f79.1391424512.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20121106; t=1391425365;\r
+       bh=0bGE+diFpwijQsDrlzVvKu+t4BiqQY5Qc4iOSa09PqE=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=GgdJZnI5uwE4ovo7jBQ5R7+/o9eqmbs6eGn2NRzjcMWuwVx/6LlVPboPopzVTPlzY\r
+       UEQx2hb0MrHP2Oa3xLKMRox7pASuD75j7Yc4sSiyat0qJ0uamLPQ+19ApR3NSxdjSx\r
+       lk03lVpcaGwXawRc0KuMhyKxKAhyM8TQb38/x2vk6/3thZhBJsesVxYxjIzsh5lSOc\r
+       EggDgwFdTEQbhF/x0RZzFn08Jv8LFCgxLf0BC5HVfAqMnYw6dxiePcEr9OSIlZ5uR2\r
+       A4YfST6VR+dlcvDTh7us27g+lyReK2uGjwVGfpoTCpcqQy60eZWB9IUtYikMOiJxaL\r
+       CMZO8AefP0hxg==\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, 03 Feb 2014 11:03:10 -0000\r
+\r
+Also allow manual id overrides from the JSON config.  Quoting 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
+ devel/nmbug/nmbug-status | 6 ++++--\r
+ 1 file changed, 4 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 3597389..9bdb34f 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -154,12 +154,14 @@ class HtmlPage (Page):\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'] = quote(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
+-- \r
+1.8.5.2.8.g0f6c0d1\r
+\r