Changes between Version 15 and Version 16 of GenshiFaq
- Timestamp:
- Aug 7, 2006, 8:07:19 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenshiFaq
v15 v16 40 40 Markup 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). 41 41 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 XPathexpressions instead of the !ElementTree API.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 [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. 43 43 44 44 For more details about what's different see MarkupVsKid. … … 47 47 48 48 Beyond the template engine, Markup provides: 49 * a unified stream-based processing modelfor markup, where50 * streams can come from XML or HTML text, or be generated programmaticallyusing a very simple syntax.51 * XPathcan 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. 52 52 * Different serialization methods (XML and HTML) for streams. 53 53 * An HTML “sanitizing” filter to strip potentially dangerous elements or attributes from user-submitted HTML markup. … … 59 59 Template 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]. 60 60 61 Furthermore, XInclude is a W3Cstandard, which means that it is more likely to be supported in authoring tools than some esoteric custom notation for including external resources.61 Furthermore, [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. 62 62 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.'' 64 64 65 65 == What do I need to use Markup? == 66 66 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.67 Python 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. 68 68 69 69 The 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.