branch: elpa/jade-mode
commit a61ad07db668f9ad23dedae17051b78fe8a43c95
Merge: 8f2959ef79 473d29b5c2
Author: Travis Jefferson <[email protected]>
Commit: Travis Jefferson <[email protected]>
Merge pull request #42 from tjefferson08/doctype_fontification
Doctype fontification
---
example.jade | 4 ++--
example.json | 3 +++
jade-mode.el | 6 ++++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/example.jade b/example.jade
index dc8efa47a6..a19782edd7 100644
--- a/example.jade
+++ b/example.jade
@@ -1,4 +1,4 @@
-!!!
+doctype html
html(lang="en", class = ['classOne', 'classTwo'].join(','))
-// consult http://jade-lang.com for a full language reference
head
@@ -31,7 +31,7 @@ html(lang="en", class = ['classOne', 'classTwo'].join(','))
div.examples#javascript
- var a = 1;
- var helperFunction = function (a) { return (a === 1 ? 'singular' :
'plural'); };
- span= locals.someArray.join(', ')
+ span= someArray.join(', ')
span= a.toString() + helperFunction(a)
span#id.class(style = 'margin-bottom: 0;')=
"some_js_expression".split('_').join(' ')
#footer
diff --git a/example.json b/example.json
new file mode 100644
index 0000000000..46ddd7c7b7
--- /dev/null
+++ b/example.json
@@ -0,0 +1,3 @@
+{
+ "someArray": [ 1, "2", "three" ]
+}
diff --git a/jade-mode.el b/jade-mode.el
index 2874cd94e5..d9d78b8d82 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -81,7 +81,6 @@
(defvar jade-font-lock-keywords
`(
- ("!!!\\|doctype\\( ?[A-Za-z0-9\-\_]*\\)?" 0 font-lock-comment-face) ;;
doctype
(,jade-keywords . font-lock-keyword-face) ;; keywords
("#\\(\\w\\|_\\|-\\)*" . font-lock-variable-name-face) ;; id
("\\(?:^[ {2,}]*\\(?:[a-z0-9_:\\-]*\\)\\)?\\(#[A-Za-z0-9\-\_]*[^ ]\\)" 1
font-lock-variable-name-face) ;; id
@@ -117,7 +116,10 @@
;; highlighting under the guise of matching text for more standard
;; font-lock face application (like we do with regexps above)
(jade-highlight-js-in-parens 1 font-lock-preprocessor-face)
- (jade-highlight-js-after-tag 1 font-lock-preprocessor-face)))
+ (jade-highlight-js-after-tag 1 font-lock-preprocessor-face)
+
+ ;; doctype re-overrides some of the fontification rules
+ ("!!!\\|doctype[ ]?.*" 0 font-lock-comment-face t)))
(defun jade-highlight-js-in-parens (limit)
"Search for a tag declaration (up to LIMIT) which contains a paren