[Checkins] SVN: z3c.pt/trunk/ Namespace attribute xmlns no longer rendered for templates with no explicit document type.
Malthe Borch
mborch at gmail.com
Sat Sep 13 15:27:27 EDT 2008
Log message for revision 91124:
Namespace attribute xmlns no longer rendered for templates with no explicit document type.
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/src/z3c/pt/genshi.txt
U z3c.pt/trunk/src/z3c/pt/i18n.txt
U z3c.pt/trunk/src/z3c/pt/template.txt
U z3c.pt/trunk/src/z3c/pt/translation.py
U z3c.pt/trunk/src/z3c/pt/translation.txt
U z3c.pt/trunk/src/z3c/pt/zpt.txt
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/CHANGES.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -6,6 +6,9 @@
Backwards incompatibilities
+- Namespace attribute "xmlns" no longer rendered for templates with no
+ explicit document type. [malthe]
+
- Changes to template method signatures. [malthe]
- Engine now expects all strings to be unicode or contain ASCII
Modified: z3c.pt/trunk/src/z3c/pt/genshi.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/genshi.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/genshi.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -21,7 +21,7 @@
... <b>Foo</b>
... </py:if>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
<p>Foo</p>
</div>
@@ -57,7 +57,7 @@
... </div>
... </div>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
<span>1</span>
<div>
@@ -85,7 +85,7 @@
... <li>${item}</li>
... </py:for>
... </ul>""")
- <ul xmlns="http://www.w3.org/1999/xhtml">
+ <ul>
<li>0</li>
<li>1</li>
<li>2</li>
@@ -109,7 +109,7 @@
... ${goodbye('world')}
... ${goodbye('everyone')}
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<p class="greeting">
Hello, world!
</p>
@@ -142,7 +142,7 @@
... "${q["quote"]} <em>${q["author"]}</em>
... </blockquote>
... </div>""", quote=quote)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>2 7 12</span>
4 3 9
<blockquote>
@@ -159,7 +159,7 @@
... <li class="expand" py:attrs="{'class': 'collapse'}">Bar</li>
... <li class="expand" py:attrs="d">Bar</li>
... </ul>""", d=dict({'class': u'\u1234'}))
- <ul xmlns="http://www.w3.org/1999/xhtml">
+ <ul>
<li class="collapse">Bar</li>
<li class="á´">Bar</li>
</ul>
@@ -172,7 +172,7 @@
... <span py:content="'Hello, world!'" />
... <span py:replace="'Goodbye, world!'" />
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>Hello, world!</span>
Goodbye, world!
</div>
@@ -184,7 +184,7 @@
... xmlns:py="http://genshi.edgewall.org/">
... <span py:strip="True"><b>foo</b></span>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<b>foo</b>
</div>
@@ -193,16 +193,16 @@
>>> print render_genshi("""\
... <div xmlns="http://www.w3.org/1999/xhtml"
... xmlns:py="http://genshi.edgewall.org/">
- ... <span py:match="xmlns:greeting">
+ ... <span py:match=".//xmlns:greeting">
... Hello, ${select('@name')[0]}!
... </span>
- ... <py:match path="xmlns:farewell">
+ ... <py:match path=".//xmlns:farewell">
... <span>Goodbye, ${select('@name')[0]}!</span>
... </py:match>
... <greeting name="dude" />
... <farewell name="dude" />
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>
Hello, dude!
</span>
@@ -226,7 +226,7 @@
... <span style="position: ${'abs'}olute"
... class="my-${int('test') | 'class'} item${'Last'}" />
... </div>""", ltr={'letter': 'A', 'href': '?title=A', 'iscurrent': 'current'})
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>interpolation</span>is convenient!
<span>abc d</span>
<span class="Hello World!" />
@@ -242,7 +242,7 @@
... xmlns:py="http://genshi.edgewall.org/">
... <span py:with="y=7; z=x+10">$x $y $z</span>
... </div>""", x=42)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>42 7 52</span>
</div>
@@ -257,7 +257,7 @@
... <img alt="${unicode('La Pe\xc3\xb1a', 'utf-8').encode('utf-8')}" />
... <img alt="Hello ${unicode('La Pe\xc3\xb1a', 'utf-8').encode('utf-8')}!" />
... </div>""", encoding='utf-8')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<img alt="La Peña" />
<img alt="Hello La Peña" />
<img alt="La Peña, oh La Peña" />
@@ -273,7 +273,7 @@
... <img alt="La Peña" />
... <img alt="${alt}" />
... </div>""", alt=unicode("La Pe\xc3\xb1a", 'utf-8'))
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<img alt="La Peña" />
<img alt="La Peña" />
</div>
@@ -283,7 +283,7 @@
... <div xmlns="http://www.w3.org/1999/xhtml">
... <strong>"${quote}"</strong>
... </div>""", quote="Hello, World!")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<strong>"Hello, World!"</strong>
</div>
@@ -293,7 +293,7 @@
... <div xmlns="http://www.w3.org/1999/xhtml">
... ${message}
... </div>""", message="Hello, <em>World</em>!")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello, <em>World</em>!
</div>
@@ -320,7 +320,7 @@
... ${message}
... /* ]]> */
... </div>""", message="Hello, <em>World!")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
/* <![CDATA[ */
Hello, <em>World!
/* ]]> */
@@ -336,7 +336,7 @@
... line comment -->
... <!-- a comment with an ${'expression'} -->
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<!-- a comment -->
<!-- a multi-
line comment -->
@@ -355,7 +355,7 @@
... </py:for>
... ];
... </script>""")
- <script type="text/javascript" xmlns="http://www.w3.org/1999/xhtml">
+ <script type="text/javascript">
var brands = [
];
</script>
@@ -380,7 +380,7 @@
... });
... </script>
... </div>""", brands=brands)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<script type="text/javascript">
var brands = [
{ value : "1", title : "One" },
@@ -403,7 +403,7 @@
... ${rendermenu([])}
... </ul>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
</div>
:: Slightly more complex recursive function calls
@@ -421,7 +421,7 @@
... </ul>
... ${rendermenu(menu)}
... </div>""", menu=[dict(title=u"Menu entry", url="/test", current=True)])
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<ul>
<li class="current">
<a href="/test">Menu entry</a>
Modified: z3c.pt/trunk/src/z3c/pt/i18n.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/i18n.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/i18n.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -49,7 +49,7 @@
Let's try rendering this template without passing a target language.
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>
Default
</span>
@@ -58,7 +58,7 @@
Now we'll render the template again---passing German as the language.
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>Mock translation of 'test_msgid'.</span>
</div>
@@ -76,7 +76,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>
Default
</span>
@@ -85,7 +85,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span>Mock translation of 'Default'.</span>
</div>
@@ -101,14 +101,14 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<p>
<span>18</span> bananas.
</p>
</div>
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<p>Mock translation of '${count} bananas.'.</p>
</div>
@@ -129,7 +129,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Simple Title">
Default
</span>
@@ -138,7 +138,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Mock translation of 'Simple Title'.">
Default
</span>
@@ -159,7 +159,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Simple Title">
Default
</span>
@@ -168,7 +168,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Mock translation of 'title_simple'.">
Default
</span>
@@ -189,7 +189,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Simple Title">
Default
</span>
@@ -198,7 +198,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Mock translation of 'title_simple'.">
Default
</span>
@@ -220,7 +220,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Simple Title" longdesc="A not so short description.">
Default
</span>
@@ -229,7 +229,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Mock translation of 'title_simple'."
longdesc="Mock translation of 'desc_short'.">
Default
@@ -259,7 +259,7 @@
>>> template = PageTemplate(body)
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Title">
Default, "default", 'default'
</span>
@@ -269,7 +269,7 @@
Passing German:
>>> print template.render(target_language='de')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span title="Mock translation of 'aid'.">Mock translation of 'tid'.</span>
<span>Mock translation of 'tid'.</span>
</div>
Modified: z3c.pt/trunk/src/z3c/pt/template.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/template.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/template.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -13,7 +13,7 @@
... <div xmlns="http://www.w3.org/1999/xhtml">
... Hello World!
... </div>""")()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
</div>
@@ -25,7 +25,7 @@
>>> path = tests.__path__[0]
>>> t = PageTemplateFile(path+'/helloworld.pt')
>>> print t()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
</div>
@@ -47,7 +47,7 @@
>>> view = ViewPageTemplateView()
>>> print view(test=u'test')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span><ViewPageTemplateView object at ...></span>
<span>context</span>
<span>request</span>
@@ -67,7 +67,7 @@
>>> view = ViewPageTemplateView()
>>> print view(test=u'test')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span><ViewPageTemplateView object at ...></span>
<span>context</span>
<span>request</span>
@@ -121,11 +121,11 @@
>>> print PageTemplate("""\
... <div xmlns="http://www.w3.org/1999/xhtml"
... xmlns:py="http://genshi.edgewall.org/">
- ... <py:match path="xmlns:greeting">Hello ${select('@name')[0]}!</py:match>
+ ... <py:match path=".//xmlns:greeting">Hello ${select('@name')[0]}!</py:match>
... <greeting name="World" />
... </div>
... """, parser=GenshiParser())()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
<BLANKLINE>
</div>
@@ -157,7 +157,7 @@
... </div>""")
>>> print template2(template1=template1)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
<div>
Hello, world!
@@ -195,7 +195,7 @@
... </div>""")
>>> print content(main=main)
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <html>
<div>
I replace you.
</div>
@@ -206,7 +206,7 @@
>>> from z3c.pt.template import BaseTemplateFile
>>> template1 = BaseTemplateFile(path+"/xinclude1.pt", mock_parser)
>>> print template1()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
<span>Hello, world!</span>
</div>
@@ -219,7 +219,7 @@
>>> template2 = BaseTemplateFile(path+"/xinclude3.pt", GenshiParser())
>>> print template2()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<BLANKLINE>
<BLANKLINE>
<p class="greeting">
@@ -237,7 +237,7 @@
... registry[key] = loads(dumps(bct))
>>> print template2()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<BLANKLINE>
<BLANKLINE>
<p class="greeting">
Modified: z3c.pt/trunk/src/z3c/pt/translation.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.py 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/translation.py 2008-09-13 19:27:26 UTC (rev 91124)
@@ -236,7 +236,7 @@
# call template
_.append(clauses.Write(
types.template(
- "%%(xincludes)s.get(%%(include)s, %s).render(macro='', %s)" % \
+ "%%(xincludes)s.get(%%(include)s, %s).render_xinclude(%s)" % \
(repr(self.format), arguments))))
# use macro
@@ -532,22 +532,41 @@
def __init__(self, body, parser, implicit_doctype=None,
explicit_doctype=None, encoding=None):
- # if no doctype is defined, prepend the implicit doctype to
- # the document source
+ # documents without a document type declaration are augmented
+ # with default namespace declarations and proper XML entity
+ # definitions; this represents a 'convention' over
+ # 'configuration' approach to template documents
no_doctype_declaration = '<!DOCTYPE' not in body
+
+ # add default namespace declaration if no explicit document
+ # type has been set
+ if implicit_doctype and explicit_doctype is None and \
+ no_doctype_declaration:
+ body = """\
+ <meta:declare-ns
+ xmlns="%s" xmlns:tal="%s" xmlns:metal="%s" xmlns:i18n="%s"
+ xmlns:py="%s" xmlns:xinclude="%s" xmlns:meta="%s"
+ >%s</meta:declare-ns>""" % (
+ config.XHTML_NS, config.TAL_NS,
+ config.METAL_NS, config.I18N_NS,
+ config.PY_NS, config.XI_NS, config.META_NS,
+ body)
+
+ # prepend the implicit doctype to the document source and add
+ # entity definitions
if implicit_doctype and no_doctype_declaration:
- # munge entities into declaration
entities = "".join((
'<!ENTITY %s "&#%s;">' % (name, text) for (name, text) in \
htmlentitydefs.name2codepoint.items()))
+
implicit_doctype = implicit_doctype[:-1] + ' [ %s ]>' % entities
-
- # prepend to body
self.implicit_doctype = implicit_doctype
body = implicit_doctype + "\n" + body
-
+
+ # parse document
self.root, parsed_doctype = parser.parse(body)
+ # explicit document type has priority
if explicit_doctype is not None:
self.doctype = explicit_doctype
elif parsed_doctype and not no_doctype_declaration:
@@ -563,12 +582,13 @@
@classmethod
def from_text(cls, body, parser, **kwargs):
compiler = Compiler(
- "<html xmlns='%s'></html>" % config.XHTML_NS, parser, **kwargs)
+ "<html xmlns='%s'></html>" % config.XHTML_NS, parser,
+ implicit_doctype=None, encoding=kwargs.get('encoding'))
compiler.root.text = body
compiler.root.attrib[utils.meta_attr('omit-tag')] = ""
return compiler
- def __call__(self, macro=None, params=()):
+ def __call__(self, macro=None, global_scope=True, parameters=()):
if not isinstance(self.root, Element):
raise ValueError(
"Must define valid namespace for tag: '%s.'" % self.root.tag)
@@ -577,27 +597,31 @@
# where the macro is defined
if macro:
elements = self.root.xpath(
- 'descendant-or-self::*[@metal:define-macro="%s"]' % macro,
+ 'descendant-or-self::*[@metal:define-macro="%s"] |'
+ 'descendant-or-self::metal:*[@define-macro="%s"]' % (macro, macro),
namespaces={'metal': config.METAL_NS})
if not elements:
raise ValueError("Macro not found: %s." % macro)
- self.root = elements[0]
- del self.root.attrib[utils.metal_attr('define-macro')]
+ self.root = element = elements[0]
- if macro is None or 'include_ns_attribute' in params:
- # add namespace attribute
+ # remove attribute from tag
+ if element.nsmap[element.prefix] == config.METAL_NS:
+ del element.attrib['define-macro']
+ else:
+ del element.attrib[utils.metal_attr('define-macro')]
+
+ if macro is None or 'include_ns_attribute' in parameters:
+ # add namespace attribute to
namespace = self.root.tag.split('}')[0][1:]
self.root.attrib['xmlns'] = namespace
- # choose function wrapper; note that if macro is the empty
- # string, we'll still use the macro wrapper
- if macro is not None:
+ if global_scope:
+ wrapper = generation.template_wrapper
+ else:
wrapper = generation.macro_wrapper
- else:
- wrapper = generation.template_wrapper
-
+
# initialize code stream object
stream = generation.CodeIO(
self.root.node.symbols, encoding=self.encoding,
@@ -606,10 +630,10 @@
# initialize variable scope
stream.scope.append(set(
(stream.symbols.out, stream.symbols.write, stream.symbols.scope) + \
- tuple(params)))
+ tuple(parameters)))
# output doctype if any
- if self.doctype and isinstance(self.doctype, (str, unicode)):
+ if self.doctype and not macro:
doctype = self.doctype + '\n'
if self.encoding:
doctype = doctype.encode(self.encoding)
@@ -629,12 +653,12 @@
# prepare args
ignore = 'target_language',
- args = ', '.join((param for param in params if param not in ignore))
+ args = ', '.join((param for param in parameters if param not in ignore))
if args:
args += ', '
# prepare kwargs
- kwargs = ', '.join("%s=None" % param for param in params)
+ kwargs = ', '.join("%s=None" % param for param in parameters)
if kwargs:
kwargs += ', '
@@ -689,6 +713,7 @@
(type(self).__name__, str(type(self.parser)).split("'")[1])
def render(self, *args, **kwargs):
+ kwargs.update(self.selectors)
return self.func(generation, *args, **kwargs)
@property
Modified: z3c.pt/trunk/src/z3c/pt/translation.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/translation.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -14,7 +14,7 @@
... <div xmlns="http://www.w3.org/1999/xhtml">
... Hello World!
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
</div>
@@ -38,7 +38,7 @@
... La Peña
... <img alt="La Peña" />
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
La Peña
<img alt="La Peña" />
</div>
@@ -51,7 +51,7 @@
... /* ]]> */
... <span>Not protected</span> <![CDATA[ This is protected ]]>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
/* <![CDATA[ */
This is protected
/* ]]> */
@@ -84,7 +84,7 @@
... >→</a>
... <span class="→" />
... </html>""")
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <html>
Hello World!
<a href="localhost" title="Singing & Dancing">→</a>
<span class="→" />
@@ -97,7 +97,7 @@
... <?xml-stylesheet href="classic.xsl" type="text/xml"?>
... Hello World!
... </html>""")
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <html>
<?xml-stylesheet href="classic.xsl" type="text/xml"?>
Hello World!
</html>
@@ -108,7 +108,7 @@
... <html xmlns="http://www.w3.org/1999/xhtml">
... <!-- hello world -->
... </html>""")
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <html>
<!-- hello world -->
</html>
@@ -160,7 +160,7 @@
Let's try and render the template.
>>> print template.render()
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
</div>
@@ -171,30 +171,23 @@
This section demonstrates how the package handles templates that
contain errors.
-No default namespace declaration:
- A default namespace must be explicitly declared for the parser to work.
+:: Malformed syntax
+
+We expect the xml-parser to raise an exception.
- >>> body = '<br />'
- >>> render_xhtml(body)
- Traceback (most recent call last):
- ...
- ValueError: Must define valid namespace for tag: 'br.'
-
-Bad XML
- We expect the xml-parser to raise an exception.
-
>>> body = '<div xmlns="http://www.w3.org/1999/xhtml"'
>>> render_xhtml(body)
Traceback (most recent call last):
...
- XMLSyntaxError: Couldn't find end of Start Tag div...
+ XMLSyntaxError: ...
-Missing namespace definition:
- We expect the engine to raise an exception*
+:: Missing namespace definition
-*) This test only passes on lxml 2.x.
+If a document type is provided, namespaces must be declared.
>>> body = """\
+ ... <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ ... "http://www.w3.org/TR/html4/loose.dtd">
... <div xmlns="http://www.w3.org/1999/xhtml" tal:content="'Hello World'" />
... """
Modified: z3c.pt/trunk/src/z3c/pt/zpt.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/zpt.txt 2008-09-13 19:26:04 UTC (rev 91123)
+++ z3c.pt/trunk/src/z3c/pt/zpt.txt 2008-09-13 19:27:26 UTC (rev 91124)
@@ -31,7 +31,7 @@
... <span tal:replace="'Hello World!'"><b>Hello Universe!</b></span>
... <span tal:content="None" />
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<span class="defabc" style="hij" onclick="alert();" id="test">abcghi</span>
Hello World!
Hello World!
@@ -48,7 +48,7 @@
... <input tal:attributes="checked True"/>
... <input tal:attributes="checked False"/>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<option selected="True" />
<option />
<input checked="True" />
@@ -64,7 +64,7 @@
... <li tal:repeat="i range(5)"><span tal:replace="'Item ' + str(i) + ')'" /></li>
... </ul>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<ul>
<li>Item 0)</li>
<li>Item 1)</li>
@@ -83,7 +83,7 @@
... <li tal:repeat="i range(3)"><span tal:replace="str(i) + ' ' + str(repeat['i'].even())" /></li>
... </ul>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<ul>
<li>0 True</li>
<li>1 False</li>
@@ -103,7 +103,7 @@
... Do not show me!
... </div>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
Show me!
</div>
@@ -119,7 +119,7 @@
... line comment -->
... <!-- a comment with an ${'expression'} -->
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<!-- a comment -->
<!-- a multi-
line comment -->
@@ -137,7 +137,7 @@
... <tal:multiple repeat="i range(3)" replace="i" />
... <tal:div condition="True">True</tal:div>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello World!
Hello World!
Hello World!
@@ -156,7 +156,7 @@
... <p tal:omit-tag="True">No paragraph here either.</p>
... <p tal:omit-tag="False">A paragraph here.</p>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
No paragraph here.
No paragraph here either.
<p>A paragraph here.</p>
@@ -172,7 +172,7 @@
... <span tal:replace="'%sbr /%s' % (chr(60), chr(62))" />
... <span tal:content="unicode('La Pe\xc3\xb1a', 'utf-8')" />
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<img title="<Hello>" />
<br />
<br />
@@ -191,7 +191,7 @@
... <span tal:replace="path: test2/greeting" />
... </div>""", request=object(),
... test1={'greeting': u'Hello'}, test2=Test())
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello
Hello
</div>
@@ -205,7 +205,7 @@
... <img tal:attributes="alt string:Leonardo da Vinci;; Musee du Louvre, 1503;
... title string:Mona Lisa" />
... </div>""", request=object(), greeting=u'Hello')
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
Hello, world!
<img alt="Leonardo da Vinci; Musee du Louvre, 1503" title="Mona Lisa" />
</div>
@@ -219,7 +219,7 @@
... <span tal:replace="test/greeting" />
... </div>
... </div>""", request=object(), test={'greeting': u'Hello'})
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
Hello
</div>
@@ -245,7 +245,7 @@
... <span tal:replace="int('a')|path: mydict/a" />
... </tal:path-expression-testing>
... </div>""")
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<BLANKLINE>
<div>
1
@@ -269,7 +269,7 @@
... tal:replace="structure nocall: dir" />
... <span tal:replace="structure dir" />
... </div>""", request=object())
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<built-in function dir>
<built-in function dir>
</div>
@@ -296,7 +296,7 @@
>>> template = MockTemplate(body, ZopePageTemplateParser())
>>> print render_zpt(body, template=template)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div class="greeting">
Hello, earth!
</div>
@@ -337,7 +337,7 @@
>>> template = MockTemplate(body, ZopePageTemplateParser())
>>> print render_zpt(body, template=template)
- <div xmlns="http://www.w3.org/1999/xhtml">
+ <div>
<div>
Hello, <b class="name">stranger!</b>
</div>
More information about the Checkins
mailing list