emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/web-mode de9dfa3ac3: attr issue


From: ELPA Syncer
Subject: [nongnu] elpa/web-mode de9dfa3ac3: attr issue
Date: Sat, 20 Aug 2022 15:59:21 -0400 (EDT)

branch: elpa/web-mode
commit de9dfa3ac3cd54e6acb4f9d9d1343f8d4eabd363
Author: fxbois <fxbois@gmail.com>
Commit: fxbois <fxbois@gmail.com>

    attr issue
    
    #1233
---
 issues/1233.svelte |  7 +++----
 web-mode.el        | 35 +++++++++++++++--------------------
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/issues/1233.svelte b/issues/1233.svelte
index 048df18c35..7eeb4f220b 100644
--- a/issues/1233.svelte
+++ b/issues/1233.svelte
@@ -1,9 +1,8 @@
 <div>
-  <Example
+  <img
+    class="hello"
     a={b}
-      c={d}
-    e={f}
-      g={h}
+    c={d}
     i={j}
   />
 </div>
diff --git a/web-mode.el b/web-mode.el
index 8b4a83a200..3dc0bf2a4b 100644
--- a/web-mode.el
+++ b/web-mode.el
@@ -1045,7 +1045,7 @@ Must be used in conjunction with 
web-mode-enable-block-face."
     ("go"               . "\\.go\\(html\\|tmpl\\)\\'")
     ("handlebars"       . "\\.\\(hb\\.html\\|hbs\\)\\'")
     ("hero"             . "\\.hero\\'")
-    ("jinja"            . "\\.jinja\\'")
+    ("jinja"            . "\\.\\(jinja\\|nwt\\)\\'")
     ("jsp"              . "\\.[gj]sp\\'")
     ("lsp"              . "\\.lsp\\'")
     ("mako"             . "\\.mako?\\'")
@@ -5475,7 +5475,7 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
 
 ;; FLAGS: attr
 ;; (1)custom-attr (2)engine-attr (4)spread-attr[jsx] (8)code-value
-;; SPECS: 
https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#attr-value-unquoted
+;; 
https://www.w3.org/TR/2012/WD-html-markup-20120329/syntax.html#attr-value-unquoted
 
 ;; STATES: attr
 ;; (0)nil (1)space (2)name (3)space-before (4)equal (5)space-after
@@ -5486,15 +5486,16 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
   (let ((tag-flags 0) (attr-flags 0) (continue t) (attrs 0) (counter 0) 
(brace-depth 0)
         (pos-ori (point)) (state 0) (equal-offset 0) (go-back nil)
         (is-jsx (or (string= web-mode-content-type "jsx") (eq 
(get-text-property (point) 'part-type) 'jsx)))
-        attr name-beg name-end val-beg char pos escaped spaced quoted)
+        attr name-beg name-end val-beg char pos escaped spaced quoted mem step)
 
     (while continue
 
       (setq pos (point)
             char (char-after)
+            mem state
             ;;spaced (eq char ?\s)
             spaced (member char '(?\s ?\n))
-            )
+            step nil)
 
       (when quoted (setq quoted (1+ quoted)))
 
@@ -5517,10 +5518,11 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
        ((and (= state 9) (eq char ?\}) (> brace-depth 1))
         (setq brace-depth (1- brace-depth)))
 
-       ((get-text-property pos 'block-side)
-        (when (= state 2)
-          (setq name-end pos))
-        )
+       ;; #1233
+       ;;((get-text-property pos 'block-side)
+       ;; (when (= state 2)
+       ;;   (setq name-end pos))
+       ;; )
 
        ((and (= state 2) is-jsx (eq char ?\}) (eq attr-flags 4))
         (setq name-end pos)
@@ -5537,8 +5539,6 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
             (and (= state 7) (eq ?\' char) (not escaped))
             (and (= state 9) (eq ?\} char) (= brace-depth 1))
             )
-
-        ;;(message "%S %S" (point) attr-flags)
         (setq attrs (+ attrs (web-mode-attr-scan pos state char name-beg 
name-end val-beg attr-flags equal-offset tag-flags)))
         (setq state 0
               attr-flags 0
@@ -5554,8 +5554,8 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
         (setq state (cond ((eq ?\' char) 7)
                           ((eq ?\" char) 8)
                           (t             9)))
-        (when (= state 9)
-          (setq brace-depth 1))
+        (setq step 100)
+        (when (= state 9) (setq brace-depth 1))
         )
 
        ((and (eq ?\= char) (member state '(2 3)))
@@ -5564,7 +5564,6 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
         (setq state 4)
         (setq attr (buffer-substring-no-properties name-beg (1+ name-end)))
         (when (and web-mode-indentless-attributes (member (downcase attr) 
web-mode-indentless-attributes))
-          ;;(message "onclick")
           (setq attr-flags (logior attr-flags 8)))
         )
 
@@ -5685,10 +5684,6 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
              ((member attr '("http-equiv"))
               (setq attr-flags (1- attr-flags))
               )
-             ;;((and web-mode-engine-attr-regexp
-             ;;      (string-match-p web-mode-engine-attr-regexp attr))
-             ;; (setq attr-flags (logior attr-flags 2))
-             ;; )
              ((and (eq char ?\-) (not (string= attr "http-")))
               (setq attr-flags (logior attr-flags 1)))
              ) ;cond
@@ -5707,6 +5702,8 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
       (when (null go-back)
         (forward-char))
 
+      ;;(when (not (= mem state)) (message "pos=%S before=%S after=%S step=%S" 
pos mem state step))
+
       ) ;while
 
     (when (> attrs 0) (setq tag-flags (logior tag-flags 1)))
@@ -5714,13 +5711,11 @@ Also return non-nil if it is the command 
`self-insert-command' is remapped to."
     tag-flags))
 
 (defun web-mode-attr-scan (pos state char name-beg name-end val-beg attr-flags 
equal-offset tag-flags)
-  ;;(message "point(%S) state(%S) c(%c) name-beg(%S) name-end(%S) val-beg(%S) 
attr-flags(%S) equal-offset(%S) tag-flags(%S)"
-  ;;         pos state char name-beg name-end val-beg attr-flags equal-offset 
tag-flags)
+  ;;(message "point(%S) state(%S) c(%c) name-beg(%S) name-end(%S) val-beg(%S) 
attr-flags(%S) equal-offset(%S) tag-flags(%S)" pos state char name-beg name-end 
val-beg attr-flags equal-offset tag-flags)
   (when (null attr-flags) (setq attr-flags 0))
   (when (and name-beg name-end web-mode-engine-attr-regexp)
     (let (name)
       (setq name (buffer-substring-no-properties name-beg (1+ name-end)))
-      ;;(message "%S" name)
       (cond
        ((string-match-p "^data[-]" name)
         (setq attr-flags (logior attr-flags 1))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]