Commits

Sławek Ehlert  committed 35a005f

add support for empty django tags

  • Participants
  • Parent commits 8c53884

Comments (0)

Files changed (2)

File shpaml_loader/shpaml.py

     text = "{{ %s }}" % text.strip()
     return enclose_tag(tag, text)
 
+@syntax('%(.*) \|\|')
+def EMPTY_DJANGO_TAG(m):
+    tag = m.groups()[0]
+    return enclose_django_tag(tag, "")
+
 @syntax('(.*?) \|\|')
 def EMPTY_TAG(m):
     tag = m.groups()[0]
 LINE_METHODS = [
         RAW_HTML,
         DJANGO_VAR,
+        EMPTY_DJANGO_TAG,
         DJANGO_TAG,
         TEXT,
         OUTER_CLOSING_TAG,
     start_tag, end_tag = apply_jquery_sugar(tag)
     return start_tag + text + end_tag
 
+def enclose_django_tag(tag, text):
+    start_tag, end_tag = apply_django_sugar(tag)
+    return start_tag + text + end_tag
+
 def find_indentation(line):
     """Returns a pair of basestrings.
 

File test_project/test.suite

 ---
 <meta http-equiv="content-type" content="text/html;charset=utf-8">
 
+=== shpaml
+%baz ||
+---
+{% baz %}{% endbaz %}
+
+=== shpaml
+%block bar ||
+---
+{% block bar %}{% endblock %}
+