[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode ba002b5e03 072/128: [#20] fix basic issue of sin
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode ba002b5e03 072/128: [#20] fix basic issue of single-quote highlighting |
Date: |
Sat, 29 Jan 2022 08:24:48 -0500 (EST) |
branch: elpa/jade-mode
commit ba002b5e03d9d928d4c3709a909ecccd303dd11a
Author: Travis Jefferson <tjefferson@signpost.com>
Commit: Travis Jefferson <tjefferson@signpost.com>
[#20] fix basic issue of single-quote highlighting
1. Unrelated, but fix comments to fontify content only, not any
leading whitespace (some faces will change whitespace width)
2. Highlight single-quote string literals after lines that open
with an equals sign (=). There is room to improve here; we'd
like this behavior in other scenarios, but let's just fix the
issue for now.
3. Remove higlighting from lines which open with a pipe (|)
---
jade-mode.el | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
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 c017b86026 117/128: Fix Grammar error in Flycheck sentence., (continued)
- [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, 2022/01/29
- [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 <=
- [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
- [nongnu] elpa/jade-mode 992ed1e50d 046/128: single quoted strings are now properly highlighted., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 210825fd5e 032/128: Change class facename to font-lock-type-face., ELPA Syncer, 2022/01/29