Function: jinja2-close-tag

jinja2-close-tag is an interactive and natively compiled function defined in jinja2-mode.el.

Signature

(jinja2-close-tag)

Documentation

Close the previously opened template tag.

Key Bindings

jinja2-mode-map C-c c

Source Code

;; Defined in /nix/store/w823rz5zs434n18ps4jcyc02giqk4dgd-emacs-packages-deps/share/emacs/site-lisp/elpa/jinja2-mode-20220117.807/jinja2-mode.el
(defun jinja2-close-tag ()
  "Close the previously opened template tag."
  (interactive)
  (let ((open-tag (save-excursion (jinja2-find-open-tag))))
    (if open-tag
        (insert
         (if (string= (car open-tag) "block")
             (format "{%% end%s%s %%}"
                     (car open-tag)(nth 1 open-tag))
           (format "{%% end%s %%}"
                   (match-string 2))))
      (error "Nothing to close")))
  (save-excursion (jinja2-indent-line)))