[PATCH 2/2] nmbug-status: make output title and blurb configurable
authorJani Nikula <jani@nikula.org>
Thu, 13 Mar 2014 12:04:05 +0000 (13:04 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:45 +0000 (10:00 -0800)
3d/18795ef2f4fd68e14f730a99cecef7ab9fde03 [new file with mode: 0644]

diff --git a/3d/18795ef2f4fd68e14f730a99cecef7ab9fde03 b/3d/18795ef2f4fd68e14f730a99cecef7ab9fde03
new file mode 100644 (file)
index 0000000..aa71e58
--- /dev/null
@@ -0,0 +1,152 @@
+Return-Path: <jani@nikula.org>\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 1E7A2431FDC\r
+       for <notmuch@notmuchmail.org>; Thu, 13 Mar 2014 05:04:33 -0700 (PDT)\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.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 bEjHckYPXuCf for <notmuch@notmuchmail.org>;\r
+       Thu, 13 Mar 2014 05:04:28 -0700 (PDT)\r
+Received: from mail-we0-f172.google.com (mail-we0-f172.google.com\r
+       [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C7C39431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 13 Mar 2014 05:04:22 -0700 (PDT)\r
+Received: by mail-we0-f172.google.com with SMTP id t61so762767wes.17\r
+       for <notmuch@notmuchmail.org>; Thu, 13 Mar 2014 05:04:21 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:in-reply-to:references;\r
+       bh=ADbFGCJJaX4GLhrRxtgtlvEchHGyaa6zIbDgWviKddk=;\r
+       b=lNu3KhcjHt6TTWnkKlyvp+cBRGrgEwllNvW9g1f05ZBhrxLf0bKnsUtADPc2UUwHHd\r
+       rIomLlzv7C9L0iee91uoJJlA3ax7a4Ybwq7lSoa9l3NI0qw00d9DItN++nscGvCysbe2\r
+       owYTH0KfwYuKqAFR/1g1/7MUue4NU0l6yNoCSAIbeLtF5XMbbEqH8/qIcJozPJVW2tzb\r
+       VQIIEt21qZlk++g4KhT80XZnRd+1hhGCxAWQnCMu+vudiSubqoDozZIVFdh+V0t9P3hW\r
+       KH44JPZnUPW0ACc/YWoWm2PsMCdhs1RIj2ByFwIQR9Azwq3SbFehP8BDgQ9WOm/x9gLr\r
+       KlQQ==\r
+X-Gm-Message-State:\r
+ ALoCoQkvqe7Mg9LET+O5fgsMlgiMg+wiAkKZDj9oLocZIdaSKSAjLWSh+XB4IQ1UoKsVdeAzDfDk\r
+X-Received: by 10.180.24.134 with SMTP id u6mr1275596wif.41.1394712260952;\r
+       Thu, 13 Mar 2014 05:04:20 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPSA id n15sm6942404wij.3.2014.03.13.05.04.18\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+       Thu, 13 Mar 2014 05:04:20 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] nmbug-status: make output title and blurb configurable\r
+Date: Thu, 13 Mar 2014 13:04:05 +0100\r
+Message-Id:\r
+ <22dad934512fcdb2d3e1ff652393225088f58f5d.1394711823.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <cover.1394711823.git.jani@nikula.org>\r
+References: <cover.1394711823.git.jani@nikula.org>\r
+In-Reply-To: <cover.1394711823.git.jani@nikula.org>\r
+References: <cover.1394711823.git.jani@nikula.org>\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 Mar 2014 12:04:33 -0000\r
+\r
+Make nmbug-status more generally usable outside of nmbug by not\r
+hardcoding notmuch related things.\r
+\r
+This lets anyone publish html search views to mailing list messages\r
+with a custom config file, independent of nmbug.\r
+---\r
+ devel/nmbug/nmbug-status       |   32 +++++++++++++++-----------------\r
+ devel/nmbug/status-config.json |    5 +++++\r
+ 2 files changed, 20 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index cb3901f..03621bd 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -242,6 +242,19 @@ class HtmlPage (Page):\r
+     def _slug(self, string):\r
+         return self._slug_regexp.sub('-', string)\r
\r
++parser = argparse.ArgumentParser()\r
++parser.add_argument('--text', help='output plain text format',\r
++                    action='store_true')\r
++parser.add_argument('--config', help='load config from given file',\r
++                    metavar='PATH')\r
++parser.add_argument('--list-views', help='list views',\r
++                    action='store_true')\r
++parser.add_argument('--get-query', help='get query for view',\r
++                    metavar='VIEW')\r
++\r
++args = parser.parse_args()\r
++\r
++config = read_config(path=args.config)\r
\r
+ _PAGES['text'] = Page()\r
+ _PAGES['html'] = HtmlPage(\r
+@@ -292,29 +305,14 @@ Generated: {date}<br />\r
+ </p>\r
+ <h3>Views</h3>\r
+ '''.format(date=datetime.datetime.utcnow().date(),\r
+-           title='Notmuch Patches',\r
+-           blurb='For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>',\r
++           title=config['meta']['title'],\r
++           blurb=config['meta']['blurb'],\r
+            encoding=_ENCODING,\r
+            inter_message_padding='0.25em',\r
+            border_radius='0.5em'),\r
+     footer='</body>\n</html>\n',\r
+     )\r
\r
+-\r
+-parser = argparse.ArgumentParser()\r
+-parser.add_argument('--text', help='output plain text format',\r
+-                    action='store_true')\r
+-parser.add_argument('--config', help='load config from given file',\r
+-                    metavar='PATH')\r
+-parser.add_argument('--list-views', help='list views',\r
+-                    action='store_true')\r
+-parser.add_argument('--get-query', help='get query for view',\r
+-                    metavar='VIEW')\r
+-\r
+-args = parser.parse_args()\r
+-\r
+-config = read_config(path=args.config)\r
+-\r
+ if args.list_views:\r
+     for view in config['views']:\r
+         print(view['title'])\r
+diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json\r
+index 6b4934f..3f02c81 100644\r
+--- a/devel/nmbug/status-config.json\r
++++ b/devel/nmbug/status-config.json\r
+@@ -1,4 +1,9 @@\r
+ {\r
++    "meta": {\r
++        "title": "Notmuch Patches",\r
++        "blurb": "For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>"\r
++    },\r
++\r
+     "views": [\r
+       {\r
+           "comment": "Unresolved bugs (or just need tag updating).",\r
+-- \r
+1.7.2.5\r
+\r