Skip to content

Commit

Permalink
Merge pull request #5 from seggewiss/1.0.3
Browse files Browse the repository at this point in the history
1.0.3
  • Loading branch information
seggewiss authored Sep 27, 2023
2 parents bcf3b97 + 9f492eb commit f61c131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/processors/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type eventProcessor struct{}

func (p *eventProcessor) Process(options *ProcessorOptions) string {
// https://regex101.com/r/VkXBIA/1
eventRegex := regexp.MustCompile(`(<` + options.ComponentName + `\n( *)[a-zA-Z0-9.\-+*#:_$(')@!=>"{%}\[\]? \n|/` + "`" + `&]*)@` + options.EventName + `="(.*)"`)
eventRegex := regexp.MustCompile(`(<` + options.ComponentName + `\n( *)[a-zA-Z0-9.\-+*#:,_$(')@!=>"{%}\[\]? \n|/` + "`" + `&]*)@` + options.EventName + `="(.*)"`)
eventFixed := eventRegex.ReplaceAllString(options.Text, "${1}{% if VUE3 %}\n${2}@update:"+options.ModelName+"=\"${3}\"\n${2}{% else %}\n${2}@"+options.EventName+"=\"${3}\"\n${2}{% endif %}")

return eventFixed
Expand Down
2 changes: 1 addition & 1 deletion internal/processors/v-model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func NewModelProcessor() Processor {

func (p *vModelProcessor) Process(options *ProcessorOptions) string {
// https://regex101.com/r/Q3VTcx/1
modelRegex := regexp.MustCompile(`(<` + options.ComponentName + `\n( *)[a-zA-Z0-9.\-+*#:_$(')@!=>"{%}\[\]? \n|/` + "`" + `&]*)v-model="(.*)"`)
modelRegex := regexp.MustCompile(`(<` + options.ComponentName + `\n( *)[a-zA-Z0-9.\-+*#:,_$(')@!=>"{%}\[\]? \n|/` + "`" + `&]*)v-model="(.*)"`)
modelFixed := modelRegex.ReplaceAllString(options.Text, "${1}{% if VUE3 %}\n${2}v-model:"+options.ModelName+"=\"$3\"\n$2{% else %}\n${2}v-model=\"${3}\"\n${2}{% endif %}")

return modelFixed
Expand Down

0 comments on commit f61c131

Please sign in to comment.