From patchwork Mon May 7 13:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,3] templatefilters: document the json filter From: Yuya Nishihara X-Patchwork-Id: 31304 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Mon, 07 May 2018 22:17:16 +0900 # HG changeset patch # User Yuya Nishihara # Date 1452939833 -32400 # Sat Jan 16 19:23:53 2016 +0900 # Node ID fe85fe4b7cd677ea2267c002a8534bc079a82d51 # Parent fdb6dfcc700e6e3c9751e7b4287bdc231acc27e9 templatefilters: document the json filter I don't know the exact reason why it was undocumented, but that would be because unicode is difficult for humans. Since the json filter can now get localstr back to UTF-8 as long as it is unprocessed (i.e. {desc|json} works, but {desc|firstline|json} doesn't), it seems good enough to advertise the json filter. diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -238,6 +238,7 @@ def indent(text, prefix): @templatefilter('json') def json(obj, paranoid=True): + """Any object. Serializes the object to a JSON formatted text.""" if obj is None: return 'null' elif obj is False: