branch: elpa/web-mode commit 8a2d8693c007ec0e1880e7503cd51db672f5338a Author: fxbois <fxb...@gmail.com> Commit: fxbois <fxb...@gmail.com>
nunjucks set control block #1226 --- issues/1212.psp | 9 +++++++++ issues/1226.djhtml | 5 +++++ web-mode.el | 7 ++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/issues/1212.psp b/issues/1212.psp new file mode 100644 index 0000000000..f340285107 --- /dev/null +++ b/issues/1212.psp @@ -0,0 +1,9 @@ +<div> + <?php + $var = array( + array( 'name' => 'Add', 'url' => '/add/', 'rules' => array() ), + array( 'name' => 'List', 'url' => '/list/', 'rules' => array() ), + array( 'name' => 'Sections', 'url' => '/section/', 'rules' => array() ), + ); + ?> +</div> diff --git a/issues/1226.djhtml b/issues/1226.djhtml new file mode 100644 index 0000000000..c51eed10a6 --- /dev/null +++ b/issues/1226.djhtml @@ -0,0 +1,5 @@ +<div> + {% set foo %} + bar + {% endset %} +</div> diff --git a/web-mode.el b/web-mode.el index f4df1fcdbb..a1b89e3a4c 100644 --- a/web-mode.el +++ b/web-mode.el @@ -1771,7 +1771,7 @@ shouldn't be moved back.)") "endif" "endifchanged" "endifequal" "endifnotequal" "endmacro" "endrandom" "endraw" - "endsafe" "endsandbox" "endspaceless" + "endsafe" "endsandbox" "endspaceless" "endtablerow" "endunless" "endverbatim" @@ -2077,6 +2077,9 @@ shouldn't be moved back.)") (defvar web-mode-django-code-font-lock-keywords (list + '("{%[ ]*\\(set\\)[ ]+\\([[:alpha:]]+\\)[ ]*%}" + (1 'web-mode-block-control-face) + (2 'web-mode-variable-name-face)) (cons (concat "\\({%\\|#\\)[ ]*\\(" web-mode-django-control-blocks-regexp "\\)[ %]") '(2 'web-mode-block-control-face)) '("\\({%\\|#\\)[ ]*\\(end[[:alpha:]]+\\)\\_>" 2 'web-mode-block-control-face) ;#504 (cons (concat "\\_<\\(" web-mode-django-keywords "\\)\\_>") '(1 'web-mode-keyword-face)) @@ -4772,6 +4775,8 @@ Also return non-nil if it is the command `self-insert-command' is remapped to." (setq controls (append controls (list (cons 'inside "for"))))) ((web-mode-block-starts-with "end\\([[:alpha:]]+\\)" reg-beg) (setq controls (append controls (list (cons 'close (match-string-no-properties 1)))))) + ((web-mode-block-starts-with "set [[:alpha:]]+[ ]*%}" reg-beg) + (setq controls (append controls (list (cons 'open "set"))))) ((web-mode-block-starts-with (concat web-mode-django-control-blocks-regexp "[ %]") reg-beg) (let (control) (setq control (match-string-no-properties 1))