[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode 6707074e67 073/128: Merge pull request #32 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode 6707074e67 073/128: Merge pull request #32 from tjefferson08/20_single_quote_highlighting |
Date: |
Sat, 29 Jan 2022 08:24:48 -0500 (EST) |
branch: elpa/jade-mode
commit 6707074e67bb4ce81734b14d172a6be91c2b7bde
Merge: ae579601b8 ba002b5e03
Author: Brian C <brian.m.carlson@gmail.com>
Commit: Brian C <brian.m.carlson@gmail.com>
Merge pull request #32 from tjefferson08/20_single_quote_highlighting
Issue #20 - single quote highlighting
---
example.jade | 5 +++++
jade-mode.el | 31 ++++++++++++++++++++++++++++---
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/example.jade b/example.jade
index 7ed94916d7..ba438263e6 100644
--- a/example.jade
+++ b/example.jade
@@ -18,6 +18,11 @@ html(lang="en")
p Get on it!
form
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 this one shouldn't higlight strings or... .other #things if else
+ | this one shouldn't highlight strings, and the same goes for
.keywords #ok ?
#footer
#copywrite-text= locals
diff --git a/jade-mode.el b/jade-mode.el
index e4463a2b80..da0d3c193d 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -40,19 +40,44 @@ For detail, see `comment-dwim'."
"include" "yield" "mixin") 'words))
"Jade keywords.")
+(defvar jade-double-quote-string-re "[\"]\\(\\\\.\\|[^\"\n]\\)*[\"]"
+ "Regexp used to match a double-quoted string literal")
+
+(defvar jade-single-quote-string-re "[']\\(\\\\.\\|[^'\n]\\)*[']"
+ "Regexp used to match a single-quoted string literal")
+
(defvar jade-font-lock-keywords
- `((,"!!!\\|doctype\\( ?[A-Za-z0-9\-\_]*\\)?" 0 font-lock-comment-face) ;;
doctype
+ `(
+ ;; 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)))
+
+ (,"!!!\\|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
(,"\\(?:^[ {2,}]*\\(?:[a-z0-9_:\\-]*\\)\\)?\\(\\.[A-Za-z0-9\-\_]*\\)" 1
font-lock-type-face) ;; class name
(,"^[ {2,}]*[a-z0-9_:\\-]*" 0 font-lock-function-name-face) ;; tag name
- (,"^\\s-*//.*" 0 font-lock-comment-face t))) ;; jade block comments
+ (,"^\\s-*\\(//.*\\)" 1 font-lock-comment-face t) ;; jade block comments
+
+ ;; remove highlighting from lines opening with a pipe `|'
+ ;; e.g. | keywords like for should not be highlighted here
+ ;; | I'm not supposed to highlight single quotes either
+ (,(concat "^\\s-*"
+ "\\("
+ "|"
+ ".*"
+ "\\)") 1 nil t)))
;; syntax table
(defvar jade-syntax-table
(let ((syn-table (make-syntax-table)))
- (modify-syntax-entry ?' "\"" syn-table)
syn-table)
"Syntax table for `jade-mode'.")
- [nongnu] elpa/jade-mode 216d1f5148 109/128: use mc's mixin regex to highlight mixin syntax, (continued)
- [nongnu] elpa/jade-mode 216d1f5148 109/128: use mc's mixin regex to highlight mixin syntax, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode efb86f6a36 101/128: Merge pull request #51 from tjefferson08/fix_compile_warnings, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c017b86026 117/128: Fix Grammar error in Flycheck sentence., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 334faaa998 127/128: fix small typo, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode e9cc84aff7 020/128: use mark-active instead of region-active-p, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d259953442 030/128: Change doctype facename to font-lock-comment-face., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c2a826f61b 031/128: Change id facename to font-lock-variable-name-face., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ed4275a1f8 047/128: Merge pull request #10 from telaviv/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 33bad1d74e 065/128: Merge pull request #28 from Sterlingg/DedentFix, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 573f954c7e 025/128: set indent-tabs-mode as nil, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 6707074e67 073/128: Merge pull request #32 from tjefferson08/20_single_quote_highlighting,
ELPA Syncer <=
- [nongnu] elpa/jade-mode 8f2959ef79 093/128: Merge pull request #43 from tjefferson08/fix_comment_again, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ba002b5e03 072/128: [#20] fix basic issue of single-quote highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode ecc1253196 111/128: Merge pull request #56 from MC-Escherichia/fix-regexes, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode cfd25bce3e 125/128: Merge pull request #70 from wasamasa/fix-mode-definition, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 111460b056 126/128: Merge pull request #71 from phikal/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 4079475e60 029/128: Modify comment for font-lock-keywords matcher., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d2c37c960b 060/128: Merge pull request #22 from Niluge-KiWi/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 86f0734689 055/128: add init.el boilerplate for flymake support in the README, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode b33e7017f7 052/128: Defvar instead of setq, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode fd1a442556 059/128: Add missing jade keywords "block append", "block prepend", "append" and "prepend", ELPA Syncer, 2022/01/29