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