[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/jade-mode 544be1a87d 079/128: match full tag decl. and un-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/jade-mode 544be1a87d 079/128: match full tag decl. and un-hl subsequent content |
Date: |
Sat, 29 Jan 2022 08:24:48 -0500 (EST) |
branch: elpa/jade-mode
commit 544be1a87d237c19674f748f3ebfa9c3c7c5622a
Author: Travis Jefferson <tjefferson@signpost.com>
Commit: Travis Jefferson <tjefferson@signpost.com>
match full tag decl. and un-hl subsequent content
- we can probably clean up some of the class/id/tag highlighters,
since we're matching those in order to un-highlight now
---
example.jade | 3 ++-
jade-mode.el | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/example.jade b/example.jade
index ba438263e6..95ebbf300d 100644
--- a/example.jade
+++ b/example.jade
@@ -5,7 +5,7 @@ html(lang="en")
body.bp
#container
#header
- h1.page-title= My.awesome. page #is awesome#
+ h1.page-title My.awesome. page #is awesome#
#nav
ul#nav_list something sweet
li
@@ -23,6 +23,7 @@ html(lang="en")
= '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 ?
+ div#paren.content.example(style = 'float-left') Content .here #should
be plain if for
#footer
#copywrite-text= locals
diff --git a/jade-mode.el b/jade-mode.el
index d1ab4ea46d..d6f8e14891 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -40,6 +40,15 @@ For detail, see `comment-dwim'."
"include" "yield" "mixin") 'words))
"Jade keywords.")
+(defvar jade-tag-re "[a-z][a-z0-9]*"
+ "Regexp used to match a basic html tag, e.g. link, a, div")
+
+(defvar jade-id-re "#[a-zA-Z][0-9a-zA-Z_\\-]*"
+ "Regexp used to match an ID literal, e.g. #id, #id-one_23")
+
+(defvar jade-class-re "[.][a-zA-Z][0-9a-zA-Z_\\-]*"
+ "Regexp used to match a class literal, e.g. .class, .class_name-123")
+
(defvar jade-double-quote-string-re "[\"]\\(\\\\.\\|[^\"\n]\\)*[\"]"
"Regexp used to match a double-quoted string literal")
@@ -66,6 +75,25 @@ For detail, see `comment-dwim'."
(,"^[ {2,}]*[a-z0-9_:\\-]*" 0 font-lock-function-name-face) ;; tag name
(,"^\\s-*\\(//.*\\)" 1 font-lock-comment-face t) ;; jade block comments
+ ;; remove highlighting from literal content following tag/class/id
+ ;; e.g. tag Inner text
+ ;; tag#id.class INNER text
+ (,(concat "^\\s-*"
+
+ ;; start with a basic html tag, an ID, or a class
+ "\\(" jade-tag-re "\\|" jade-id-re "\\|" jade-class-re "\\)"
+
+ ;; followed by zero or more of either an ID or a class
+ "\\(" jade-id-re "\\|" jade-class-re "\\)*"
+
+ ;; then an optional set of parens with JS inside
+ ;; TODO highlight JS in a meaningful way
+ "\\(" "(.*)" "\\)?"
+
+ ;; then a space (not an equals sign), and match the rest of the
line
+ ;; and remove any font-lock faces applied
+ "[ ]\\(.+\\)") 4 nil t)
+
;; 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
- [nongnu] elpa/jade-mode e27e785ae7 003/128: added more code samples to example, (continued)
- [nongnu] elpa/jade-mode e27e785ae7 003/128: added more code samples to example, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode e8e2964ef4 008/128: made tab cycle after hitting end, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 5552c5eaed 011/128: updated readme, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 871ec8a9b2 033/128: Change tag name's facename to font-lock-function-name-face., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 18dfef2623 043/128: Merge pull request #9 from jkpl/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode fd8a4f3a09 028/128: Merge pull request #7 from purcell/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c0b9cfc755 034/128: Modify mather for doctype., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode d8324d4820 078/128: Improve comment line/region function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 7f63cc296c 054/128: Merge pull request #14 from jkpl/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 2d8a3013c4 063/128: Create LICENSE.txt, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 544be1a87d 079/128: match full tag decl. and un-hl subsequent content,
ELPA Syncer <=
- [nongnu] elpa/jade-mode ae579601b8 070/128: Merge pull request #30 from tjefferson08/fix_indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode c8532a66f6 037/128: Support comment-dwim for single line comment syntax., ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode a8d77823a7 087/128: Merge pull request #40 from tjefferson08/39_highlight_js, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 1b86926046 061/128: Refined and extended syntax highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/jade-mode 36fbf629a8 049/128: Improved sws-mode indentation, ELPA Syncer, 2022/01/29
- [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