mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-19 21:10:15 +02:00
Added lexer for Vue. (#248)
This commit is contained in:
parent
9618112850
commit
53b060ccbe
@ -7,7 +7,7 @@ that its output matches `<name>.exported`.
|
|||||||
|
|
||||||
Run the tests as normal:
|
Run the tests as normal:
|
||||||
```go
|
```go
|
||||||
go run ./lexers
|
go test ./lexers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Updating the existing tests
|
## Updating the existing tests
|
||||||
|
15
lexers/testdata/vue.actual
vendored
Normal file
15
lexers/testdata/vue.actual
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<button class="button">This is MyButton</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "MyButton"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.button{
|
||||||
|
font-size:18px;
|
||||||
|
}
|
||||||
|
</style>
|
68
lexers/testdata/vue.expected
vendored
Normal file
68
lexers/testdata/vue.expected
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
[
|
||||||
|
{"type":"Punctuation","value":"\u003c"},
|
||||||
|
{"type":"NameTag","value":"template"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"Punctuation","value":"\u003c"},
|
||||||
|
{"type":"NameTag","value":"button"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"NameAttribute","value":"class"},
|
||||||
|
{"type":"Operator","value":"="},
|
||||||
|
{"type":"LiteralString","value":"\"button\""},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"NameOther","value":"This"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"NameOther","value":"is"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"NameOther","value":"MyButton"},
|
||||||
|
{"type":"Punctuation","value":"\u003c/"},
|
||||||
|
{"type":"NameTag","value":"button"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n"},
|
||||||
|
{"type":"Punctuation","value":"\u003c/"},
|
||||||
|
{"type":"NameTag","value":"template"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n\n"},
|
||||||
|
{"type":"Punctuation","value":"\u003c"},
|
||||||
|
{"type":"NameTag","value":"script"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"KeywordReserved","value":"export"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"Keyword","value":"default"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"Punctuation","value":"{"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"NameOther","value":"name"},
|
||||||
|
{"type":"Operator","value":":"},
|
||||||
|
{"type":"Text","value":" "},
|
||||||
|
{"type":"LiteralStringDouble","value":"\"MyButton\""},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"Punctuation","value":"}"},
|
||||||
|
{"type":"Text","value":"\n"},
|
||||||
|
{"type":"Punctuation","value":"\u003c/"},
|
||||||
|
{"type":"NameTag","value":"script"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n\n"},
|
||||||
|
{"type":"Punctuation","value":"\u003c"},
|
||||||
|
{"type":"NameTag","value":"style"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"Punctuation","value":"."},
|
||||||
|
{"type":"NameOther","value":"button"},
|
||||||
|
{"type":"Punctuation","value":"{"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"NameOther","value":"font"},
|
||||||
|
{"type":"Operator","value":"-"},
|
||||||
|
{"type":"NameOther","value":"size"},
|
||||||
|
{"type":"Operator","value":":"},
|
||||||
|
{"type":"LiteralNumberInteger","value":"18"},
|
||||||
|
{"type":"NameOther","value":"px"},
|
||||||
|
{"type":"Punctuation","value":";"},
|
||||||
|
{"type":"Text","value":"\n "},
|
||||||
|
{"type":"Punctuation","value":"}"},
|
||||||
|
{"type":"Text","value":"\n"},
|
||||||
|
{"type":"Punctuation","value":"\u003c/"},
|
||||||
|
{"type":"NameTag","value":"style"},
|
||||||
|
{"type":"Punctuation","value":"\u003e"}
|
||||||
|
]
|
107
lexers/v/vue.go
Normal file
107
lexers/v/vue.go
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user