branch: elpa/jade-mode
commit 4e7a20db492719062f40b225ed730ed50be5db56
Merge: 03486dce69 351f756569
Author: Travis Jefferson <[email protected]>
Commit: Travis Jefferson <[email protected]>
Merge pull request #38 from tjefferson08/37_highlight_strings_in_parens
[#37] Highlight string lit. manually - Closes #37
---
example.jade | 3 ++-
jade-mode.el | 16 +++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/example.jade b/example.jade
index f7e0482632..ca47edd415 100644
--- a/example.jade
+++ b/example.jade
@@ -19,10 +19,11 @@ html(lang="en")
- else
p Get on it!
form
- input(type: "text", name='user[name]', readonly: true, disabled)
+ input(type = "text", name='user[name]', readonly = true, disabled)
div#single-quote.example
= 'this single quote should highlight as a string'
= 'this one' + "and this should too"
+ 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 ?
div#paren.content.example(style = 'float-left') Content .here #should
be plain if for
diff --git a/jade-mode.el b/jade-mode.el
index 42b9f5957e..1639fc74ff 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -77,15 +77,9 @@
(defvar jade-font-lock-keywords
`(
- ;; higlight string literals on lines beginning with an equals sign
- ;; TODO improve this to play nice with attribute assignments in
- ;; parentheses following tags
- (,(concat "^\\s-*"
- "=")
- (,(concat jade-single-quote-string-re "\\|"
jade-double-quote-string-re)
- nil
- nil
- (0 font-lock-string-face)))
+ ;; highlight string literals everywhere (except where we later
+ ;; remove all font lock faces)
+ (,(concat jade-single-quote-string-re "\\|" jade-double-quote-string-re) .
font-lock-string-face)
(,"!!!\\|doctype\\( ?[A-Za-z0-9\-\_]*\\)?" 0 font-lock-comment-face) ;;
doctype
(,jade-keywords . font-lock-keyword-face) ;; keywords
@@ -298,8 +292,8 @@ Follows indentation behavior of `indent-rigidly'."
(define-key jade-mode-map [backtab] 'jade-unindent)
(define-key jade-mode-map (kbd "RET") 'jade-newline-and-indent)
- ;; highlight syntax
- (setq font-lock-defaults '(jade-font-lock-keywords)))
+ ;; highlight keywords, ignore syntactic font-lock
+ (setq font-lock-defaults '(jade-font-lock-keywords t)))
;;;###autoload