changeset 138:bd3b47492396 trunk

Genshi extraction method has moved to Genshi project. Closes #13.
author cmlenz
date Wed, 20 Jun 2007 10:02:04 +0000
parents 289002e555b1
children 17a8b4cf6411
files babel/messages/extract.py doc/style/edgewall.css setup.py
diffstat 3 files changed, 3 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- 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.
     
--- 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; }
--- 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}
Copyright (C) 2012-2017 Edgewall Software