[PATCH 1 of 4] templater: rewrite docstring of templater.__init__()

Yuya Nishihara yuya at tcha.org
Fri Dec 22 09:08:27 EST 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1513944737 -32400
#      Fri Dec 22 21:12:17 2017 +0900
# Node ID a311f085ddf3e7d64d741a0e6f98c8f461d22fb1
# Parent  bb6a80fc969a2c5da80cbb7f29de7ca576c4e251
templater: rewrite docstring of templater.__init__()

More importantly, this patch adds what the cache is.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1434,13 +1434,19 @@ class templater(object):
 
     def __init__(self, filters=None, defaults=None, resources=None,
                  cache=None, aliases=(), minchunk=1024, maxchunk=65536):
-        '''set up template engine.
-        filters is dict of functions. each transforms a value into another.
-        defaults is dict of default map definitions.
-        resources is dict of internal data (e.g. cache), which are inaccessible
-        from user template.
-        aliases is list of alias (name, replacement) pairs.
-        '''
+        """Create template engine optionally with preloaded template fragments
+
+        - ``filters``: a dict of functions to transform a value into another.
+        - ``defaults``: a dict of symbol values/functions; may be overridden
+          by a ``mapping`` dict.
+        - ``resources``: a dict of internal data (e.g. cache), inaccessible
+          from user template; may be overridden by a ``mapping`` dict.
+        - ``cache``: a dict of preloaded template fragments.
+        - ``aliases``: a list of alias (name, replacement) pairs.
+
+        self.cache may be updated later to register additional template
+        fragments.
+        """
         if filters is None:
             filters = {}
         if defaults is None:


More information about the Mercurial-devel mailing list