[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/translation.txt Cleaned up tests for 'path:' and 'string:' expressions.
Malthe Borch
mborch at gmail.com
Mon Aug 11 10:55:13 EDT 2008
Log message for revision 89654:
Cleaned up tests for 'path:' and 'string:' expressions.
Changed:
U z3c.pt/trunk/src/z3c/pt/translation.txt
-=-
Modified: z3c.pt/trunk/src/z3c/pt/translation.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.txt 2008-08-11 14:53:12 UTC (rev 89653)
+++ z3c.pt/trunk/src/z3c/pt/translation.txt 2008-08-11 14:55:13 UTC (rev 89654)
@@ -227,11 +227,51 @@
<span>La Peña</span>
</div>
-:: Setting default expression
+:: Using the "path:" expression
>>> print render("""\
... <div xmlns="http://www.w3.org/1999/xhtml"
... xmlns:tal="http://xml.zope.org/namespaces/tal">
+ ... <span tal:replace="path: test/greeting" />
+ ... </div>""", translate_xml, request=object(), test={'greeting': u'Hello'})
+ <div>
+ Hello
+ </div>
+
+:: Using the "string:" expression
+
+ >>> print render("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml"
+ ... xmlns:tal="http://xml.zope.org/namespaces/tal">
+ ... <span tal:replace="string:${greeting}, world!" />
+ ... <img tal:attributes="alt string:Leonardo da Vinci;; Musee du Louvre, 1503;
+ ... title string:Mona Lisa" />
+ ... </div>""", translate_xml, request=object(), greeting=u'Hello')
+ <div>
+ Hello, world!
+ <img alt="Leonardo da Vinci; Musee du Louvre, 1503" title="Mona Lisa" />
+ </div>
+
+:: Setting the default expression
+
+ >>> print render("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml"
+ ... xmlns:tal="http://xml.zope.org/namespaces/tal">
+ ... <div tal:default-expression="path">
+ ... <span tal:replace="test/greeting" />
+ ... </div>
+ ... </div>""", translate_xml, request=object(), test={'greeting': u'Hello'})
+ <div>
+ <div>
+ Hello
+ </div>
+ </div>
+
+:: Using different expressions with try-except operator (|)
+
+ >>> print render("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml"
+ ... xmlns:tal="http://xml.zope.org/namespaces/tal">
... <tal:path-expression-testing
... define="request object();
... mydict {'a': 1, 'c': {'a': 2}}">
More information about the Checkins
mailing list