added loopcontrols extension and added unittests for it

--HG--
branch : trunk
diff --git a/jinja2/compiler.py b/jinja2/compiler.py
index 9bf0044..3b5f8c0 100644
--- a/jinja2/compiler.py
+++ b/jinja2/compiler.py
@@ -1018,8 +1018,8 @@
         self.macro_def(node, macro_frame)
 
     def visit_CallBlock(self, node, frame):
-        call_frame = self.macro_body(node, frame, node.iter_child_nodes
-                                     (exclude=('call',)))
+        children = node.iter_child_nodes(exclude=('call',))
+        call_frame = self.macro_body(node, frame, children)
         self.writeline('caller = ')
         self.macro_def(node, call_frame)
         self.start_write(frame, node)
@@ -1305,14 +1305,12 @@
 
         # if the filter node is None we are inside a filter block
         # and want to write to the current buffer
-        if node.node is None:
-            if self.environment.autoescape:
-                tmpl = 'Markup(concat(%s))'
-            else:
-                tmpl = 'concat(%s)'
-            self.write(tmpl % frame.buffer)
-        else:
+        if node.node is not None:
             self.visit(node.node, frame)
+        elif self.environment.autoescape:
+            self.write('Markup(concat(%s))' % frame.buffer)
+        else:
+            self.write('concat(%s)' % frame.buffer)
         self.signature(node, frame)
         self.write(')')
 
diff --git a/jinja2/ext.py b/jinja2/ext.py
index a489f97..63e8f5b 100644
--- a/jinja2/ext.py
+++ b/jinja2/ext.py
@@ -283,6 +283,17 @@
         return node
 
 
+class LoopControlExtension(Extension):
+    """Adds break and continue to the template engine."""
+    tags = set(['break', 'continue'])
+
+    def parse(self, parser):
+        token = parser.stream.next()
+        if token.value == 'break':
+            return nodes.Break(lineno=token.lineno)
+        return nodes.Continue(lineno=token.lineno)
+
+
 def extract_from_ast(node, gettext_functions=GETTEXT_FUNCTIONS):
     """Extract localizable strings from the given template node.
 
@@ -367,3 +378,4 @@
 #: nicer import names
 i18n = InternationalizationExtension
 do = ExprStmtExtension
+loopcontrols = LoopControlExtension
diff --git a/jinja2/nodes.py b/jinja2/nodes.py
index 27c9ddb..ad39903 100644
--- a/jinja2/nodes.py
+++ b/jinja2/nodes.py
@@ -118,8 +118,10 @@
 
     def iter_fields(self, exclude=None, only=None):
         """This method iterates over all fields that are defined and yields
-        ``(key, value)`` tuples.  Optionally a parameter of ignored fields
-        can be provided.
+        ``(key, value)`` tuples.  Per default all fields are returned, but
+        it's possible to limit that to some fields by providing the `only`
+        parameter or to exclude some using the `exclude` parameter.  Both
+        should be sets or tuples of field names.
         """
         for name in self.fields:
             if (exclude is only is None) or \