Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add templ support #1122

Merged
merged 6 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ Swig
SystemVerilog
Tact
Tcl
Templ
Tex
Text
Thrift
Expand Down
8 changes: 8 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,14 @@
"quotes": [["\\\"", "\\\""], ["'", "'"]],
"extensions": ["tera"]
},
"Templ": {
"name": "Templ",
"line_comment": ["//"],
"multi_line_comments": [["<!--", "-->"], ["/*", "*/"]],
"quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]],
"important_syntax": ["templ", "script", "css"],
"extensions": ["templ", "tmpl"]
},
"Tex": {
"name": "TeX",
"line_comment": ["%"],
Expand Down
24 changes: 24 additions & 0 deletions tests/data/templ.templ
Original file line number Diff line number Diff line change
@@ -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")
}
Loading