diff --git a/example.jade b/example.jade index c4b5d9e..52239f5 100644 --- a/example.jade +++ b/example.jade @@ -24,6 +24,7 @@ html(lang="en", class = ['classOne', 'classTwo'].join(',')) div#single-quote.example = 'this single quote should highlight as a string' = 'this one' + "and this should too" + != 'unescaped example' span= 'another' + "quote example" span this one shouldn't higlight strings or... .other #things if else | this one shouldn't highlight strings, and the same goes for .keywords #ok ? @@ -35,6 +36,7 @@ html(lang="en", class = ['classOne', 'classTwo'].join(',')) - var helperFunction = function (a) { return (a === 1 ? 'singular' : 'plural'); }; span= someArray.join(', ') span= a.toString() + helperFunction(a) + span!= a.toString() + helperFunction(a) span#id.class(style = 'margin-bottom: 0;')= "some_js_expression".split('_').join(' ') #footer #copywrite-text= locals diff --git a/jade-mode.el b/jade-mode.el index 928f264..d3cb8b0 100644 --- a/jade-mode.el +++ b/jade-mode.el @@ -149,18 +149,24 @@ javascript." ;; before parsing/skipping ahead, check the first char; if it's ;; - (not a comment starter!) or =, then we know it's a JS block - (if (or (looking-at "-[^/]") (looking-at "=")) + (if (or (looking-at "-[^/]") (looking-at "[!]?=")) (jade-fontify-region-as-js (point) (point-at-eol)) ;; no luck with the first char, so parse to the end of the tag ;; (including optional paren block) and check for '=' (jade-goto-end-of-tag) - (if (and (looking-at "=") (not (eolp))) + (if (and (looking-at "[!]?=") (not (eolp))) (jade-fontify-region-as-js (point) (point-at-eol))))) ;; return some empty match data to appease the font-lock gods (looking-at "\\(\\)"))) +(defun reload-jade-mode () + (interactive) + (when (fboundp 'jade-mode) + (unload-feature 'jade-mode)) + (eval-buffer "jade-mode.el")) + (defun jade-goto-end-of-tag () "Skip ahead over whitespace, tag characters (defined in `jade-tag-declaration-char-re'), and paren blocks (using