Skip to content

Commit 5e1e524

Browse files
authored
fix: vue-directives regex bug (#5671)
1 parent 74e95d1 commit 5e1e524

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

demo/kitchen-sink/docs/vue.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,5 @@ html, body
115115
each item in items
116116
li= item
117117
</template>
118+
119+
<template v-slot:item.parentkey.subkey.subkey.subkey.subkey.subkey="{ value }"></template>

src/mode/_test/tokens_vue.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,4 +733,27 @@
733733
["meta.tag.punctuation.tag-close.xml",">"]
734734
],[
735735
"start"
736+
],[
737+
"start",
738+
["meta.tag.punctuation.tag-open.xml","<"],
739+
["meta.tag.tag-name.xml","template"],
740+
["text.tag-whitespace.xml"," "],
741+
["entity.other.attribute-name.xml","v-"],
742+
["entity.other.attribute-name.xml","slot"],
743+
["entity.other.attribute-name.xml",":item"],
744+
["entity.other.attribute-name.xml",".parentkey.subkey.subkey.subkey.subkey.subkey"],
745+
["punctuation.separator.key-value.xml","="],
746+
["string","\""],
747+
["paren.lparen","{"],
748+
["text"," "],
749+
["identifier","value"],
750+
["text"," "],
751+
["paren.rparen","}"],
752+
["string","\""],
753+
["meta.tag.punctuation.tag-close.xml",">"],
754+
["meta.tag.punctuation.end-tag-open.xml","</"],
755+
["meta.tag.tag-name.xml","template"],
756+
["meta.tag.punctuation.tag-close.xml",">"]
757+
],[
758+
"start"
736759
]]

src/mode/vue_highlight_rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var VueHighlightRules = function (options) {
8484
var self = this;
8585
VueRules.tag_stuff.unshift({//vue-directives
8686
token: "string",
87-
regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?(?:(\.[a-zA-Z\-]+))*(\s*)(=)(\s*)(["'])/,
87+
regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?((?:\.[a-zA-Z\-]+)*)(\s*)(=)(\s*)(["'])/,
8888
onMatch: function (value, currentState, stack) {
8989
var quote = value[value.length - 1];
9090
stack.unshift(quote, currentState);

0 commit comments

Comments
 (0)