PKÎX7“×2EGG-INFO/dependency_links.txt PKÎX7ö›ÿºOOEGG-INFO/entry_points.txt [babel.extractors] genshi = genshi.filters.i18n:extract[i18n] [python.templating.engines] genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] PKÎX7?Šz{{EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: Genshi Version: 0.4.4 Summary: A toolkit for stream-based generation of output for the web Home-page: http://genshi.edgewall.org/ Author: Edgewall Software Author-email: info@edgewall.org License: BSD Download-URL: http://genshi.edgewall.org/wiki/Download Description: Genshi is a Python library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web. The major feature is a template language, which is heavily inspired by Kid. Keywords: python.templating.engines Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing :: Markup :: HTML Classifier: Topic :: Text Processing :: Markup :: XML PKÎX7ØRD//EGG-INFO/requires.txt [i18n] Babel>=0.8 [plugin] setuptools>=0.6a2PKÎX7@vo™!!EGG-INFO/SOURCES.txtCOPYING ChangeLog INSTALL.txt MANIFEST.in README.txt UPGRADE.txt setup.py Genshi.egg-info/PKG-INFO Genshi.egg-info/SOURCES.txt Genshi.egg-info/dependency_links.txt Genshi.egg-info/entry_points.txt Genshi.egg-info/requires.txt Genshi.egg-info/top_level.txt Genshi.egg-info/zip-safe doc/2000ft.png doc/filters.html doc/filters.txt doc/i18n.html doc/i18n.txt doc/index.html doc/index.txt doc/logo.gif doc/logo.png doc/plugin.html doc/plugin.txt doc/streams.html doc/streams.txt doc/templates.html doc/templates.txt doc/text-templates.html doc/text-templates.txt doc/xml-templates.html doc/xml-templates.txt doc/xpath.html doc/xpath.txt doc/api/api-objects.txt doc/api/class-tree.html doc/api/crarr.png doc/api/epydoc.css doc/api/epydoc.js doc/api/genshi-module.html doc/api/genshi.builder-module.html doc/api/genshi.builder.Element-class.html doc/api/genshi.builder.ElementFactory-class.html doc/api/genshi.builder.Fragment-class.html doc/api/genshi.core-module.html doc/api/genshi.core.Attrs-class.html doc/api/genshi.core.Markup-class.html doc/api/genshi.core.Namespace-class.html doc/api/genshi.core.QName-class.html doc/api/genshi.core.Stream-class.html doc/api/genshi.filters-module.html doc/api/genshi.filters.html-module.html doc/api/genshi.filters.html.HTMLFormFiller-class.html doc/api/genshi.filters.html.HTMLSanitizer-class.html doc/api/genshi.filters.i18n-module.html doc/api/genshi.filters.i18n.Translator-class.html doc/api/genshi.input-module.html doc/api/genshi.input.HTMLParser-class.html doc/api/genshi.input.ParseError-class.html doc/api/genshi.input.XMLParser-class.html doc/api/genshi.output-module.html doc/api/genshi.output.DocType-class.html doc/api/genshi.output.HTMLSerializer-class.html doc/api/genshi.output.TextSerializer-class.html doc/api/genshi.output.XHTMLSerializer-class.html doc/api/genshi.output.XMLSerializer-class.html doc/api/genshi.path-module.html doc/api/genshi.path.Path-class.html doc/api/genshi.path.PathSyntaxError-class.html doc/api/genshi.template-module.html doc/api/genshi.template.base-module.html doc/api/genshi.template.base.BadDirectiveError-class.html doc/api/genshi.template.base.Context-class.html doc/api/genshi.template.base.Template-class.html doc/api/genshi.template.base.TemplateError-class.html doc/api/genshi.template.base.TemplateMeta-class.html doc/api/genshi.template.base.TemplateRuntimeError-class.html doc/api/genshi.template.base.TemplateSyntaxError-class.html doc/api/genshi.template.directives-module.html doc/api/genshi.template.directives.AttrsDirective-class.html doc/api/genshi.template.directives.ChooseDirective-class.html doc/api/genshi.template.directives.ContentDirective-class.html doc/api/genshi.template.directives.DefDirective-class.html doc/api/genshi.template.directives.DirectiveMeta-class.html doc/api/genshi.template.directives.ForDirective-class.html doc/api/genshi.template.directives.IfDirective-class.html doc/api/genshi.template.directives.MatchDirective-class.html doc/api/genshi.template.directives.OtherwiseDirective-class.html doc/api/genshi.template.directives.ReplaceDirective-class.html doc/api/genshi.template.directives.StripDirective-class.html doc/api/genshi.template.directives.WhenDirective-class.html doc/api/genshi.template.directives.WithDirective-class.html doc/api/genshi.template.eval-module.html doc/api/genshi.template.eval.Code-class.html doc/api/genshi.template.eval.Expression-class.html doc/api/genshi.template.eval.LenientLookup-class.html doc/api/genshi.template.eval.StrictLookup-class.html doc/api/genshi.template.eval.Suite-class.html doc/api/genshi.template.eval.Undefined-class.html doc/api/genshi.template.eval.UndefinedError-class.html doc/api/genshi.template.interpolation-module.html doc/api/genshi.template.loader-module.html doc/api/genshi.template.loader.TemplateLoader-class.html doc/api/genshi.template.loader.TemplateNotFound-class.html doc/api/genshi.template.markup-module.html doc/api/genshi.template.markup.MarkupTemplate-class.html doc/api/genshi.template.plugin-module.html doc/api/genshi.template.plugin.AbstractTemplateEnginePlugin-class.html doc/api/genshi.template.plugin.ConfigurationError-class.html doc/api/genshi.template.plugin.MarkupTemplateEnginePlugin-class.html doc/api/genshi.template.plugin.TextTemplateEnginePlugin-class.html doc/api/genshi.template.text-module.html doc/api/genshi.template.text.TextTemplate-class.html doc/api/genshi.util-module.html doc/api/genshi.util.LRUCache-class.html doc/api/help.html doc/api/identifier-index.html doc/api/index.html doc/api/module-tree.html doc/api/redirect.html doc/api/since-index.html doc/conf/docutils.ini doc/conf/epydoc.ini doc/style/bkgnd_pattern.png doc/style/docutils.css doc/style/edgewall.css doc/style/epydoc.css doc/style/pygments.css doc/style/shadow.gif doc/style/vertbars.png examples/basic/kidrun.py examples/basic/layout.html examples/basic/layout.kid examples/basic/run.py examples/basic/test.html examples/basic/test.kid examples/bench/basic.py examples/bench/bigtable.py examples/bench/cheetah/footer.tmpl examples/bench/cheetah/header.tmpl examples/bench/cheetah/template.tmpl examples/bench/clearsilver/footer.cs examples/bench/clearsilver/header.cs examples/bench/clearsilver/template.cs examples/bench/django/templates/base.html examples/bench/django/templates/template.html examples/bench/django/templatetags/__init__.py examples/bench/django/templatetags/bench.py examples/bench/genshi/base.html examples/bench/genshi/template.html examples/bench/kid/base.kid examples/bench/kid/template.kid examples/bench/myghty/base.myt examples/bench/myghty/template.myt examples/bench/simpletal/base.html examples/bench/simpletal/template.html examples/cherrypy/config.txt examples/cherrypy/index.html examples/cherrypy/index.py examples/includes/run.py examples/includes/common/macros.html examples/includes/module/test.html examples/includes/skins/default/footer.html examples/includes/skins/default/header.html examples/includes/skins/default/layout.html examples/transform/README.txt examples/transform/index.html examples/transform/run.py examples/transform/template.xml examples/turbogears/README.txt examples/turbogears/dev.cfg examples/turbogears/sample-prod.cfg examples/turbogears/setup.py examples/turbogears/start-genshitest.py examples/turbogears/genshitest/__init__.py examples/turbogears/genshitest/controllers.py examples/turbogears/genshitest/json.py examples/turbogears/genshitest/model.py examples/turbogears/genshitest/release.py examples/turbogears/genshitest/config/__init__.py examples/turbogears/genshitest/config/app.cfg examples/turbogears/genshitest/config/log.cfg examples/turbogears/genshitest/static/images/favicon.ico examples/turbogears/genshitest/static/images/tg_under_the_hood.png examples/turbogears/genshitest/templates/__init__.py examples/turbogears/genshitest/templates/login.html examples/turbogears/genshitest/templates/master.html examples/turbogears/genshitest/templates/plain.txt examples/turbogears/genshitest/templates/sitetemplate.html examples/turbogears/genshitest/templates/welcome.html examples/turbogears/genshitest/tests/__init__.py examples/turbogears/genshitest/tests/test_controllers.py examples/turbogears/genshitest/tests/test_model.py examples/webpy/README.txt examples/webpy/hello.html examples/webpy/hello.py genshi/__init__.py genshi/builder.py genshi/core.py genshi/input.py genshi/output.py genshi/path.py genshi/util.py genshi/filters/__init__.py genshi/filters/html.py genshi/filters/i18n.py genshi/filters/tests/__init__.py genshi/filters/tests/html.py genshi/filters/tests/i18n.py genshi/template/__init__.py genshi/template/base.py genshi/template/directives.py genshi/template/eval.py genshi/template/interpolation.py genshi/template/loader.py genshi/template/markup.py genshi/template/plugin.py genshi/template/text.py genshi/template/tests/__init__.py genshi/template/tests/base.py genshi/template/tests/directives.py genshi/template/tests/eval.py genshi/template/tests/interpolation.py genshi/template/tests/loader.py genshi/template/tests/markup.py genshi/template/tests/plugin.py genshi/template/tests/text.py genshi/template/tests/templates/__init__.py genshi/template/tests/templates/functions.html genshi/template/tests/templates/functions.txt genshi/template/tests/templates/test.html genshi/template/tests/templates/test.txt genshi/tests/__init__.py genshi/tests/builder.py genshi/tests/core.py genshi/tests/input.py genshi/tests/output.py genshi/tests/path.py genshi/tests/util.py PKÎX7ÊVâÆEGG-INFO/top_level.txtgenshi PK1X7“×2EGG-INFO/zip-safe PKX7@áý(genshi/__init__.py# -*- coding: utf-8 -*- # # Copyright (C) 2006 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. """This package provides various means for generating and processing web markup (XML or HTML). The design is centered around the concept of streams of markup events (similar in concept to SAX parsing events) which can be processed in a uniform manner independently of where or how they are produced. """ __docformat__ = 'restructuredtext en' try: __version__ = __import__('pkg_resources').get_distribution('Genshi').version except ImportError: pass from genshi.core import * from genshi.input import ParseError, XML, HTML PKÎX7á£Evvgenshi/__init__.pyc;ò oÁFc@sbdZdZyedƒidƒiZWnej onXdkTdkl Z l Z l Z dS(s*This package provides various means for generating and processing web markup (XML or HTML). The design is centered around the concept of streams of markup events (similar in concept to SAX parsing events) which can be processed in a uniform manner independently of where or how they are produced. srestructuredtext ens pkg_resourcessGenshi(s*(s ParseErrorsXMLsHTMLN( s__doc__s __docformat__s __import__sget_distributionsversions __version__s ImportErrors genshi.cores genshi.inputs ParseErrorsXMLsHTML(sXMLs __docformat__s ParseErrorsHTMLs __version__((s5build/bdist.darwin-8.10.1-i386/egg/genshi/__init__.pys?sPKX7½Ú ,ô+ô+genshi/builder.py# -*- coding: utf-8 -*- # # Copyright (C) 2006-2007 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. """Support for programmatically generating markup streams from Python code using a very simple syntax. The main entry point to this module is the `tag` object (which is actually an instance of the ``ElementFactory`` class). You should rarely (if ever) need to directly import and use any of the other classes in this module. Elements can be created using the `tag` object using attribute access. For example: >>> doc = tag.p('Some text and ', tag.a('a link', href='http://example.org/'), '.') >>> doc This produces an `Element` instance which can be further modified to add child nodes and attributes. This is done by "calling" the element: positional arguments are added as child nodes (alternatively, the `Element.append` method can be used for that purpose), whereas keywords arguments are added as attributes: >>> doc(tag.br) >>> print doc

Some text and a link.

If an attribute name collides with a Python keyword, simply append an underscore to the name: >>> doc(class_='intro') >>> print doc

Some text and a link.

As shown above, an `Element` can easily be directly rendered to XML text by printing it or using the Python ``str()`` function. This is basically a shortcut for converting the `Element` to a stream and serializing that stream: >>> stream = doc.generate() >>> stream #doctest: +ELLIPSIS >>> print stream

Some text and a link.

The `tag` object also allows creating "fragments", which are basically lists of nodes (elements or text) that don't have a parent element. This can be useful for creating snippets of markup that are attached to a parent element later (for example in a template). Fragments are created by calling the `tag` object, which returns an object of type `Fragment`: >>> fragment = tag('Hello, ', tag.em('world'), '!') >>> fragment >>> print fragment Hello, world! """ from genshi.core import Attrs, Namespace, QName, Stream, START, END, TEXT __all__ = ['Fragment', 'Element', 'ElementFactory', 'tag'] __docformat__ = 'restructuredtext en' class Fragment(object): """Represents a markup fragment, which is basically just a list of element or text nodes. """ __slots__ = ['children'] def __init__(self): """Create a new fragment.""" self.children = [] def __add__(self, other): return Fragment()(self, other) def __call__(self, *args): """Append any positional arguments as child nodes. :see: `append` """ map(self.append, args) return self def __iter__(self): return self._generate() def __repr__(self): return '<%s>' % self.__class__.__name__ def __str__(self): return str(self.generate()) def __unicode__(self): return unicode(self.generate()) def append(self, node): """Append an element or string as child node. :param node: the node to append; can be an `Element`, `Fragment`, or a `Stream`, or a Python string or number """ if isinstance(node, (Stream, Element, basestring, int, float, long)): # For objects of a known/primitive type, we avoid the check for # whether it is iterable for better performance self.children.append(node) elif isinstance(node, Fragment): self.children.extend(node.children) elif node is not None: try: map(self.append, iter(node)) except TypeError: self.children.append(node) def _generate(self): for child in self.children: if isinstance(child, Fragment): for event in child._generate(): yield event elif isinstance(child, Stream): for event in child: yield event else: if not isinstance(child, basestring): child = unicode(child) yield TEXT, child, (None, -1, -1) def generate(self): """Return a markup event stream for the fragment.""" return Stream(self._generate()) def _value_to_unicode(value): if isinstance(value, unicode): return value return unicode(value) def _kwargs_to_attrs(kwargs): return [(QName(k.rstrip('_').replace('_', '-')), _value_to_unicode(v)) for k, v in kwargs.items() if v is not None] class Element(Fragment): """Simple XML output generator based on the builder pattern. Construct XML elements by passing the tag name to the constructor: >>> print Element('strong') Attributes can be specified using keyword arguments. The values of the arguments will be converted to strings and any special XML characters escaped: >>> print Element('textarea', rows=10, cols=60)