From: W. Trevor King Date: Mon, 3 Feb 2014 10:59:33 +0000 (+1600) Subject: [PATCH 15/17] nmbug-status: Quote the title when using it as an id X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=236fcc87d2d9053cc200b41af000ec205f9d7d4f;p=notmuch-archives.git [PATCH 15/17] nmbug-status: Quote the title when using it as an id --- diff --git a/38/b4a1503db6e605b70ca20244ab330fb542adac b/38/b4a1503db6e605b70ca20244ab330fb542adac new file mode 100644 index 000000000..f4fb31770 --- /dev/null +++ b/38/b4a1503db6e605b70ca20244ab330fb542adac @@ -0,0 +1,104 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1237C429E5F + for ; Mon, 3 Feb 2014 03:03:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id d6lD6oAYIYAw for ; + Mon, 3 Feb 2014 03:03:04 -0800 (PST) +Received: from qmta05.westchester.pa.mail.comcast.net + (qmta05.westchester.pa.mail.comcast.net [76.96.62.48]) + by olra.theworths.org (Postfix) with ESMTP id 70FAB429E4E + for ; Mon, 3 Feb 2014 03:02:45 -0800 (PST) +Received: from omta08.westchester.pa.mail.comcast.net ([76.96.62.12]) + by qmta05.westchester.pa.mail.comcast.net with comcast + id Mmuy1n0010Fqzac55n2lSj; Mon, 03 Feb 2014 11:02:45 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta08.westchester.pa.mail.comcast.net with comcast + id Mn0k1n00F152l3L3Un0lt9; Mon, 03 Feb 2014 11:00:45 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 9F080FB4D5F; + Mon, 3 Feb 2014 03:00:44 -0800 (PST) +Received: (nullmailer pid 712 invoked by uid 1000); + Mon, 03 Feb 2014 10:59:42 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH 15/17] nmbug-status: Quote the title when using it as an id +Date: Mon, 3 Feb 2014 02:59:33 -0800 +Message-Id: + <1e32bfd3b971aea8842fa29a3f7adc5a552a0f79.1391424512.git.wking@tremily.us> +X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1 +In-Reply-To: +References: +In-Reply-To: +References: +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; + s=q20121106; t=1391425365; + bh=0bGE+diFpwijQsDrlzVvKu+t4BiqQY5Qc4iOSa09PqE=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id; + b=GgdJZnI5uwE4ovo7jBQ5R7+/o9eqmbs6eGn2NRzjcMWuwVx/6LlVPboPopzVTPlzY + UEQx2hb0MrHP2Oa3xLKMRox7pASuD75j7Yc4sSiyat0qJ0uamLPQ+19ApR3NSxdjSx + lk03lVpcaGwXawRc0KuMhyKxKAhyM8TQb38/x2vk6/3thZhBJsesVxYxjIzsh5lSOc + EggDgwFdTEQbhF/x0RZzFn08Jv8LFCgxLf0BC5HVfAqMnYw6dxiePcEr9OSIlZ5uR2 + A4YfST6VR+dlcvDTh7us27g+lyReK2uGjwVGfpoTCpcqQy60eZWB9IUtYikMOiJxaL + CMZO8AefP0hxg== +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 03 Feb 2014 11:03:10 -0000 + +Also allow manual id overrides from the JSON config. Quoting 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. +--- + devel/nmbug/nmbug-status | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index 3597389..9bdb34f 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -154,12 +154,14 @@ class HtmlPage (Page): + super(HtmlPage, self)._write_header(views=views, stream=stream) + stream.write('
    \n') + for view in views: ++ if 'id' not in view: ++ view['id'] = quote(view['title']) + stream.write( +- '
  • {title}
  • \n'.format(**view)) ++ '
  • {title}
  • \n'.format(**view)) + stream.write('
\n') + + def _write_view_header(self, view, stream): +- stream.write('

{title}

\n'.format(**view)) ++ stream.write('

{title}

\n'.format(**view)) + if 'comment' in view: + stream.write(view['comment']) + stream.write('\n') +-- +1.8.5.2.8.g0f6c0d1 +