Edgewall Software

Changes between Version 15 and Version 16 of GenshiFaq


Ignore:
Timestamp:
Aug 7, 2006, 8:07:19 PM (13 years ago)
Author:
cmlenz
Comment:

More links

Legend:

Unmodified
Added
Removed
Modified
  • GenshiFaq

    v15 v16  
    4040Markup executes templates directly, there's no code generation phase. Expressions are evaluated in a more forgiving way using AST transformation. Template variables are stored on a stack, which means that some variable set in a loop deep in the template won't leak into the rest of the template. And even though Markup doesn't generate Python code for templates, it generally [wiki:MarkupPerformance performs] slightly better than Kid (even up to 2x in [source:/trunk/examples/basic/ some of our tests], but the exact differences depend on a lot of factors).
    4141
    42 Markup does not depend on !ElementTree. It uses Expat for parsing XML, and is based on streaming slightly abstracted parse events through the processing pipeline. It uses XInclude – instead of Kids' `py:extends` – to allow template authors to factor out common bits. For match templates, it uses XPath expressions instead of the !ElementTree API.
     42Markup does not depend on !ElementTree. It uses Expat for parsing XML, and is based on streaming slightly abstracted parse events through the processing pipeline. It uses [http://www.w3.org/TR/xinclude/ XInclude] – instead of Kids' `py:extends` – to allow template authors to factor out common bits. For match templates, it uses [http://www.w3.org/TR/xpath XPath] expressions instead of the !ElementTree API.
    4343
    4444For more details about what's different see MarkupVsKid.
     
    4747
    4848Beyond the template engine, Markup provides:
    49  * a unified stream-based processing model for markup, where
    50  * streams can come from XML or HTML text, or be generated programmatically using a very simple syntax.
    51  * XPath can be used to query any stream, not just in templates.
     49 * a [MarkupStream unified stream-based processing model] for markup, where
     50 * streams can come from XML or HTML text, or be [MarkupBuilder generated programmatically] using a very simple syntax.
     51 * [MarkupPath XPath] can be used to query any stream, not just in templates.
    5252 * Different serialization methods (XML and HTML) for streams.
    5353 * An HTML “sanitizing” filter to strip potentially dangerous elements or attributes from user-submitted HTML markup.
     
    5959Template inheritance is a concept that fits well with template languages where a master template provide “slots” that are “filled” by the inheriting templates. However, Markup has no such feature, and instead uses the more powerful and flexible concept of [wiki:MarkupTemplates#py:match match templates].
    6060
    61 Furthermore, XInclude is a W3C standard, which means that it is more likely to be supported in authoring tools than some esoteric custom notation for including external resources.
     61Furthermore, [http://www.w3.org/TR/xinclude/ XInclude] is a [http://www.w3.org/ W3C] standard, which means that it is more likely to be supported in authoring tools than some esoteric custom notation for including external resources.
    6262
    63 See also MarkupRecipes/PyExtendsEquivalent and MarkupRecipes/PyLayoutEquivalent to find out how the Kid directives `py:extends` and `py:layout` map to includes in Markup.
     63''See also MarkupRecipes/PyExtendsEquivalent and MarkupRecipes/PyLayoutEquivalent to find out how the Kid directives `py:extends` and `py:layout` map to includes in Markup.''
    6464
    6565== What do I need to use Markup? ==
    6666
    67 Python 2.3 or later. Python 2.4 is recommended for better performance, plus error messages will include template line numbers and offset. [http://peak.telecommunity.com/DevCenter/setuptools Setuptools] is optional and only used for installation if it's available.
     67Python 2.3 or later. Python 2.4 is recommended for better performance, plus error messages will include template line numbers and column offsets. [http://peak.telecommunity.com/DevCenter/setuptools Setuptools] is optional and only used for installation if it's available.
    6868
    6969The template engine plugin (for http://www.turbogears.org/docs/plugins/template.html), which enables usage of Markup in frameworks such as [http://www.turbogears.com/ TurboGears], depends on Setuptools at runtime and installation time. Use of the plugin implementation is optional, though: Setuptools is ''not'' required for using Markup directly.