Skip to content

Commit

Permalink
Added support for Templ
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerek-Yasa committed Jul 24, 2024
1 parent 49be0cb commit 759c85b
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ Tcl/Tk (itk, tcl, tk)
TEAL (teal)
Teamcenter met (met)
Teamcenter mth (mth)
Templ (templ)
TeX (aux, bbx, bib, bst, cbx, dtx, ins, lbx, ltx, mkii, mkiv, mkvi, sty, tex, cls)
Text (text, txt)
Thrift (thrift)
Expand Down
3 changes: 2 additions & 1 deletion Unix/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ https://github.com/michalmuskala
https://github.com/Inventitech
https://github.com/zhangzqs
https://github.com/drkameleon
https://github.com/jackos
https://github.com/jackos
https://github.com/Aerek-Yasa
9 changes: 9 additions & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8949,6 +8949,7 @@ sub set_constants { # {{{1
'tcsh' => 'C Shell' ,
'tk' => 'Tcl/Tk' ,
'teal' => 'TEAL' ,
'templ' => 'Templ' ,
'mkvi' => 'TeX' ,
'mkiv' => 'TeX' ,
'mkii' => 'TeX' ,
Expand Down Expand Up @@ -10641,6 +10642,13 @@ sub set_constants { # {{{1
],
'Teamcenter met' => [ [ 'call_regexp_common' , 'C' ], ],
'Teamcenter mth' => [ [ 'remove_matches' , '^\s*#' ], ],
'Templ' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '["`]', '*/*', '' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
[ 'remove_inline' , '//.*$' ],
],
'TeX' => [
[ 'remove_matches' , '^\s*%' ],
[ 'remove_inline' , '%.*$' ],
Expand Down Expand Up @@ -11444,6 +11452,7 @@ sub set_constants { # {{{1
'Teamcenter def' => 1.00,
'Teamcenter met' => 1.00,
'Teamcenter mth' => 1.00,
'Templ' => 2.50,
'TeX' => 1.50,
'Text' => 0.50,
'Thrift' => 2.50,
Expand Down
5 changes: 5 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,11 @@ my @Tests = (
'ref' => '../tests/outputs/htlc.teal.yaml',
'args' => '../tests/inputs/htlc.teal',
},
{
'name' => 'Templ',
'ref' => '../tests/outputs/templ_example.templ.yaml',
'args' => '../tests/inputs/templ_example.templ'
},
{
'name' => 'TeX',
'ref' => '../tests/outputs/LaTeX.tex.yaml',
Expand Down
9 changes: 9 additions & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8964,6 +8964,7 @@ sub set_constants { # {{{1
'tcsh' => 'C Shell' ,
'tk' => 'Tcl/Tk' ,
'teal' => 'TEAL' ,
'templ' => 'Templ' ,
'mkvi' => 'TeX' ,
'mkiv' => 'TeX' ,
'mkii' => 'TeX' ,
Expand Down Expand Up @@ -10656,6 +10657,13 @@ sub set_constants { # {{{1
],
'Teamcenter met' => [ [ 'call_regexp_common' , 'C' ], ],
'Teamcenter mth' => [ [ 'remove_matches' , '^\s*#' ], ],
'Templ' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '["`]', '*/*', '' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
[ 'remove_inline' , '//.*$' ],
],
'TeX' => [
[ 'remove_matches' , '^\s*%' ],
[ 'remove_inline' , '%.*$' ],
Expand Down Expand Up @@ -11459,6 +11467,7 @@ sub set_constants { # {{{1
'Teamcenter def' => 1.00,
'Teamcenter met' => 1.00,
'Teamcenter mth' => 1.00,
'Templ' => 2.50,
'TeX' => 1.50,
'Text' => 0.50,
'Thrift' => 2.50,
Expand Down
25 changes: 25 additions & 0 deletions tests/inputs/templ_example.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package test

import "time"

// Line comment

/*
multi
line
comment
*/

templ templ_function() {
<div>A div</div>
// <div>A commented div</div>
/* <div>A multiline commented div </div> */
}

func golang_function() {
a := 5
// a = 6
/*
a = 7
*/
}
20 changes: 20 additions & 0 deletions tests/outputs/templ_example.templ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 2.01
elapsed_seconds : 0.0374619960784912
n_files : 1
n_lines : 25
files_per_second : 26.6937190934722
lines_per_second : 667.342977336804
'Templ' :
nFiles: 1
blank: 5
comment: 12
code: 8
SUM:
blank: 5
comment: 12
code: 8
nFiles: 1

0 comments on commit 759c85b

Please sign in to comment.