help: populate template functions via docstrings
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 01 Apr 2015 20:23:58 -0700
changeset 24587 76c0b4cfa039
parent 24586 90e3f5d22dad
child 24588 0bf54479a9eb
help: populate template functions via docstrings We do this for revsets, template keywrods, and template filters. Now we do it for template functions as well.
mercurial/help.py
mercurial/help/templates.txt
--- a/mercurial/help.py	Wed Apr 01 20:19:43 2015 -0700
+++ b/mercurial/help.py	Wed Apr 01 20:23:58 2015 -0700
@@ -9,6 +9,7 @@
 import itertools, os, textwrap
 import error
 import extensions, revset, fileset, templatekw, templatefilters, filemerge
+import templater
 import encoding, util, minirst
 import cmdutil
 import hgweb.webcommands as webcommands
@@ -209,6 +210,7 @@
 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
+addtopicsymbols('templates', '.. functionsmarker', templater.funcs)
 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
                 dedent=True)
 
--- a/mercurial/help/templates.txt	Wed Apr 01 20:19:43 2015 -0700
+++ b/mercurial/help/templates.txt	Wed Apr 01 20:23:58 2015 -0700
@@ -41,39 +41,7 @@
 
 In addition to filters, there are some basic built-in functions:
 
-- date(date[, fmt])
-
-- diff([includepattern [, excludepattern]])
-
-- fill(text[, width])
-
-- get(dict, key)
-
-- if(expr, then[, else])
-
-- ifcontains(expr, expr, then[, else])
-
-- ifeq(expr, expr, then[, else])
-
-- join(list, sep)
-
-- label(label, expr)
-
-- pad(text, width[, fillchar, right])
-
-- revset(query[, formatargs])
-
-- rstdoc(text, style)
-
-- shortest(node)
-
-- startswith(string, text)
-
-- strip(text[, chars])
-
-- sub(pat, repl, expr)
-
-- word(number, text[, separator])
+.. functionsmarker
 
 Also, for any expression that returns a list, there is a list operator: