Edgewall Software

Changes between Version 10 and Version 11 of GenshiFaq


Ignore:
Timestamp:
Jul 15, 2006, 1:51:19 PM (18 years ago)
Author:
cmlenz
Comment:

Fix Kid URLs

Legend:

Unmodified
Added
Removed
Modified
  • GenshiFaq

    v10 v11  
    77== What is Markup? ==
    88
    9 We like to call it a ''“toolkit for stream-based generation of markup for the web”''. The largest feature provided by Markup is an XML-based template engine that is heavily inspired by [http://kid.lesscode.org/ Kid].
     9We like to call it a ''“toolkit for stream-based generation of markup for the web”''. The largest feature provided by Markup is an XML-based template engine that is heavily inspired by [http://kid-templating.org/ Kid].
    1010
    1111== Why yet another template engine? ==
     
    3030== So then why not just use Kid? ==
    3131
    32 We think that Kid represents a huge step forward for XML-based templating in Python. [http://kid.lesscode.org/language.html#match-templates-py-match Match templates] and the generator-based processing model are extremely powerful concepts.
     32We think that Kid represents a huge step forward for XML-based templating in Python. [http://kid-templating.org/language.html#match-templates-py-match Match templates] and the generator-based processing model are extremely powerful concepts.
    3333
    3434But arguably Kid also has some basic design problems. For example, Kid generates Python code from templates, which adds a lot of complexity to the code and can make the process of locating and fixing template errors a true nightmare. A syntax error in a template expression will cause an exception that points somewhere in the generated code. In addition, as Kid is based on [http://effbot.org/zone/element-index.htm ElementTree], and the !ElementTree API doesn't provide location information for parse events, exceptions reported by Kid often don't include information about what part of the template caused the error.
     
    3838== What are the main differences between Kid and Markup? ==
    3939
    40 Markup executes templates directly, there's no code generation phase. Expressions are evaluated in a more forgiving way by walking the AST. 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).
     40Markup 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
    4242Markup 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.