diff options
author | Dave Mayo <dave_mayo@harvard.edu> | 2016-09-06 01:27:25 -0400 |
---|---|---|
committer | Dave Mayo <dave_mayo@harvard.edu> | 2016-09-06 01:27:25 -0400 |
commit | 039526bd8e41ced107892cf13c89ca7b43749260 (patch) | |
tree | 0d8089fa5ef36d6bada8f4928d9f6d7cd1663293 | |
parent | ae7d5a2588ea5f8a48eda1c9d190ff06073e555b (diff) | |
download | emmet-mode-039526bd8e41ced107892cf13c89ca7b43749260.tar.lz emmet-mode-039526bd8e41ced107892cf13c89ca7b43749260.tar.xz emmet-mode-039526bd8e41ced107892cf13c89ca7b43749260.zip |
Fix regression in regular multiplier handling
Previous commit borked regular multplied markup, this one doesn't.
Also, tests were there!
-rw-r--r-- | emmet-mode.el | 7 | ||||
-rw-r--r-- | src/mode-def.el | 7 | ||||
-rw-r--r-- | src/test.el | 5 |
3 files changed, 13 insertions, 6 deletions
diff --git a/emmet-mode.el b/emmet-mode.el index 92542f4..5f0a204 100644 --- a/emmet-mode.el +++ b/emmet-mode.el @@ -632,11 +632,12 @@ accept it or skip it." (to-wrap (if multi (split-string txt "\n") (list txt))) - (initial-elements (replace-regexp-in-string "\\(.*>\\)?[^>*]+\\*?$" "\\1" wrap-with t)) - (terminal-element (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\*?$" "\\2" wrap-with t)) + (initial-elements (replace-regexp-in-string "\\(.*\\(\\+\\|>\\)\\)?[^>*]+\\*?[[:digit:]]*$" "\\1" wrap-with t)) + (terminal-element (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\(\\*[[:digit:]]+$\\)?\\*?$" "\\2" wrap-with t)) + (multiplier-expr (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\(\\*[[:digit:]]+$\\)?\\*?$" "\\3" wrap-with t)) (expr (concat initial-elements - (mapconcat (lambda (el) (concat terminal-element "{!!!" (secure-hash 'sha1 el) "!!!}")) + (mapconcat (lambda (el) (concat terminal-element "{!!!" (secure-hash 'sha1 el) "!!!}" multiplier-expr)) to-wrap "+"))) (markup diff --git a/src/mode-def.el b/src/mode-def.el index 0f3a522..c0e3e2c 100644 --- a/src/mode-def.el +++ b/src/mode-def.el @@ -479,11 +479,12 @@ accept it or skip it." (to-wrap (if multi (split-string txt "\n") (list txt))) - (initial-elements (replace-regexp-in-string "\\(.*>\\)?[^>*]+\\*?$" "\\1" wrap-with t)) - (terminal-element (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\*?$" "\\2" wrap-with t)) + (initial-elements (replace-regexp-in-string "\\(.*\\(\\+\\|>\\)\\)?[^>*]+\\*?[[:digit:]]*$" "\\1" wrap-with t)) + (terminal-element (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\(\\*[[:digit:]]+$\\)?\\*?$" "\\2" wrap-with t)) + (multiplier-expr (replace-regexp-in-string "\\(.*>\\)?\\([^>*]+\\)\\(\\*[[:digit:]]+$\\)?\\*?$" "\\3" wrap-with t)) (expr (concat initial-elements - (mapconcat (lambda (el) (concat terminal-element "{!!!" (secure-hash 'sha1 el) "!!!}")) + (mapconcat (lambda (el) (concat terminal-element "{!!!" (secure-hash 'sha1 el) "!!!}" multiplier-expr)) to-wrap "+"))) (markup diff --git a/src/test.el b/src/test.el index 05f7a24..913daca 100644 --- a/src/test.el +++ b/src/test.el @@ -655,6 +655,11 @@ #'emmet-wrap-with-markup-test '((("div>ul>li" "I am some\nmultiline\n text") . "<div>\n <ul>\n <li>I am some\n multiline\n text</li>\n </ul>\n</div>"))) +(emmet-run-test-case "Wrap with per-line markup (trailing *)" + #'emmet-wrap-with-markup-test + '((("div>ul>li*" "I am some\nmultiline\n text") . + "<div>\n <ul>\n <li>I am some</li>\n <li>multiline</li>\n <li> text</li>\n </ul>\n</div>"))) + ;; Regression test for #54 (broken emmet-find-left-bound behavior ;; after tag with attributes) (defun emmet-regression-54-test (lis) |