2 # EASY-INSTALL-ENTRY-SCRIPT: 'Babel==0.9.6','console_scripts','pybabel'
3 __requires__ = 'Babel==0.9.6'
5 from pkg_resources import load_entry_point
8 if __name__ == '__main__':
10 load_entry_point('Babel==0.9.6', 'console_scripts', 'pybabel')()
13 QWEB_EXPR = re.compile(r"""(?:\< *t\-tr *\>(.*?)\< *\/t\-tr *\>)|(?:\_t *\( *((?:\".*?\")|(?:\'.*?\')) *\))""")
15 def extract_qweb(fileobj, keywords, comment_tags, options):
16 """Extract messages from XXX files.
17 :param fileobj: the file-like object the messages should be extracted
19 :param keywords: a list of keywords (i.e. function names) that should
20 be recognized as translation functions
21 :param comment_tags: a list of translator tags to search for and
22 include in the results
23 :param options: a dictionary of additional options (optional)
24 :return: an iterator over ``(lineno, funcname, message, comments)``
28 content = fileobj.read()
29 found = QWEB_EXPR.finditer(content)
34 group = 1 if f.group(1) else 2
35 while index < f.start():
36 if content[index] == "\n":
39 result.append((line_nbr, None, f.group(group), ""))