From d33880c230195603aa80484942e268944ebd6e17 Mon Sep 17 00:00:00 2001 From: Gusted Date: Mon, 1 Apr 2024 13:50:26 +0200 Subject: [PATCH] Vue: Handle more edge cases - The parsing of `v-` directives expected that this always ended in `">`, however it is possible that there are other attributes after an `v-` directive also it made the assumption that there couldn't be any spaces in the value of the directive. Therefore it could result in incorrect lexing where almost the whole file could be marked as an LiteralString. - Handle `-` in HTML element names. - Explicitely mark `=` as an operator token. - Tests added. - Ref: https://codeberg.org/forgejo/forgejo/issues/2945 --- lexers/embedded/vue.xml | 10 ++++++---- lexers/testdata/vue.actual | 6 ++++++ lexers/testdata/vue.expected | 28 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/lexers/embedded/vue.xml b/lexers/embedded/vue.xml index 751802075..ec3508359 100644 --- a/lexers/embedded/vue.xml +++ b/lexers/embedded/vue.xml @@ -83,9 +83,10 @@ - + + @@ -104,9 +105,10 @@ - + + @@ -258,14 +260,14 @@ - + - + diff --git a/lexers/testdata/vue.actual b/lexers/testdata/vue.actual index 237970d7f..2ca8bdd5c 100644 --- a/lexers/testdata/vue.actual +++ b/lexers/testdata/vue.actual @@ -1,5 +1,11 @@