# HG changeset patch # User cmlenz # Date 1151881827 0 # Node ID 37557b8fb925df82b8c28857b1656129bcb6cbba # Parent ed370ebfa7944a90ffec2e8fb5ea5214f8541ec8 Moved some of the tests for the strip directive to a new unittest test case to not clutter up the documentation. diff --git a/markup/path.py b/markup/path.py --- a/markup/path.py +++ b/markup/path.py @@ -99,10 +99,10 @@ >>> from markup.input import XML >>> xml = XML('Text') + >>> print Path('child').select(xml) Text - >>> xpath = Path('child') >>> print Path('child/text()').select(xml) Text diff --git a/markup/template.py b/markup/template.py --- a/markup/template.py +++ b/markup/template.py @@ -470,26 +470,7 @@ foo - On the other hand, when the attribute evaluates to `False`, the element is - not stripped: - - >>> tmpl = Template('''
- ...
foo
- ...
''') - >>> print tmpl.generate() -
-
foo
-
- - Leaving the attribute value empty is equivalent to a truth value: - - >>> tmpl = Template('''
- ...
foo
- ...
''') - >>> print tmpl.generate() -
- foo -
+ Leaving the attribute value empty is equivalent to a truth value. This directive is particulary interesting for named template functions or match templates that do not generate a top-level element: diff --git a/markup/tests/template.py b/markup/tests/template.py --- a/markup/tests/template.py +++ b/markup/tests/template.py @@ -28,12 +28,12 @@ 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()')}
Hey Joe -
''') +
""") self.assertEqual("""
Hey Joe
@@ -45,7 +45,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('*/*')} @@ -56,7 +56,7 @@ - ''') + """) self.assertEqual("""
@@ -76,7 +76,7 @@ themselves output the element they match, avoiding recursion is even more complex, but should work. """ - tmpl = Template(''' + tmpl = Template("""