                 (setq indent (current-column))))
         (goto-char start))
       (while (not (eolp))
+        ;; indent after block begin tags
+        (if (looking-at-p (concat "{%[ \t\n]*"
+                                  zotonic-tpl-begin-keywords-re))
+            (progn
+              (setq indent (+ indent tab-width))
+                                        ; point-max is no good here...
+                                        ; should limit to initial pos
+                                        ; of indentation request
+              (zotonic-tpl-next-tag-boundary (point-max))))
+        ;; indent after opening soup tags
         (if (looking-at-p "<[^/]\\([^/>]*\\|\\(/[^/>]\\)*\\)*>")
             (setq indent (+ indent tab-width)))
         (forward-char))

       "endblock" "extends" "overrules" "inherit" "autoescape"
       "endautoescape" "if" "else" "elif" "elseif" "endif" "not" "or"
       "and" "xor" "comment" "endcomment" "cycle" "firstof"
       "ifchanged" "ifequal" "endifequal" "ifnotequal"
       "endifnotequal" "now" "regroup" "rsc" "spaceless"
       "endspaceless" "ssi" "templatetag" "load" "call" "with" "url"
       "print" "image" "image_url" "media" "_" "with" "endwith" "all"
       "lib" "cache" "endcache" "filter" "endfilter" "javascript"
       "endjavascript" "as"
       )
     'symbols))
  "Zotonic template keywords")

(defconst zotonic-tpl-custom-tags-re
  (eval-when-compile

                 (current-column))
             ;; indent tag soup
             (zotonic-tpl-tag-soup-get-indent-for-line -1))))
      ;; un-indent block end tags
      (if (looking-at-p (concat "[ \t]*{%[ \t\n]*"
                                zotonic-tpl-end-keywords-re))
          (setq indent (- indent tab-width)))
      (indent-line-to indent)
      indent)
    ))
