Add templ support (#1122)

* Add support for templ

* Remove file extension `tpl` (conflict with Pan)

* Add quotes and important_syntax

* Update readme

* Add test for templ
This commit is contained in:
Baraa Al-Masri 2024-09-30 12:24:00 +03:00 committed by GitHub
parent 167af762d1
commit c2699d06c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 0 deletions

View File

@ -539,6 +539,7 @@ SystemVerilog
Slint Slint
Tact Tact
Tcl Tcl
Templ
Tex Tex
Text Text
Thrift Thrift

View File

@ -1699,6 +1699,14 @@
"quotes": [["\\\"", "\\\""], ["'", "'"]], "quotes": [["\\\"", "\\\""], ["'", "'"]],
"extensions": ["tera"] "extensions": ["tera"]
}, },
"Templ": {
"name": "Templ",
"line_comment": ["//"],
"multi_line_comments": [["<!--", "-->"], ["/*", "*/"]],
"quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]],
"important_syntax": ["templ", "script", "css"],
"extensions": ["templ", "tmpl"]
},
"Tex": { "Tex": {
"name": "TeX", "name": "TeX",
"line_comment": ["%"], "line_comment": ["%"],

24
tests/data/templ.templ Normal file
View File

@ -0,0 +1,24 @@
// 24 lines, 13 code, 8 comments, 3 blanks
package test
templ Foo() {
<div id="bar">
<!--
HTML comments are also allowed.
-->
<button class={ button() } onClick={ doSomething() }>Baz</button>
</div>
}
/*
some css class.
*/
css button() {
padding: 7px;
border-radius: 5px;
}
// doSomething does something
script doSomething() {
alert("something")
}