Mercurial > hg
diff mercurial/templatefilters.py @ 13593:cc4721ed7a2a
help: extract items doc generation function
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 12 Mar 2011 12:46:31 +0100 |
parents | 264f292a0c6f |
children | c49cddce0a81 |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Sat Mar 12 12:46:31 2011 +0100 +++ b/mercurial/templatefilters.py Sat Mar 12 12:46:31 2011 +0100 @@ -6,8 +6,7 @@ # GNU General Public License version 2 or any later version. import cgi, re, os, time, urllib -import encoding, node, util -from i18n import gettext +import encoding, node, util, help def addbreaks(text): """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of @@ -353,19 +352,7 @@ } def makedoc(topic, doc): - """Generate and include templatefilters help in templating topic.""" - entries = [] - for name in sorted(filters): - text = (filters[name].__doc__ or '').rstrip() - if not text: - continue - text = gettext(text) - lines = text.splitlines() - lines[1:] = [(' ' + l.strip()) for l in lines[1:]] - entries.append('\n'.join(lines)) - entries = '\n\n'.join(entries) - doc = doc.replace('.. filtersmarker', entries) - return doc + return help.makeitemsdoc(topic, doc, '.. filtersmarker', filters) # tell hggettext to extract docstrings from these functions: i18nfunctions = filters.values()