Mercurial > genshi > genshi-test
changeset 61:33c2702cf6da
Use a different namespace than Kid uses.
line wrap: on
line diff
--- a/examples/basic/layout.html +++ b/examples/basic/layout.html @@ -1,4 +1,4 @@ -<div xmlns:py="http://purl.org/kid/ns#" py:strip=""> +<div xmlns:py="http://markup.edgewall.org/" py:strip=""> <head> <title>Hello ${hello}</title> <style type="text/css">@import(style.css)</style>
--- a/examples/basic/test.html +++ b/examples/basic/test.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" lang="en"> <xi:include href="layout.html" />
--- a/examples/bench/markup/template.html +++ b/examples/bench/markup/template.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" lang="en"> <head>
--- a/examples/bench/run.py +++ b/examples/bench/run.py @@ -5,7 +5,7 @@ def markup(dirname): from markup.template import Context, TemplateLoader - loader = TemplateLoader([dirname], False) + loader = TemplateLoader([dirname]) template = loader.load('template.html') def render(): ctxt = Context(title='Just a test', @@ -64,6 +64,17 @@ except ImportError: return None +def nevow(dirname): + # FIXME: can't figure out the API + try: + from nevow.loaders import xmlfile + template = xmlfile('template.xml', templateDir=dirname).load() + def render(): + print template + return render + except ImportError: + return None + def main(): basepath = os.path.abspath(os.path.dirname(__file__)) for engine in ('markup', 'clearsilver', 'kid'):
--- a/examples/includes/common/macros.html +++ b/examples/includes/common/macros.html @@ -1,4 +1,4 @@ -<div xmlns:py="http://purl.org/kid/ns#" +<div xmlns:py="http://markup.edgewall.org/" py:strip=""> <div py:def="macro1">reference me, please</div> <div py:def="macro2(name, classname='expanded')" class="${classname}">
--- a/examples/includes/module/test.html +++ b/examples/includes/module/test.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="${skin}/layout.html" /> <xi:include href="custom_stuff.html"><xi:fallback/></xi:include>
--- a/examples/includes/skins/default/layout.html +++ b/examples/includes/skins/default/layout.html @@ -1,5 +1,5 @@ <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> <xi:include href="../macros.html" />
--- a/examples/trac/templates/about.html +++ b/examples/trac/templates/about.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/attachment_delete.html +++ b/examples/trac/templates/attachment_delete.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/attachment_list.html +++ b/examples/trac/templates/attachment_list.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/attachment_new.html +++ b/examples/trac/templates/attachment_new.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/attachment_view.html +++ b/examples/trac/templates/attachment_view.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/layout.html +++ b/examples/trac/templates/layout.html @@ -1,5 +1,5 @@ <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> <xi:include href="site.html"><xi:fallback/></xi:include>
--- a/examples/trac/templates/search.html +++ b/examples/trac/templates/search.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/trac/templates/settings.html +++ b/examples/trac/templates/settings.html @@ -2,7 +2,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="layout.html"><xi:fallback/></xi:include> <head>
--- a/examples/turbogears/markuptest/templates/login.html +++ b/examples/turbogears/markuptest/templates/login.html @@ -1,7 +1,7 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="master.html" />
--- a/examples/turbogears/markuptest/templates/master.html +++ b/examples/turbogears/markuptest/templates/master.html @@ -1,5 +1,5 @@ <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" py:strip=""> <xi:include href="sitetemplate.html"><xi:fallback/></xi:include>
--- a/examples/turbogears/markuptest/templates/welcome.html +++ b/examples/turbogears/markuptest/templates/welcome.html @@ -1,6 +1,6 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:py="http://purl.org/kid/ns#" + xmlns:py="http://markup.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="master.html" />
--- a/markup/path.py +++ b/markup/path.py @@ -104,7 +104,7 @@ >>> from markup.input import XML >>> xml = XML('<root><elem><child>Text</child></elem></root>') - + >>> print Path('child').select(xml) <child>Text</child>
--- a/markup/template.py +++ b/markup/template.py @@ -199,7 +199,7 @@ values of that dictionary will be added as attributes to the element: >>> ctxt = Context(foo={'class': 'collapse'}) - >>> tmpl = Template('''<ul xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<ul xmlns:py="http://markup.edgewall.org/"> ... <li py:attrs="foo">Bar</li> ... </ul>''') >>> print tmpl.generate(ctxt) @@ -244,7 +244,7 @@ evaluating the value of the `py:content` attribute: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''<ul xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<ul xmlns:py="http://markup.edgewall.org/"> ... <li py:content="bar">Hello</li> ... </ul>''') >>> print tmpl.generate(ctxt) @@ -280,7 +280,7 @@ from template expressions: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <p py:def="echo(greeting, name='world')" class="message"> ... ${greeting}, ${name}! ... </p> @@ -294,7 +294,7 @@ </div> >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <p py:def="echo(greeting, name='world')" class="message"> ... ${greeting}, ${name}! ... </p> @@ -353,7 +353,7 @@ element based on an iterable in the context data. >>> ctxt = Context(items=[1, 2, 3]) - >>> tmpl = Template('''<ul xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<ul xmlns:py="http://markup.edgewall.org/"> ... <li py:for="item in items">${item}</li> ... </ul>''') >>> print tmpl.generate(ctxt) @@ -393,7 +393,7 @@ excluding elements from being output. >>> ctxt = Context(foo=True, bar='Hello') - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <b py:if="foo">${bar}</b> ... </div>''') >>> print tmpl.generate(ctxt) @@ -412,7 +412,7 @@ class MatchDirective(Directive): """Implementation of the `py:match` template directive. - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <span py:match="greeting"> ... Hello ${select('@name')} ... </span> @@ -449,7 +449,7 @@ value of the `py:replace` attribute: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <span py:replace="bar">Hello</span> ... </div>''') >>> print tmpl.generate(ctxt) @@ -461,7 +461,7 @@ providing a less verbose way to achieve the same effect: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <span py:content="bar" py:strip="">Hello</span> ... </div>''') >>> print tmpl.generate(ctxt) @@ -482,7 +482,7 @@ When the value of the `py:strip` attribute evaluates to `True`, the element is stripped from the output - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <div py:strip="True"><b>foo</b></div> ... </div>''') >>> print tmpl.generate() @@ -495,7 +495,7 @@ This directive is particulary interesting for named template functions or match templates that do not generate a top-level element: - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#"> + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/"> ... <div py:def="echo(what)" py:strip=""> ... <b>${what}</b> ... </div> @@ -535,7 +535,7 @@ `py:otherwise` will be used. >>> ctxt = Context() - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#" + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/" ... py:choose=""> ... <span py:when="0 == 1">0</span> ... <span py:when="1 == 1">1</span> @@ -549,7 +549,7 @@ If the `py:choose` directive contains an expression, the nested `py:when` directives are tested for equality to the `py:choose` expression: - >>> tmpl = Template('''<div xmlns:py="http://purl.org/kid/ns#" + >>> tmpl = Template('''<div xmlns:py="http://markup.edgewall.org/" ... py:choose="2"> ... <span py:when="1">1</span> ... <span py:when="2">2</span> @@ -615,7 +615,7 @@ """Can parse a template and transform it into the corresponding output based on context data. """ - NAMESPACE = Namespace('http://purl.org/kid/ns#') + NAMESPACE = Namespace('http://markup.edgewall.org/') EXPR = StreamEventKind('EXPR') # an expression SUB = StreamEventKind('SUB') # a "subprogram"
--- a/markup/tests/template.py +++ b/markup/tests/template.py @@ -27,7 +27,7 @@ """ Verify that the directive has access to the loop variables. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem py:for="item in items" py:attrs="item"/> </doc>""") items = [{'id': 1, 'class': 'foo'}, {'id': 2, 'class': 'bar'}] @@ -40,7 +40,7 @@ Verify that an attribute value that evaluates to `None` removes an existing attribute of that name. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem class="foo" py:attrs="{'class': 'bar'}"/> </doc>""") self.assertEqual("""<doc> @@ -52,7 +52,7 @@ Verify that an attribute value that evaluates to `None` removes an existing attribute of that name. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem class="foo" py:attrs="{'class': None}"/> </doc>""") self.assertEqual("""<doc> @@ -69,7 +69,7 @@ Verify that, if multiple `py:when` bodies match, only the first is output. """ - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#" py:choose=""> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/" py:choose=""> <span py:when="1 == 1">1</span> <span py:when="2 == 2">2</span> <span py:when="3 == 3">3</span> @@ -79,7 +79,7 @@ </div>""", str(tmpl.generate())) def test_otherwise(self): - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#" py:choose=""> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/" py:choose=""> <span py:when="False">hidden</span> <span py:otherwise="">hello</span> </div>""") @@ -91,7 +91,7 @@ """ Verify that `py:choose` blocks can be nested: """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <div py:choose="1"> <div py:when="1" py:choose="3"> <span py:when="2">2</span> @@ -112,7 +112,7 @@ Verify that a when directive with a strip directive actually strips of the outer element. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <div py:choose="" py:strip=""> <span py:otherwise="">foo</span> </div> @@ -130,7 +130,7 @@ Verify that a named template function with a strip directive actually strips of the outer element. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <div py:def="echo(what)" py:strip=""> <b>${what}</b> </div> @@ -149,7 +149,7 @@ Verify that the combining the `py:for` directive with `py:strip` works correctly. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <div py:for="item in items" py:strip=""> <b>${item}</b> </div> @@ -171,7 +171,7 @@ Verify that a match template can produce the same kind of element that it matched without entering an infinite recursion. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem py:match="elem" py:strip=""> <div class="elem">${select('*/text()')}</div> </elem> @@ -186,7 +186,7 @@ Verify that a match template can produce the same kind of element that it matched without entering an infinite recursion. """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem py:match="elem"> <div class="elem">${select('*/text()')}</div> </elem> @@ -203,7 +203,7 @@ Match directives are applied recursively, meaning that they are also applied to any content they may have produced themselves: """ - tmpl = Template("""<doc xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<doc xmlns:py="http://markup.edgewall.org/"> <elem py:match="elem"> <div class="elem"> ${select('*/*')} @@ -234,7 +234,7 @@ themselves output the element they match, avoiding recursion is even more complex, but should work. """ - tmpl = Template("""<html xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<html xmlns:py="http://markup.edgewall.org/"> <body py:match="body"> <div id="header"/> ${select('*/*')} @@ -259,7 +259,7 @@ """Tests for the `py:strip` template directive.""" def test_strip_false(self): - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/"> <div py:strip="False"><b>foo</b></div> </div>""") self.assertEqual("""<div> @@ -267,7 +267,7 @@ </div>""", str(tmpl.generate())) def test_strip_empty(self): - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/"> <div py:strip=""><b>foo</b></div> </div>""") self.assertEqual("""<div> @@ -330,7 +330,7 @@ self.assertEqual('<root attr="1"/>', str(tmpl.generate(ctxt))) def test_bad_directive_error(self): - xml = '<p xmlns:py="http://purl.org/kid/ns#" py:do="nothing" />' + xml = '<p xmlns:py="http://markup.edgewall.org/" py:do="nothing" />' try: tmpl = Template(xml, filename='test.html') except BadDirectiveError, e: @@ -339,7 +339,7 @@ self.assertEqual(1, e.lineno) def test_directive_value_syntax_error(self): - xml = '<p xmlns:py="http://purl.org/kid/ns#" py:if="bar\'" />' + xml = '<p xmlns:py="http://markup.edgewall.org/" py:if="bar\'" />' tmpl = Template(xml, filename='test.html') try: list(tmpl.generate(Context())) @@ -368,7 +368,7 @@ Verify that outputting context data that is a `Markup` instance is not escaped. """ - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/"> $myvar </div>""") self.assertEqual("""<div> @@ -379,7 +379,7 @@ """ Verify that outputting context data in text nodes doesn't escape quotes. """ - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/"> $myvar </div>""") self.assertEqual("""<div> @@ -390,7 +390,7 @@ """ Verify that outputting context data in attribtes escapes quotes. """ - tmpl = Template("""<div xmlns:py="http://purl.org/kid/ns#"> + tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/"> <elem class="$myvar"/> </div>""") self.assertEqual("""<div>