5 | | Common concepts and features: |
6 | | * The same basic set of directives (excluding `py:extends` and `py:layout`) |
7 | | * Inline expressions using the `${expr}` (or just `$expr`) syntax. |
8 | | * Expressions are real Python code, not some “crippled” mini language. |
9 | | * Stream-based processing model making heavy use of Python generators. |
10 | | * Different serialization methods, for example to produce XML or HTML output. |
| 5 | Templates are XML files that include ''processing directives'' identified by the namespace `http://markup.edgewall.org/` and ''template expressions'' that are dynamically substituted by variable data. |
12 | | Differences include: |
13 | | * No generation of Python code for a template; the template is executed directly. |
14 | | * No support for `<?python ?>` processing instructions |
15 | | * Expressions are evaluated in a more flexible manner, meaning you can use e.g. dotted notation to access items in a dictionary, and the other way around (see the [source:/trunk/markup/eval.py markup.eval] module) |
16 | | * Proper scoping of variables. Names do not leak into outer scopes. |
17 | | * Use of XInclude and match templates instead of Kid's `py:extends` / `py:layout` directives |
18 | | * `py:match` directives use (basic) XPath expressions to match against input nodes, making match templates more powerful while keeping the syntax simple (see the [source:/trunk/markup/path.py markup.path] module) |
19 | | * Real (thread-safe) search path support |
20 | | * No dependency on ElementTree (due to the lack of position reporting) |
21 | | * The original location of parse events is kept throughout the processing pipeline, so that errors can be tracked back to a specific line/column in the template file |
22 | | * In simple tests (see [source:/trunk/examples/basic examples/basic]) the rendering phase (i.e. not including parsing/compilation) runs about twice as fast compared to Kid. Parsing is generally quite a bit faster in Markup, too. |
| 7 | [[PageOutline(2-3, Table of Contents, inline)]] |
| 8 | |
| 9 | == Expressions == |
| 10 | |
| 11 | == Directives == |
| 12 | |
| 13 | === `py:content` === |
| 14 | |
| 15 | === `py:replace` === |
| 16 | |
| 17 | === `py:attrs` === |
| 18 | |
| 19 | === `py:if` === |
| 20 | |
| 21 | === `py:choose` / `py:when` / `py:otherwise` === |
| 22 | |
| 23 | === `py:for` === |
| 24 | |
| 25 | === `py:def` === |
| 26 | |
| 27 | === `py:match` === |
| 28 | |
| 29 | == Includes == |