# HG changeset patch # User cmlenz # Date 1152294892 0 # Node ID 448792ab1303f09f17cf7123b5c97ba989f5400c # Parent 2cb5b54d87ff80aa3679a651856c4cab4fe66a9b Use a different namespace than Kid uses. diff --git a/examples/basic/layout.html b/examples/basic/layout.html --- a/examples/basic/layout.html +++ b/examples/basic/layout.html @@ -1,4 +1,4 @@ -
+
Hello ${hello} diff --git a/examples/basic/test.html b/examples/basic/test.html --- 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"> diff --git a/examples/bench/markup/template.html b/examples/bench/markup/template.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"> diff --git a/examples/bench/run.py b/examples/bench/run.py --- 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'): diff --git a/examples/includes/common/macros.html b/examples/includes/common/macros.html --- a/examples/includes/common/macros.html +++ b/examples/includes/common/macros.html @@ -1,4 +1,4 @@ -
reference me, please
diff --git a/examples/includes/module/test.html b/examples/includes/module/test.html --- 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"> diff --git a/examples/includes/skins/default/layout.html b/examples/includes/skins/default/layout.html --- a/examples/includes/skins/default/layout.html +++ b/examples/includes/skins/default/layout.html @@ -1,5 +1,5 @@ diff --git a/examples/trac/templates/about.html b/examples/trac/templates/about.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"> diff --git a/examples/trac/templates/attachment_delete.html b/examples/trac/templates/attachment_delete.html --- 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"> diff --git a/examples/trac/templates/attachment_list.html b/examples/trac/templates/attachment_list.html --- 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"> diff --git a/examples/trac/templates/attachment_new.html b/examples/trac/templates/attachment_new.html --- 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"> diff --git a/examples/trac/templates/attachment_view.html b/examples/trac/templates/attachment_view.html --- 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"> diff --git a/examples/trac/templates/layout.html b/examples/trac/templates/layout.html --- a/examples/trac/templates/layout.html +++ b/examples/trac/templates/layout.html @@ -1,5 +1,5 @@ diff --git a/examples/trac/templates/search.html b/examples/trac/templates/search.html --- 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"> diff --git a/examples/trac/templates/settings.html b/examples/trac/templates/settings.html --- 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"> diff --git a/examples/turbogears/markuptest/templates/login.html b/examples/turbogears/markuptest/templates/login.html --- a/examples/turbogears/markuptest/templates/login.html +++ b/examples/turbogears/markuptest/templates/login.html @@ -1,7 +1,7 @@ diff --git a/examples/turbogears/markuptest/templates/master.html b/examples/turbogears/markuptest/templates/master.html --- a/examples/turbogears/markuptest/templates/master.html +++ b/examples/turbogears/markuptest/templates/master.html @@ -1,5 +1,5 @@ diff --git a/examples/turbogears/markuptest/templates/welcome.html b/examples/turbogears/markuptest/templates/welcome.html --- a/examples/turbogears/markuptest/templates/welcome.html +++ b/examples/turbogears/markuptest/templates/welcome.html @@ -1,6 +1,6 @@ diff --git a/markup/path.py b/markup/path.py --- a/markup/path.py +++ b/markup/path.py @@ -104,7 +104,7 @@ >>> from markup.input import XML >>> xml = XML('Text') - + >>> print Path('child').select(xml) Text diff --git a/markup/template.py b/markup/template.py --- 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('''
    + >>> tmpl = Template('''
      ...
    • Bar
    • ...
    ''') >>> print tmpl.generate(ctxt) @@ -244,7 +244,7 @@ evaluating the value of the `py:content` attribute: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''
      + >>> tmpl = Template('''
        ...
      • Hello
      • ...
      ''') >>> print tmpl.generate(ctxt) @@ -280,7 +280,7 @@ from template expressions: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''
      + >>> tmpl = Template('''
      ...

      ... ${greeting}, ${name}! ...

      @@ -294,7 +294,7 @@
      >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''
      + >>> tmpl = Template('''
      ...

      ... ${greeting}, ${name}! ...

      @@ -353,7 +353,7 @@ element based on an iterable in the context data. >>> ctxt = Context(items=[1, 2, 3]) - >>> tmpl = Template('''
        + >>> tmpl = Template('''
          ...
        • ${item}
        • ...
        ''') >>> print tmpl.generate(ctxt) @@ -393,7 +393,7 @@ excluding elements from being output. >>> ctxt = Context(foo=True, bar='Hello') - >>> tmpl = Template('''
        + >>> tmpl = Template('''
        ... ${bar} ...
        ''') >>> print tmpl.generate(ctxt) @@ -412,7 +412,7 @@ class MatchDirective(Directive): """Implementation of the `py:match` template directive. - >>> tmpl = Template('''
        + >>> tmpl = Template('''
        ... ... Hello ${select('@name')} ... @@ -449,7 +449,7 @@ value of the `py:replace` attribute: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''
        + >>> tmpl = Template('''
        ... Hello ...
        ''') >>> print tmpl.generate(ctxt) @@ -461,7 +461,7 @@ providing a less verbose way to achieve the same effect: >>> ctxt = Context(bar='Bye') - >>> tmpl = Template('''
        + >>> tmpl = Template('''
        ... Hello ...
        ''') >>> 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('''
        + >>> tmpl = Template('''
        ...
        foo
        ...
        ''') >>> 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('''
        + >>> tmpl = Template('''
        ...
        ... ${what} ...
        @@ -535,7 +535,7 @@ `py:otherwise` will be used. >>> ctxt = Context() - >>> tmpl = Template('''
        >> tmpl = Template('''
        ... 0 ... 1 @@ -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('''
        >> tmpl = Template('''
        ... 1 ... 2 @@ -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" diff --git a/markup/tests/template.py b/markup/tests/template.py --- 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(""" + tmpl = Template(""" """) 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(""" + tmpl = Template(""" """) self.assertEqual(""" @@ -52,7 +52,7 @@ Verify that an attribute value that evaluates to `None` removes an existing attribute of that name. """ - tmpl = Template(""" + tmpl = Template(""" """) self.assertEqual(""" @@ -69,7 +69,7 @@ Verify that, if multiple `py:when` bodies match, only the first is output. """ - tmpl = Template("""
        + tmpl = Template("""
        1 2 3 @@ -79,7 +79,7 @@
        """, str(tmpl.generate())) def test_otherwise(self): - tmpl = Template("""
        + tmpl = Template("""
        hidden hello
        """) @@ -91,7 +91,7 @@ """ Verify that `py:choose` blocks can be nested: """ - tmpl = Template(""" + tmpl = Template("""
        2 @@ -112,7 +112,7 @@ Verify that a when directive with a strip directive actually strips of the outer element. """ - tmpl = Template(""" + tmpl = Template("""
        foo
        @@ -130,7 +130,7 @@ Verify that a named template function with a strip directive actually strips of the outer element. """ - tmpl = Template(""" + tmpl = Template("""
        ${what}
        @@ -149,7 +149,7 @@ Verify that the combining the `py:for` directive with `py:strip` works correctly. """ - tmpl = Template(""" + tmpl = Template("""
        ${item}
        @@ -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(""" + tmpl = Template("""
        ${select('*/text()')}
        @@ -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(""" + tmpl = Template("""
        ${select('*/text()')}
        @@ -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(""" + tmpl = Template("""
        ${select('*/*')} @@ -234,7 +234,7 @@ themselves output the element they match, avoiding recursion is even more complex, but should work. """ - tmpl = Template(""" + tmpl = Template("""