diff options
author | Dave Mayo <dave_mayo@harvard.edu> | 2015-04-10 10:53:00 -0400 |
---|---|---|
committer | Dave Mayo <dave_mayo@harvard.edu> | 2015-04-10 10:53:00 -0400 |
commit | 69e97b001744d4e227384e5f3e8078b17ccf744c (patch) | |
tree | a91a47c945c568f471fbedf6d77497635467284e /emmet-mode.el | |
parent | 9324673829f97baacfd5db156a39c08903910ed5 (diff) | |
download | emmet-mode-69e97b001744d4e227384e5f3e8078b17ccf744c.tar.lz emmet-mode-69e97b001744d4e227384e5f3e8078b17ccf744c.tar.xz emmet-mode-69e97b001744d4e227384e5f3e8078b17ccf744c.zip |
Refs #61 - Escape using backslash inside { text }
This fixes half the problem specified in #61. The doc change
is technically inaccurate - opening brackets don't actually NEED to
be escaped - p{{\}} works as well as p{\{\}}. But they CAN be escaped,
so I used the most regular version.
The part that is NOT fixed is that a | character, escaped or not, will
prevent the expression from being parsed AT ALL.
Diffstat (limited to 'emmet-mode.el')
-rw-r--r-- | emmet-mode.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/emmet-mode.el b/emmet-mode.el index a76c37e..33a7b42 100644 --- a/emmet-mode.el +++ b/emmet-mode.el @@ -172,12 +172,14 @@ and leaving the point in place." "Find the left bound of an emmet expr" (save-excursion (save-match-data (let ((char (char-before)) - (in-style-attr (looking-back "style=[\"'][^\"']*"))) + (in-style-attr (looking-back "style=[\"'][^\"']*")) + (syn-tab (make-syntax-table))) + (modify-syntax-entry ?\\ "\\") (while char (cond ((and in-style-attr (member char '(?\" ?\'))) (setq char nil)) ((member char '(?\} ?\] ?\))) - (with-syntax-table (standard-syntax-table) + (with-syntax-table syn-tab (backward-sexp) (setq char (char-before)))) ((eq char ?\>) (if (looking-back "<[^>]+>" (line-beginning-position)) @@ -3181,9 +3183,12 @@ tbl)) (defun emmet-text (input) "A zen coding expression innertext." - (emmet-parse "{\\(.*?\\)}" 2 "inner text" - (let ((txt (emmet-split-numbering-expressions (elt it 1)))) - `((text ,txt) . ,input)))) + (emmet-parse "{\\(\\(?:\\\\.\\|[^\\\\}]\\)*?\\)}" 2 "inner text" + (let ((txt (emmet-split-numbering-expressions (elt it 1)))) + (if (listp txt) + (setq txt (cons (car txt) (cons (replace-regexp-in-string "\\\\\\(.\\)" "\\1" (cadr txt)) (cddr txt)))) + (setq txt (replace-regexp-in-string "\\\\\\(.\\)" "\\1" txt))) + `((text ,txt) . ,input)))) (defun emmet-properties (input) "A bracketed emmet property expression." @@ -3462,7 +3467,7 @@ tbl)) (if self-closing? "/>" (concat ">" (if tag-txt - (if block-indentation? + (if block-indentation? (emmet-indent tag-txt) tag-txt)) (if content |