# HG changeset patch # User cmlenz # Date 1182333724 0 # Node ID 3b3a487cc46faba69010034d4d2e538f688be633 # Parent 1acfbb2b789fded6aa47eab91a7eda4336e3e1a3 Genshi extraction method has moved to Genshi project. Closes #13. diff --git a/babel/messages/extract.py b/babel/messages/extract.py --- a/babel/messages/extract.py +++ b/babel/messages/extract.py @@ -233,44 +233,6 @@ """ return [] -def extract_genshi(fileobj, keywords, comment_tags, options): - """Extract messages from Genshi templates. - - :param fileobj: the file-like object the messages should be extracted from - :param keywords: a list of keywords (i.e. function names) that should be - recognized as translation functions - :param comment_tags: a list of translator tags to search for and include - in the results - :param options: a dictionary of additional options (optional) - :return: an iterator over ``(lineno, funcname, message, comments)`` tuples - :rtype: ``iterator`` - """ - from genshi import QName - from genshi.filters.i18n import Translator - from genshi.template import MarkupTemplate - - template_class = options.get('template_class', MarkupTemplate) - if isinstance(template_class, basestring): - module, clsname = template_class.split(':', 1) - template_class = getattr(__import__(module, {}, {}, [clsname]), clsname) - encoding = options.get('encoding', None) - - ignore_tags = options.get('ignore_tags', Translator.IGNORE_TAGS) - if isinstance(ignore_tags, basestring): - ignore_tags = ignore_tags.split() - ignore_tags = [QName(tag) for tag in ignore_tags] - include_attrs = options.get('include_attrs', Translator.INCLUDE_ATTRS) - if isinstance(include_attrs, basestring): - include_attrs = include_attrs.split() - include_attrs = [QName(attr) for attr in include_attrs] - - tmpl = template_class(fileobj, filename=getattr(fileobj, 'name'), - encoding=encoding) - translator = Translator(None, ignore_tags, include_attrs) - for lineno, func, message in translator.extract(tmpl.stream, - gettext_functions=keywords): - yield lineno, func, message, [] - def extract_python(fileobj, keywords, comment_tags, options): """Extract messages from Python source code. diff --git a/doc/style/edgewall.css b/doc/style/edgewall.css --- a/doc/style/edgewall.css +++ b/doc/style/edgewall.css @@ -74,3 +74,4 @@ } p.admonition-title { margin-bottom: 0; text-transform: uppercase; } tt.docutils { background-color: transparent; } +span.pre { white-space: normal; } diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -109,7 +109,7 @@ setup( name = 'Babel', - version = '0.1', + version = '0.8', description = 'Internationalization utilities', long_description = \ """A collection of tools for internationalizing Python applications.""", @@ -145,9 +145,8 @@ message_extractors = babel.messages.frontend:check_message_extractors [babel.extractors] - genshi = babel.messages.extract:extract_genshi + ignore = babel.messages.extract:extract_nothing python = babel.messages.extract:extract_python - ignore = babel.messages.extract:extract_nothing """, cmdclass = {'build_doc': build_doc, 'test_doc': test_doc}