From 49dcf5c4072190d8cb88e9e0f0ef529a533502b9 Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Sat, 6 Jul 2024 15:09:44 +0300 Subject: [PATCH 1/5] Add support for templ --- languages.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/languages.json b/languages.json index ac548b971..f59d17111 100644 --- a/languages.json +++ b/languages.json @@ -1526,6 +1526,12 @@ "quotes": [["\\\"", "\\\""], ["'", "'"]], "extensions": ["tera"] }, + "Templ": { + "name": "Templ", + "line_comment": ["//"], + "multi_line_comments": [[""], ["/*", "*/"]], + "extensions": ["templ", "tmpl", "tpl"] + }, "Tex": { "name": "TeX", "line_comment": ["%"], From e505ad2e93417ef42af0ef95ab8767540d8a2307 Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Sat, 6 Jul 2024 15:13:24 +0300 Subject: [PATCH 2/5] Remove file extension `tpl` (conflict with Pan) --- languages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.json b/languages.json index f59d17111..1510d0a09 100644 --- a/languages.json +++ b/languages.json @@ -1530,7 +1530,7 @@ "name": "Templ", "line_comment": ["//"], "multi_line_comments": [[""], ["/*", "*/"]], - "extensions": ["templ", "tmpl", "tpl"] + "extensions": ["templ", "tmpl"] }, "Tex": { "name": "TeX", From 49704291c424ed7cadc9628487e6463545b18503 Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Sat, 6 Jul 2024 15:17:16 +0300 Subject: [PATCH 3/5] Add quotes and important_syntax --- languages.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/languages.json b/languages.json index 1510d0a09..8376752b7 100644 --- a/languages.json +++ b/languages.json @@ -1530,6 +1530,8 @@ "name": "Templ", "line_comment": ["//"], "multi_line_comments": [[""], ["/*", "*/"]], + "quotes": [["\\\"", "\\\""], ["'", "'"], ["`", "`"]], + "important_syntax": ["templ", "script", "css"], "extensions": ["templ", "tmpl"] }, "Tex": { From c037a524f2374209895015cc359eca1f493084aa Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Sat, 6 Jul 2024 15:19:01 +0300 Subject: [PATCH 4/5] Update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 83889caeb..cd17a4e55 100644 --- a/README.md +++ b/README.md @@ -518,6 +518,7 @@ Swift Swig SystemVerilog Tcl +Templ Tex Text Thrift From a4c581a726833276aa11fd0f21e4aa31b5570690 Mon Sep 17 00:00:00 2001 From: Baraa Al-Masri Date: Sat, 6 Jul 2024 15:26:40 +0300 Subject: [PATCH 5/5] Add test for templ --- tests/data/templ.templ | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/data/templ.templ diff --git a/tests/data/templ.templ b/tests/data/templ.templ new file mode 100644 index 000000000..326d22670 --- /dev/null +++ b/tests/data/templ.templ @@ -0,0 +1,24 @@ +// 24 lines, 13 code, 8 comments, 3 blanks +package test + +templ Foo() { +
+ + +
+} + +/* + some css class. +*/ +css button() { + padding: 7px; + border-radius: 5px; +} + +// doSomething does something +script doSomething() { + alert("something") +}