changeset 210:9fd7535883f2 trunk

Fix regression introduced in [258]. More fixes needed?
author cmlenz
date Tue, 29 Aug 2006 17:35:32 +0000
parents fc6b2fb66518
children e5151983df0d
files markup/template.py markup/tests/template.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/markup/template.py
+++ b/markup/template.py
@@ -1034,8 +1034,10 @@
 
                     # Recursively process the output
                     template = _apply_directives(template, ctxt, directives)
-                    for event in self._match(self._eval(template, ctxt),
-                                             ctxt, match_templates[:idx] +
+                    for event in self._match(self._eval(self._flatten(template,
+                                                                      ctxt),
+                                                        ctxt), ctxt,
+                                             match_templates[:idx] +
                                              match_templates[idx + 1:]):
                         yield event
 
--- a/markup/tests/template.py
+++ b/markup/tests/template.py
@@ -579,6 +579,15 @@
           <greeting name="Dude"/>
         </div>""", str(tmpl.generate(tagname='sayhello')))
 
+    def test_content_directive_in_match(self):
+        tmpl = Template("""<html xmlns:py="http://markup.edgewall.org/">
+          <div py:match="foo">I said <q py:content="select('text()')">something</q>.</div>
+          <foo>bar</foo>
+        </html>""")
+        self.assertEqual("""<html>
+          <div>I said <q>bar</q>.</div>
+        </html>""", str(tmpl.generate()))
+
     # FIXME
     #def test_match_after_step(self):
     #    tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/">
Copyright (C) 2012-2017 Edgewall Software