Skip to content

Commit

Permalink
Add templ support (#1122)
Browse files Browse the repository at this point in the history
* Add support for templ

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

* Add quotes and important_syntax

* Update readme

* Add test for templ
  • Loading branch information
mbaraa authored Sep 30, 2024
1 parent 167af76 commit c2699d0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ SystemVerilog
Slint
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 @@ -1699,6 +1699,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")
}

0 comments on commit c2699d0

Please sign in to comment.