templatefilters.py
549 lines
| 14.9 KiB
| text/x-python
|
PythonLexer
/ mercurial / templatefilters.py
|
r32740 | # templatefilters.py - common template expansion filters | ||
|
r5976 | # | ||
# Copyright 2005-2008 Matt Mackall <mpm@selenic.com> | ||||
# | ||||
|
r8225 | # This software may be used and distributed according to the terms of the | ||
|
r10263 | # GNU General Public License version 2 or any later version. | ||
|
r5976 | |||
|
r25983 | from __future__ import absolute_import | ||
import os | ||||
import re | ||||
import time | ||||
|
r37246 | from .i18n import _ | ||
|
r25983 | from . import ( | ||
encoding, | ||||
|
r34838 | error, | ||
|
r25983 | node, | ||
|
r32126 | pycompat, | ||
|
r28693 | registrar, | ||
|
r36938 | templateutil, | ||
|
r34696 | url, | ||
|
r25983 | util, | ||
) | ||||
|
r37102 | from .utils import ( | ||
|
r42164 | cborutil, | ||
|
r37102 | dateutil, | ||
stringutil, | ||||
) | ||||
|
r5976 | |||
|
r28883 | urlerr = util.urlerr | ||
urlreq = util.urlreq | ||||
|
r28693 | # filters are callables like: | ||
# fn(obj) | ||||
# with: | ||||
# obj - object to be filtered (text, date, list and so on) | ||||
filters = {} | ||||
templatefilter = registrar.templatefilter(filters) | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'addbreaks', intype=bytes) | ||
|
r13588 | def addbreaks(text): | ||
|
r28693 | """Any text. Add an XHTML "<br />" tag before the end of | ||
|
r13591 | every line except the last. | ||
""" | ||||
|
r43347 | return text.replace(b'\n', b'<br/>\n') | ||
|
r8360 | |||
|
r43346 | |||
agescales = [ | ||||
|
r43347 | (b"year", 3600 * 24 * 365, b'Y'), | ||
(b"month", 3600 * 24 * 30, b'M'), | ||||
(b"week", 3600 * 24 * 7, b'W'), | ||||
(b"day", 3600 * 24, b'd'), | ||||
(b"hour", 3600, b'h'), | ||||
(b"minute", 60, b'm'), | ||||
(b"second", 1, b's'), | ||||
|
r43346 | ] | ||
|
r5976 | |||
|
r43347 | @templatefilter(b'age', intype=templateutil.date) | ||
|
r19736 | def age(date, abbrev=False): | ||
|
r28693 | """Date. Returns a human-readable date/time difference between the | ||
|
r13591 | given date/time and the current date/time. | ||
""" | ||||
|
r5976 | |||
def plural(t, c): | ||||
if c == 1: | ||||
return t | ||||
|
r43347 | return t + b"s" | ||
|
r43346 | |||
|
r19736 | def fmt(t, c, a): | ||
if abbrev: | ||||
|
r43347 | return b"%d%s" % (c, a) | ||
return b"%d %s" % (c, plural(t, c)) | ||||
|
r5976 | |||
now = time.time() | ||||
then = date[0] | ||||
|
r13666 | future = False | ||
|
r7682 | if then > now: | ||
|
r13666 | future = True | ||
delta = max(1, int(then - now)) | ||||
if delta > agescales[0][1] * 30: | ||||
|
r43347 | return b'in the distant future' | ||
|
r13666 | else: | ||
delta = max(1, int(now - then)) | ||||
if delta > agescales[0][1] * 2: | ||||
|
r36625 | return dateutil.shortdate(date) | ||
|
r9722 | |||
|
r19736 | for t, s, a in agescales: | ||
|
r9029 | n = delta // s | ||
|
r5976 | if n >= 2 or s == 1: | ||
|
r13666 | if future: | ||
|
r43347 | return b'%s from now' % fmt(t, n, a) | ||
return b'%s ago' % fmt(t, n, a) | ||||
|
r5976 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'basename', intype=bytes) | ||
|
r13590 | def basename(path): | ||
|
r28693 | """Any text. Treats the text as a path, and returns the last | ||
|
r35577 | component of the path after splitting by the path separator. | ||
For example, "foo/bar/baz" becomes "baz" and "foo/bar//" becomes "". | ||||
|
r13591 | """ | ||
|
r13590 | return os.path.basename(path) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'cbor') | ||
|
r42164 | def cbor(obj): | ||
"""Any object. Serializes the object to CBOR bytes.""" | ||||
return b''.join(cborutil.streamencode(obj)) | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'commondir') | ||
|
r38323 | def commondir(filelist): | ||
|
r38198 | """List of text. Treats each list item as file name with / | ||
as path separator and returns the longest common directory | ||||
prefix shared by all list items. | ||||
Returns the empty string if no common prefix exists. | ||||
The list items are not normalized, i.e. "foo/../bar" is handled as | ||||
file "bar" in the directory "foo/..". Leading slashes are ignored. | ||||
For example, ["foo/bar/baz", "foo/baz/bar"] becomes "foo" and | ||||
["foo/bar", "baz"] becomes "". | ||||
""" | ||||
|
r43346 | |||
|
r38198 | def common(a, b): | ||
if len(a) > len(b): | ||||
|
r43346 | a = b[: len(a)] | ||
|
r38198 | elif len(b) > len(a): | ||
|
r43346 | b = b[: len(a)] | ||
|
r38198 | if a == b: | ||
return a | ||||
|
r38806 | for i in pycompat.xrange(len(a)): | ||
|
r38198 | if a[i] != b[i]: | ||
return a[:i] | ||||
return a | ||||
|
r43346 | |||
|
r38198 | try: | ||
if not filelist: | ||||
|
r43347 | return b"" | ||
dirlist = [f.lstrip(b'/').split(b'/')[:-1] for f in filelist] | ||||
|
r38198 | if len(dirlist) == 1: | ||
|
r43347 | return b'/'.join(dirlist[0]) | ||
|
r38198 | a = min(dirlist) | ||
b = max(dirlist) | ||||
# The common prefix of a and b is shared with all | ||||
# elements of the list since Python sorts lexicographical | ||||
# and [1, x] after [1]. | ||||
|
r43347 | return b'/'.join(common(a, b)) | ||
|
r38198 | except TypeError: | ||
|
r43347 | raise error.ParseError(_(b'argument is not a list of text')) | ||
|
r38198 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'count') | ||
|
r22668 | def count(i): | ||
|
r28693 | """List or text. Returns the length as an integer.""" | ||
|
r37246 | try: | ||
return len(i) | ||||
except TypeError: | ||||
|
r43347 | raise error.ParseError(_(b'not countable')) | ||
|
r22668 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'dirname', intype=bytes) | ||
|
r36260 | def dirname(path): | ||
"""Any text. Treats the text as a path, and strips the last | ||||
component of the path after splitting by the path separator. | ||||
""" | ||||
return os.path.dirname(path) | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'domain', intype=bytes) | ||
|
r13588 | def domain(author): | ||
|
r28693 | """Any text. Finds the first string that looks like an email | ||
|
r13591 | address, and extracts just the domain component. Example: ``User | ||
<user@example.com>`` becomes ``example.com``. | ||||
""" | ||||
|
r43347 | f = author.find(b'@') | ||
|
r13588 | if f == -1: | ||
|
r43347 | return b'' | ||
|
r43346 | author = author[f + 1 :] | ||
|
r43347 | f = author.find(b'>') | ||
|
r13588 | if f >= 0: | ||
author = author[:f] | ||||
return author | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'email', intype=bytes) | ||
|
r13590 | def email(text): | ||
|
r28693 | """Any text. Extracts the first string that looks like an email | ||
|
r13591 | address. Example: ``User <user@example.com>`` becomes | ||
``user@example.com``. | ||||
""" | ||||
|
r37102 | return stringutil.email(text) | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'escape', intype=bytes) | ||
|
r13590 | def escape(text): | ||
|
r28693 | """Any text. Replaces the special XML/XHTML characters "&", "<" | ||
|
r17772 | and ">" with XML entities, and filters out NUL characters. | ||
|
r13591 | """ | ||
|
r43347 | return url.escape(text.replace(b'\0', b''), True) | ||
|
r13590 | |||
|
r43346 | |||
|
r5976 | para_re = None | ||
space_re = None | ||||
|
r43346 | |||
|
r43347 | def fill(text, width, initindent=b'', hangindent=b''): | ||
|
r19228 | '''fill many paragraphs with optional indentation.''' | ||
|
r5976 | global para_re, space_re | ||
if para_re is None: | ||||
|
r43347 | para_re = re.compile(b'(\n\n|\n\\s*[-*]\\s*)', re.M) | ||
|
r36516 | space_re = re.compile(br' +') | ||
|
r5976 | |||
def findparas(): | ||||
start = 0 | ||||
while True: | ||||
m = para_re.search(text, start) | ||||
if not m: | ||||
|
r36515 | uctext = encoding.unifromlocal(text[start:]) | ||
|
r11297 | w = len(uctext) | ||
|
r40065 | while w > 0 and uctext[w - 1].isspace(): | ||
|
r10282 | w -= 1 | ||
|
r43346 | yield ( | ||
encoding.unitolocal(uctext[:w]), | ||||
encoding.unitolocal(uctext[w:]), | ||||
) | ||||
|
r5976 | break | ||
|
r43346 | yield text[start : m.start(0)], m.group(1) | ||
|
r5976 | start = m.end(1) | ||
|
r43347 | return b"".join( | ||
|
r43346 | [ | ||
stringutil.wrap( | ||||
|
r43347 | space_re.sub(b' ', stringutil.wrap(para, width)), | ||
|
r43346 | width, | ||
initindent, | ||||
hangindent, | ||||
) | ||||
+ rest | ||||
for para, rest in findparas() | ||||
] | ||||
) | ||||
|
r5976 | |||
|
r43347 | @templatefilter(b'fill68', intype=bytes) | ||
|
r13590 | def fill68(text): | ||
|
r28693 | """Any text. Wraps the text to fit in 68 columns.""" | ||
|
r13590 | return fill(text, 68) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'fill76', intype=bytes) | ||
|
r13590 | def fill76(text): | ||
|
r28693 | """Any text. Wraps the text to fit in 76 columns.""" | ||
|
r13590 | return fill(text, 76) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'firstline', intype=bytes) | ||
|
r5976 | def firstline(text): | ||
|
r28693 | """Any text. Returns the first line of text.""" | ||
|
r5976 | try: | ||
|
r43347 | return text.splitlines(True)[0].rstrip(b'\r\n') | ||
|
r5976 | except IndexError: | ||
|
r43347 | return b'' | ||
|
r5976 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'hex', intype=bytes) | ||
|
r13590 | def hexfilter(text): | ||
|
r28693 | """Any text. Convert a binary Mercurial node identifier into | ||
|
r13591 | its long hexadecimal representation. | ||
""" | ||||
|
r13590 | return node.hex(text) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'hgdate', intype=templateutil.date) | ||
|
r13590 | def hgdate(text): | ||
|
r28693 | """Date. Returns the date as a pair of numbers: "1157407993 | ||
|
r38319 | 25200" (Unix timestamp, timezone offset). | ||
|
r13591 | """ | ||
|
r43347 | return b"%d %d" % text | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'isodate', intype=templateutil.date) | ||
|
r13590 | def isodate(text): | ||
|
r28693 | """Date. Returns the date in ISO 8601 format: "2009-08-18 13:00 | ||
|
r13591 | +0200". | ||
""" | ||||
|
r43347 | return dateutil.datestr(text, b'%Y-%m-%d %H:%M %1%2') | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'isodatesec', intype=templateutil.date) | ||
|
r13590 | def isodatesec(text): | ||
|
r28693 | """Date. Returns the date in ISO 8601 format, including | ||
|
r13591 | seconds: "2009-08-18 13:00:13 +0200". See also the rfc3339date | ||
filter. | ||||
""" | ||||
|
r43347 | return dateutil.datestr(text, b'%Y-%m-%d %H:%M:%S %1%2') | ||
|
r13590 | |||
|
r43346 | |||
|
r44093 | def indent(text, prefix, firstline=b''): | ||
|
r5976 | '''indent each non-empty line of text after first with prefix.''' | ||
lines = text.splitlines() | ||||
num_lines = len(lines) | ||||
|
r43347 | endswithnewline = text[-1:] == b'\n' | ||
|
r43346 | |||
|
r5976 | def indenter(): | ||
|
r38806 | for i in pycompat.xrange(num_lines): | ||
|
r5976 | l = lines[i] | ||
|
r44093 | if l.strip(): | ||
yield prefix if i else firstline | ||||
|
r5976 | yield l | ||
|
r9387 | if i < num_lines - 1 or endswithnewline: | ||
|
r43347 | yield b'\n' | ||
|
r43346 | |||
|
r43347 | return b"".join(indenter()) | ||
|
r5976 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'json') | ||
|
r31782 | def json(obj, paranoid=True): | ||
|
r37967 | """Any object. Serializes the object to a JSON formatted text.""" | ||
|
r31780 | if obj is None: | ||
|
r43347 | return b'null' | ||
|
r31780 | elif obj is False: | ||
|
r43347 | return b'false' | ||
|
r31780 | elif obj is True: | ||
|
r43347 | return b'true' | ||
|
r43641 | elif isinstance(obj, (int, pycompat.long, float)): | ||
|
r32127 | return pycompat.bytestr(obj) | ||
|
r32128 | elif isinstance(obj, bytes): | ||
|
r43347 | return b'"%s"' % encoding.jsonescape(obj, paranoid=paranoid) | ||
|
r38044 | elif isinstance(obj, type(u'')): | ||
|
r34838 | raise error.ProgrammingError( | ||
|
r43347 | b'Mercurial only does output with bytes: %r' % obj | ||
|
r43346 | ) | ||
|
r43347 | elif util.safehasattr(obj, b'keys'): | ||
|
r43346 | out = [ | ||
|
r43347 | b'"%s": %s' | ||
|
r43346 | % (encoding.jsonescape(k, paranoid=paranoid), json(v, paranoid)) | ||
|
r43376 | for k, v in sorted(pycompat.iteritems(obj)) | ||
|
r43346 | ] | ||
|
r43347 | return b'{' + b', '.join(out) + b'}' | ||
elif util.safehasattr(obj, b'__iter__'): | ||||
|
r32743 | out = [json(i, paranoid) for i in obj] | ||
|
r43347 | return b'[' + b', '.join(out) + b']' | ||
raise error.ProgrammingError(b'cannot encode %r' % obj) | ||||
|
r6691 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'lower', intype=bytes) | ||
|
r24566 | def lower(text): | ||
|
r28693 | """Any text. Converts the text to lowercase.""" | ||
|
r24566 | return encoding.lower(text) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'nonempty', intype=bytes) | ||
|
r36570 | def nonempty(text): | ||
|
r28693 | """Any text. Returns '(none)' if the string is empty.""" | ||
|
r43347 | return text or b"(none)" | ||
|
r13588 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'obfuscate', intype=bytes) | ||
|
r13588 | def obfuscate(text): | ||
|
r28693 | """Any text. Returns the input text rendered as a sequence of | ||
|
r13591 | XML entities. | ||
""" | ||||
r43364 | text = pycompat.unicode( | |||
text, pycompat.sysstr(encoding.encoding), r'replace' | ||||
) | ||||
|
r43347 | return b''.join([b'&#%d;' % ord(c) for c in text]) | ||
|
r13588 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'permissions', intype=bytes) | ||
|
r13588 | def permissions(flags): | ||
|
r43347 | if b"l" in flags: | ||
return b"lrwxrwxrwx" | ||||
if b"x" in flags: | ||||
return b"-rwxr-xr-x" | ||||
return b"-rw-r--r--" | ||||
|
r13588 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'person', intype=bytes) | ||
|
r13588 | def person(author): | ||
|
r28693 | """Any text. Returns the name before an email address, | ||
|
r16235 | interpreting it as per RFC 5322. | ||
""" | ||||
|
r37173 | return stringutil.person(author) | ||
|
r13588 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'revescape', intype=bytes) | ||
r25778 | def revescape(text): | |||
|
r28693 | """Any text. Escapes all "special" characters, except @. | ||
r25778 | Forward slashes are escaped twice to prevent web servers from prematurely | |||
unescaping them. For example, "@foo bar/baz" becomes "@foo%20bar%252Fbaz". | ||||
""" | ||||
|
r43347 | return urlreq.quote(text, safe=b'/@').replace(b'/', b'%252F') | ||
r25778 | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'rfc3339date', intype=templateutil.date) | ||
|
r13590 | def rfc3339date(text): | ||
|
r28693 | """Date. Returns a date using the Internet date format | ||
|
r13591 | specified in RFC 3339: "2009-08-18T13:00:13+02:00". | ||
""" | ||||
|
r43347 | return dateutil.datestr(text, b"%Y-%m-%dT%H:%M:%S%1:%2") | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'rfc822date', intype=templateutil.date) | ||
|
r13590 | def rfc822date(text): | ||
|
r28693 | """Date. Returns a date using the same format used in email | ||
|
r13591 | headers: "Tue, 18 Aug 2009 13:00:13 +0200". | ||
""" | ||||
|
r43347 | return dateutil.datestr(text, b"%a, %d %b %Y %H:%M:%S %1%2") | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'short', intype=bytes) | ||
|
r13590 | def short(text): | ||
|
r28693 | """Changeset hash. Returns the short form of a changeset hash, | ||
|
r13591 | i.e. a 12 hexadecimal digit string. | ||
""" | ||||
|
r13590 | return text[:12] | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'shortbisect', intype=bytes) | ||
|
r36848 | def shortbisect(label): | ||
"""Any text. Treats `label` as a bisection status, and | ||||
|
r15155 | returns a single-character representing the status (G: good, B: bad, | ||
S: skipped, U: untested, I: ignored). Returns single space if `text` | ||||
is not a valid bisection status. | ||||
""" | ||||
|
r36848 | if label: | ||
|
r36849 | return label[0:1].upper() | ||
|
r43347 | return b' ' | ||
|
r15155 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'shortdate', intype=templateutil.date) | ||
|
r13590 | def shortdate(text): | ||
|
r28693 | """Date. Returns a date like "2006-09-18".""" | ||
|
r36625 | return dateutil.shortdate(text) | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'slashpath', intype=bytes) | ||
|
r35460 | def slashpath(path): | ||
"""Any text. Replaces the native path separator with slash.""" | ||||
return util.pconvert(path) | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'splitlines', intype=bytes) | ||
|
r21820 | def splitlines(text): | ||
|
r28693 | """Any text. Split text into a list of lines.""" | ||
|
r43347 | return templateutil.hybridlist(text.splitlines(), name=b'line') | ||
|
r21820 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'stringescape', intype=bytes) | ||
|
r13590 | def stringescape(text): | ||
|
r37102 | return stringutil.escapestr(text) | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'stringify', intype=bytes) | ||
|
r13588 | def stringify(thing): | ||
|
r28693 | """Any type. Turns the value into text by converting values into | ||
|
r13591 | text and concatenating them. | ||
""" | ||||
|
r37239 | return thing # coerced by the intype | ||
|
r13588 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'stripdir', intype=bytes) | ||
|
r8158 | def stripdir(text): | ||
|
r28693 | """Treat the text as path and strip a directory level, if | ||
|
r13591 | possible. For example, "foo" and "foo/bar" becomes "foo". | ||
""" | ||||
|
r8158 | dir = os.path.dirname(text) | ||
|
r43347 | if dir == b"": | ||
|
r8158 | return os.path.basename(text) | ||
else: | ||||
return dir | ||||
|
r43346 | |||
|
r43347 | @templatefilter(b'tabindent', intype=bytes) | ||
|
r13590 | def tabindent(text): | ||
|
r28693 | """Any text. Returns the text, with every non-empty line | ||
|
r19467 | except the first starting with a tab character. | ||
|
r13591 | """ | ||
|
r43347 | return indent(text, b'\t') | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'upper', intype=bytes) | ||
|
r24566 | def upper(text): | ||
|
r28693 | """Any text. Converts the text to uppercase.""" | ||
|
r24566 | return encoding.upper(text) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'urlescape', intype=bytes) | ||
|
r13590 | def urlescape(text): | ||
|
r28693 | """Any text. Escapes all "special" characters. For example, | ||
|
r13591 | "foo bar" becomes "foo%20bar". | ||
""" | ||||
|
r28883 | return urlreq.quote(text) | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'user', intype=bytes) | ||
|
r13590 | def userfilter(text): | ||
|
r28693 | """Any text. Returns a short representation of a user name or email | ||
|
r16360 | address.""" | ||
|
r37102 | return stringutil.shortuser(text) | ||
|
r13590 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'emailuser', intype=bytes) | ||
|
r16360 | def emailuser(text): | ||
|
r28693 | """Any text. Returns the user portion of an email address.""" | ||
|
r37102 | return stringutil.emailuser(text) | ||
|
r16360 | |||
|
r43346 | |||
|
r43347 | @templatefilter(b'utf8', intype=bytes) | ||
|
r28209 | def utf8(text): | ||
|
r28693 | """Any text. Converts from the local character encoding to UTF-8.""" | ||
|
r28209 | return encoding.fromlocal(text) | ||
|
r43346 | |||
|
r43347 | @templatefilter(b'xmlescape', intype=bytes) | ||
|
r13588 | def xmlescape(text): | ||
|
r43346 | text = ( | ||
|
r43347 | text.replace(b'&', b'&') | ||
.replace(b'<', b'<') | ||||
.replace(b'>', b'>') | ||||
.replace(b'"', b'"') | ||||
.replace(b"'", b''') | ||||
|
r43346 | ) # ' invalid in HTML | ||
|
r43347 | return re.sub(b'[\x00-\x08\x0B\x0C\x0E-\x1F]', b' ', text) | ||
|
r8234 | |||
|
r43346 | |||
|
r18627 | def websub(text, websubtable): | ||
""":websub: Any text. Only applies to hgweb. Applies the regular | ||||
expression replacements defined in the websub section. | ||||
""" | ||||
if websubtable: | ||||
for regexp, format in websubtable: | ||||
text = regexp.sub(format, text) | ||||
return text | ||||
|
r43346 | |||
|
r28692 | def loadfilter(ui, extname, registrarobj): | ||
"""Load template filter from specified registrarobj | ||||
""" | ||||
|
r43376 | for name, func in pycompat.iteritems(registrarobj._table): | ||
|
r28692 | filters[name] = func | ||
|
r43346 | |||
|
r13591 | # tell hggettext to extract docstrings from these functions: | ||
i18nfunctions = filters.values() | ||||