[Checkins] SVN: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/ XML-declarations are now printed for all top-level templates.

Malthe Borch mborch at gmail.com
Tue Dec 2 08:39:11 EST 2008


Log message for revision 93538:
  XML-declarations are now printed for all top-level templates.

Changed:
  U   Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/i18n.txt
  U   Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/language.txt
  U   Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt

-=-
Modified: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/i18n.txt
===================================================================
--- Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/i18n.txt	2008-12-02 13:38:39 UTC (rev 93537)
+++ Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/i18n.txt	2008-12-02 13:39:11 UTC (rev 93538)
@@ -53,7 +53,7 @@
 Let's try rendering this template without passing a target language.
     
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>
       Default
     </span>
@@ -62,7 +62,7 @@
 Now we'll render the template again---passing German as the language.
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>Mock translation of 'test_msgid'.</span>
   </div>
 
@@ -80,7 +80,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>
       Default
     </span>
@@ -89,7 +89,7 @@
 Passing German:
   
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>Mock translation of 'Default'.</span>
   </div>
 
@@ -105,14 +105,14 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <p>
       <span>18</span> bananas.
     </p>
   </div>
     
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <p>Mock translation of '${count} bananas.'
        mapping={'count': '<span>18</span>'}.</p>
   </div>
@@ -132,7 +132,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>
        I want <span>12</span> bananas and
        <span>8</span> apples.
@@ -142,7 +142,7 @@
 In German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>Mock translation of 'I want ${bananas} bananas and ${apples} apples.'
       mapping={'bananas': '<span>12</span>', 'apples': '<span>8</span>'}.</span>
   </div>
@@ -176,7 +176,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render(year=year, monthname=monthname)
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
       November
       2008
   </div>
@@ -184,7 +184,7 @@
 Passing German:
   
   >>> print template.render(year=year, monthname=monthname, target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
       Mock translation of 'month_nov'.
       2008
   </div>
@@ -201,7 +201,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span>
       <sup>&reg;</sup>
     </span>
@@ -224,7 +224,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Simple Title">
       Default
     </span>
@@ -233,7 +233,7 @@
 Passing German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Mock translation of 'Simple Title'.">
       Default
     </span>
@@ -254,7 +254,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Simple Title">
       Default
     </span>
@@ -263,7 +263,7 @@
 Passing German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Mock translation of 'title_simple'.">
       Default
     </span>
@@ -284,7 +284,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Simple Title">
       Default
     </span>
@@ -293,7 +293,7 @@
 Passing German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Mock translation of 'title_simple'.">
       Default
     </span>
@@ -315,7 +315,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Simple Title" longdesc="A not so short description.">
       Default
     </span>
@@ -324,7 +324,7 @@
 Passing German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Mock translation of 'title_simple'."
           longdesc="Mock translation of 'desc_short'.">
       Default
@@ -360,7 +360,7 @@
 
   >>> template = PageTemplate(body)
   >>> print template.render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Title">
       Default, "default", 'default'
     </span>
@@ -372,7 +372,7 @@
 Passing German:
 
   >>> print template.render(target_language='de')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <span title="Mock translation of 'aid'.">Mock translation of 'tid'.</span>
     <span>Mock translation of 'tid'.</span>
     <span>Mock translation of 'tid'.</span>
@@ -393,7 +393,7 @@
 Not passing a language:
 
   >>> print PageTemplate(body).render()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <div>
       <span>Default</span>
     </div>

Modified: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/language.txt
===================================================================
--- Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/language.txt	2008-12-02 13:38:39 UTC (rev 93537)
+++ Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/language.txt	2008-12-02 13:39:11 UTC (rev 93538)
@@ -32,28 +32,28 @@
   ...   <span tal:replace="'Hello World!'"><b>Hello Universe!</b></span>
   ...   <span tal:content="None" />
   ... </div>""")
-    <div>
-      <span class="defabcdummy" style="hij" onclick="alert();" id="test">abcghi</span>
-      Hello World!
-      Hello World!
-    </div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
+    <span class="defabcdummy" style="hij" onclick="alert();" id="test">abcghi</span>
+    Hello World!
+    Hello World!
+  </div>
 
 tal:attributes 'checked' and 'selected' toggles
 
   >>> print render("""\
   ... <div xmlns="http://www.w3.org/1999/xhtml"
   ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
-  ...   <option tal:attributes="selected True"/>
-  ...   <option tal:attributes="selected None"/>
-  ...   <input tal:attributes="checked True"/>
-  ...   <input tal:attributes="checked False"/>
+  ...   <option tal:attributes="selected True"></option>
+  ...   <option tal:attributes="selected None"></option>
+  ...   <input tal:attributes="checked True" />
+  ...   <input tal:attributes="checked False" />
   ... </div>""")
-    <div>
-       <option selected="True"></option>
-       <option></option>
-       <input checked="True" />
-       <input />
-    </div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
+     <option selected="True"></option>
+     <option></option>
+     <input checked="True" />
+     <input />
+  </div>
 
 tal:repeat
     
@@ -64,15 +64,15 @@
   ...     <li tal:repeat="i range(5)"><span tal:replace="'Item ' + str(i) + ')'" /></li>
   ...   </ul>
   ... </div>""")
-    <div>
-      <ul>
-        <li>Item 0)</li>
-        <li>Item 1)</li>
-        <li>Item 2)</li>
-        <li>Item 3)</li>
-        <li>Item 4)</li>
-      </ul>
-    </div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
+    <ul>
+      <li>Item 0)</li>
+      <li>Item 1)</li>
+      <li>Item 2)</li>
+      <li>Item 3)</li>
+      <li>Item 4)</li>
+    </ul>
+  </div>
 
 tal:repeat (repeat-variable)
 
@@ -83,7 +83,7 @@
   ...     <li tal:repeat="i range(3)"><span tal:replace="str(i) + ' ' + str(repeat['i'].even())" /></li>
   ...   </ul>
   ... </div>""")
-    <div>
+    <div xmlns="http://www.w3.org/1999/xhtml">
       <ul>
         <li>0 True</li>
         <li>1 False</li>
@@ -103,7 +103,7 @@
   ...     Do not show me!
   ...   </div>
   ... </div>""")
-    <div>
+    <div xmlns="http://www.w3.org/1999/xhtml">
       <div>
         Show me!
       </div>
@@ -120,7 +120,7 @@
   ...   <tal:multiple repeat="i range(3)" replace="i" />
   ...   <tal:div condition="True">True</tal:div>
   ... </div>""")
-    <div>
+    <div xmlns="http://www.w3.org/1999/xhtml">
       Hello World!
       Hello World!
       Hello World!
@@ -139,7 +139,7 @@
   ...   <p tal:omit-tag="True">No paragraph here either.</p>
   ...   <p tal:omit-tag="False">A paragraph here.</p>
   ... </div>""")
-    <div>
+    <div xmlns="http://www.w3.org/1999/xhtml">
       No paragraph here.
       No paragraph here either.
       <p>A paragraph here.</p>
@@ -155,7 +155,7 @@
   ...   <span tal:replace="'%sbr /%s' % (chr(60), chr(62))" />
   ...   <span tal:content="unicode('La Pe\xc3\xb1a', 'utf-8')" />
   ... </div>""")
-    <div>
+    <div xmlns="http://www.w3.org/1999/xhtml">
       <img title="&lt;Hello&gt;" />
       <br />
       &lt;br /&gt;
@@ -171,7 +171,7 @@
   ...   <img tal:attributes="alt string:Leonardo da Vinci;; Musee du Louvre, 1503;
   ...                        title string:Mona Lisa" />
   ... </div>""", request=object(), greeting=u'Hello')
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     Hello, world!
     <img alt="Leonardo da Vinci; Musee du Louvre, 1503" title="Mona Lisa" />
   </div>
@@ -184,7 +184,7 @@
   ...      <span tal:replace="abc|1" />
   ...      <span tal:replace="2|abc" />
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
        1
        2
   </div>
@@ -196,7 +196,7 @@
   ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
   ...   <span tal:replace="structure dir" />
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <built-in function dir>
   </div>
 
@@ -222,7 +222,7 @@
 
   >>> template = MockTemplate(body, Parser())
   >>> print render(body, template=template)
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <div class="greeting">
       Hello, earth!
     </div>
@@ -263,7 +263,7 @@
 
   >>> template = MockTemplate(body, Parser())
   >>> print render(body, template=template)
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <div>
       Hey, <span class="name">
       a <em>stranger!</em></span>
@@ -301,7 +301,7 @@
   ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
   ...   Interpolation ${'expressions'} are ${'convenient'}.
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     Interpolation expressions are convenient.
   </div>
 
@@ -312,7 +312,7 @@
   ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
   ...   <img alt="Interpolation ${'expressions'} are ${'convenient'}" />
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <img alt="Interpolation expressions are convenient" />
   </div>
 
@@ -326,7 +326,7 @@
   ...     ${'foo'}
   ...   </div>
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <div>
       ${'foo'}
     </div>
@@ -353,7 +353,7 @@
   ...     </span>
   ...   </div>
   ... </div>""")
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     <div>
       ${nope}
     </div>

Modified: Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt
===================================================================
--- Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt	2008-12-02 13:38:39 UTC (rev 93537)
+++ Sandbox/malthe/chameleon.zpt/src/chameleon/zpt/template.txt	2008-12-02 13:39:11 UTC (rev 93538)
@@ -14,7 +14,7 @@
   ... <div xmlns="http://www.w3.org/1999/xhtml">
   ...   Hello World!
   ... </div>""")()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     Hello World!
   </div>
 
@@ -24,7 +24,7 @@
   >>> path = tests.__path__[0]
   >>> t = PageTemplateFile(path+'/helloworld.pt')
   >>> print t()
-  <div>
+  <div xmlns="http://www.w3.org/1999/xhtml">
     Hello World!
   </div>
 
@@ -63,7 +63,7 @@
   ... </div>""")
 
   >>> print content(main=main, bar='bar')
-  <html>
+  <html xmlns="http://www.w3.org/1999/xhtml">
     Who are you, foo?
     <div>
        I replace you: foo (boo).



More information about the Checkins mailing list