   "Calculate the indentation to use for the line following the line
  offset lines from the current line."
   (save-excursion
-    (forward-line offset)
-    (skip-chars-forward " \t")
+    (while (progn
+             (forward-line offset)
+             (skip-chars-forward " \t")
+             (eolp)))
     (let ((indent (current-column)))
       (skip-chars-forward "]}")
       (while (not (eolp))


(provide 'zotonic-tpl-mode)

;;; zotonic-tpl-mode.el ends here

  (save-excursion
    (beginning-of-line)
    (if (looking-at-p "[ \t]*[%}]}")
        ;; indent closing tag
        (indent-line-to (save-excursion
                          (zotonic-tpl-prev-tag-boundary (point-min))
                          (current-column)))
      ;; indent line inside tag
      (indent-line-to (zotonic-tpl-get-indent-for-line -1))
      )))

