Skip to content

Commit

Permalink
fix: vue-directives regex bug (#5671)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkslanc authored Nov 13, 2024
1 parent 74e95d1 commit 5e1e524
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions demo/kitchen-sink/docs/vue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ html, body
each item in items
li= item
</template>

<template v-slot:item.parentkey.subkey.subkey.subkey.subkey.subkey="{ value }"></template>
23 changes: 23 additions & 0 deletions src/mode/_test/tokens_vue.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,4 +733,27 @@
["meta.tag.punctuation.tag-close.xml",">"]
],[
"start"
],[
"start",
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.tag-name.xml","template"],
["text.tag-whitespace.xml"," "],
["entity.other.attribute-name.xml","v-"],
["entity.other.attribute-name.xml","slot"],
["entity.other.attribute-name.xml",":item"],
["entity.other.attribute-name.xml",".parentkey.subkey.subkey.subkey.subkey.subkey"],
["punctuation.separator.key-value.xml","="],
["string","\""],
["paren.lparen","{"],
["text"," "],
["identifier","value"],
["text"," "],
["paren.rparen","}"],
["string","\""],
["meta.tag.punctuation.tag-close.xml",">"],

This comment has been minimized.

Copy link
@Amir-rznjd

Amir-rznjd Dec 25, 2024

Yuytui

["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.tag-name.xml","template"],
["meta.tag.punctuation.tag-close.xml",">"]
],[
"start"
]]
2 changes: 1 addition & 1 deletion src/mode/vue_highlight_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var VueHighlightRules = function (options) {
var self = this;
VueRules.tag_stuff.unshift({//vue-directives
token: "string",
regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?(?:(\.[a-zA-Z\-]+))*(\s*)(=)(\s*)(["'])/,
regex: /(?:\b(v-)|(:|@))(\[?[a-zA-Z\-.]+\]?)(?:(\:\[?[a-zA-Z\-]+\]?))?((?:\.[a-zA-Z\-]+)*)(\s*)(=)(\s*)(["'])/,
onMatch: function (value, currentState, stack) {
var quote = value[value.length - 1];
stack.unshift(quote, currentState);
Expand Down

0 comments on commit 5e1e524

Please sign in to comment.