Commit | Line | Data |
---|---|---|
c638d827 CR |
1 | TAL - Template Attribute Language |
2 | --------------------------------- | |
3 | ||
4 | This is an implementation of TAL, the Zope Template Attribute | |
5 | Language. For TAL, see the Zope Presentation Templates ZWiki: | |
6 | ||
7 | http://dev.zope.org/Wikis/DevSite/Projects/ZPT/FrontPage | |
8 | ||
9 | It is not a Zope product nor is it designed exclusively to run inside | |
10 | of Zope, but if you have a Zope checkout that includes | |
11 | Products/ParsedXML, its Expat parser will be used. | |
12 | ||
13 | Prerequisites | |
14 | ------------- | |
15 | ||
16 | You need: | |
17 | ||
18 | - A recent checkout of Zope2; don't forget to run the wo_pcgi.py | |
19 | script to compile everything. (See above -- this is now optional.) | |
20 | ||
21 | - A recent checkout of the Zope2 product ParsedXML, accessible | |
22 | throught <Zope2>/lib/python/Products/ParsedXML; don't forget to run | |
23 | the setup.py script to compiles Expat. (Again, optional.) | |
24 | ||
25 | - Python 1.5.2; the driver script refuses to work with other versions | |
26 | unless you specify the -n option; this is done so that I don't | |
27 | accidentally use Python 2.x features. | |
28 | ||
29 | - Create a .path file containing proper module search path; it should | |
30 | point the <Zope2>/lib/python directory that you want to use. | |
31 | ||
32 | How To Play | |
33 | ----------- | |
34 | ||
35 | (Don't forget to edit .path, see above!) | |
36 | ||
37 | The script driver.py takes an XML file with TAL markup as argument and | |
38 | writes the expanded version to standard output. The filename argument | |
39 | defaults to tests/input/test01.xml. | |
40 | ||
41 | Regression test | |
42 | --------------- | |
43 | ||
44 | There are unit test suites in the 'tests' subdirectory; these can be | |
45 | run with tests/run.py. This should print the testcase names plus | |
46 | progress info, followed by a final line saying "OK". It requires that | |
47 | ../unittest.py exists. | |
48 | ||
49 | There are a number of test files in the 'tests' subdirectory, named | |
50 | tests/input/test<number>.xml and tests/input/test<number>.html. The | |
51 | Python script ./runtest.py calls driver.main() for each test file, and | |
52 | should print "<file> OK" for each one. These tests are also run as | |
53 | part of the unit test suites, so tests/run.py is all you need. | |
54 | ||
55 | What's Here | |
56 | ----------- | |
57 | ||
58 | DummyEngine.py simple-minded TALES execution engine | |
59 | TALInterpreter.py class to interpret intermediate code | |
60 | TALGenerator.py class to generate intermediate code | |
61 | XMLParser.py base class to parse XML, avoiding DOM | |
62 | TALParser.py class to parse XML with TAL into intermediate code | |
63 | HTMLTALParser.py class to parse HTML with TAL into intermediate code | |
64 | HTMLParser.py HTML-parsing base class | |
65 | driver.py script to demonstrate TAL expansion | |
66 | timer.py script to time various processing phases | |
67 | setpath.py hack to set sys.path and import ZODB | |
68 | __init__.py empty file that makes this directory a package | |
69 | runtest.py Python script to run file-comparison tests | |
70 | ndiff.py helper for runtest.py to produce diffs | |
71 | tests/ drectory with test files and output | |
72 | tests/run.py Python script to run all tests | |
73 | ||
74 | Author and License | |
75 | ------------------ | |
76 | ||
77 | This code is written by Guido van Rossum (project lead), Fred Drake, | |
78 | and Tim Peters. It is owned by Digital Creations and can be | |
79 | redistributed under the Zope Public License. | |
80 | ||
81 | TO DO | |
82 | ----- | |
83 | ||
84 | (See also http://www.zope.org/Members/jim/ZPTIssueTracker .) | |
85 | ||
86 | - Need to remove leading whitespace and newline when omitting an | |
87 | element (either through tal:replace with a value of nothing or | |
88 | tal:condition with a false condition). | |
89 | ||
90 | - Empty TAL/METAL attributes are ignored: tal:replace="" is ignored | |
91 | rather than causing an error. | |
92 | ||
93 | - HTMLTALParser.py and TALParser.py are silly names. Should be | |
94 | HTMLTALCompiler.py and XMLTALCompiler.py (or maybe shortened, | |
95 | without "TAL"?) | |
96 | ||
97 | - Should we preserve case of tags and attribute names in HTML? |