Changed: DB Params

This commit is contained in:
2025-03-20 12:35:13 +01:00
parent 8640a12439
commit b71b3d12ca
822 changed files with 134218 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
-- in --
package test
templ input(value, validation string) {
<div><p>{ "the" }<a href="http://example.com">{ "data" }
</a></p></div>
}
-- out --
package test
templ input(value, validation string) {
<div>
<p>
{ "the" }
<a href="http://example.com">
{ "data" }
</a>
</p>
</div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package test
templ input(value, validation string) {
<div><p>{ "the" }<a href="http://example.com">{ "data" } </a></p></div>
}
-- out --
package test
templ input(value, validation string) {
<div><p>{ "the" }<a href="http://example.com">{ "data" } </a></p></div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package main
templ test() {
<div>Linebreaks<br/>used<br/>for<br/>spacing</div>
}
-- out --
package main
templ test() {
<div>Linebreaks<br/>used<br/>for<br/>spacing</div>
}

View File

@@ -0,0 +1,24 @@
-- in --
package main
templ test() {
<div>
Linebreaks<br/>and<hr/>rules<br/>for<br/>spacing
</div>
}
-- out --
package main
templ test() {
<div>
Linebreaks
<br/>
and
<hr/>
rules
<br/>
for
<br/>
spacing
</div>
}

View File

@@ -0,0 +1,15 @@
-- in --
package test
templ input(value, validation string) {
<div><p>{ "the" }<a href="http://example.com">{ "data" }</a></p>
</div>
}
-- out --
package test
templ input(value, validation string) {
<div>
<p>{ "the" }<a href="http://example.com">{ "data" }</a></p>
</div>
}

View File

@@ -0,0 +1,15 @@
-- in --
package test
templ input(value, validation string) {
<div>
<p>{ "the" }<a href="http://example.com">{ "data" }</a></p></div>
}
-- out --
package test
templ input(value, validation string) {
<div>
<p>{ "the" }<a href="http://example.com">{ "data" }</a></p>
</div>
}

View File

@@ -0,0 +1,24 @@
-- in --
package main
templ test() {
<!-- This is a comment -->
// This is not included in the output.
<div>Some standard templ</div>
/* This is not included in the output too. */
/*
Leave this alone.
*/
}
-- out --
package main
templ test() {
<!-- This is a comment -->
// This is not included in the output.
<div>Some standard templ</div>
/* This is not included in the output too. */
/*
Leave this alone.
*/
}

View File

@@ -0,0 +1,24 @@
-- in --
package test
templ conditionalAttributes(addClass bool) {
<div id="conditional"
if addClass {
class="itWasTrue"
}
>
Content</div>
}
-- out --
package test
templ conditionalAttributes(addClass bool) {
<div
id="conditional"
if addClass {
class="itWasTrue"
}
>
Content
</div>
}

View File

@@ -0,0 +1,21 @@
-- in --
package test
templ conditionalAttributes(addClass bool) {
<div id="conditional" if addClass {
class="itWasTrue"
}
width="300">Content</div>
}
-- out --
package test
templ conditionalAttributes(addClass bool) {
<div
id="conditional"
if addClass {
class="itWasTrue"
}
width="300"
>Content</div>
}

View File

@@ -0,0 +1,22 @@
-- in --
package test
templ conditionalAttributes(addClass bool) {
<div id="conditional"
if addClass {
class="itWasTrue"
}
width="300">Content</div>
}
-- out --
package test
templ conditionalAttributes(addClass bool) {
<div
id="conditional"
if addClass {
class="itWasTrue"
}
width="300"
>Content</div>
}

View File

@@ -0,0 +1,26 @@
-- in --
package test
templ conditionalAttributes(addClass bool) {
<div id="conditional"
if addClass {
class="itWasTrue"
} else {
class="itWasNotTrue"
}
width="300">Content</div>
}
-- out --
package test
templ conditionalAttributes(addClass bool) {
<div
id="conditional"
if addClass {
class="itWasTrue"
} else {
class="itWasNotTrue"
}
width="300"
>Content</div>
}

View File

@@ -0,0 +1,17 @@
-- in --
package test
templ nested() {
<div class="double">double</div>
<div class='single-not-required'>single-not-required</div>
<div data-value='{"data":"value"}'>single-required</div>
}
-- out --
package test
templ nested() {
<div class="double">double</div>
<div class="single-not-required">single-not-required</div>
<div data-value='{"data":"value"}'>single-required</div>
}

View File

@@ -0,0 +1,14 @@
-- in --
package test
css ClassName() {
background-color: #ffffff;
color: { constants.White };
}
-- out --
package test
css ClassName() {
background-color: #ffffff;
color: { constants.White };
}

View File

@@ -0,0 +1,15 @@
-- in --
package test
css ClassName() {
background-color : #ffffff ;
color : { constants.White };
}
-- out --
package test
css ClassName() {
background-color: #ffffff;
color: { constants.White };
}

View File

@@ -0,0 +1,24 @@
-- in --
package p
css Style(
a string,
b string,
c string,
) {
color: {a};
background-color: {b};
border-color: {c};
}
-- out --
package p
css Style(
a string,
b string,
c string,
) {
color: { a };
background-color: { b };
border-color: { c };
}

View File

@@ -0,0 +1,17 @@
-- in --
package test
templ input(value, validation string) {
<div>
<p>
</p>
</div>
}
-- out --
package test
templ input(value, validation string) {
<div>
<p></p>
</div>
}

View File

@@ -0,0 +1,20 @@
-- in --
package test
templ input(items []string) {
<div>{ "the" }<div>{ "other" }</div>for _, item := range items {
<div>{ item }</div>
}</div>
}
-- out --
package test
templ input(items []string) {
<div>
{ "the" }
<div>{ "other" }</div>
for _, item := range items {
<div>{ item }</div>
}
</div>
}

View File

@@ -0,0 +1,13 @@
-- in --
package test
templ nested() {
<div>{ "the" }<div>{ "other" }</div></div>
}
-- out --
package test
templ nested() {
<div>{ "the" }<div>{ "other" }</div></div>
}

View File

@@ -0,0 +1,42 @@
-- in --
package main
type Link struct {
Name string
Url string
}
var a = false;
func test() {
log.Print("hoi")
if (a) {
log.Fatal("OH NO !")
}
}
templ x() {
<div>Hello World</div>
}
-- out --
package main
type Link struct {
Name string
Url string
}
var a = false
func test() {
log.Print("hoi")
if a {
log.Fatal("OH NO !")
}
}
templ x() {
<div>Hello World</div>
}

View File

@@ -0,0 +1,14 @@
-- in --
package main
// test the comment handling.
templ test() {
Test
}
-- out --
package main
// test the comment handling.
templ test() {
Test
}

View File

@@ -0,0 +1,25 @@
-- in --
package test
templ input(items []string) {
<div>{ "the" }<div>{ "other" }</div>if items != nil {
<div>{ items[0] }</div>
} else {
<div>{ items[1] }</div>
}
</div>
}
-- out --
package test
templ input(items []string) {
<div>
{ "the" }
<div>{ "other" }</div>
if items != nil {
<div>{ items[0] }</div>
} else {
<div>{ items[1] }</div>
}
</div>
}

View File

@@ -0,0 +1,20 @@
-- in --
package main
templ test() {
<p>
In a flowing <strong>paragraph</strong>, you can use inline elements.
These <strong>inline elements</strong> can be <strong>styled</strong>
and are not placed on new lines.
</p>
}
-- out --
package main
templ test() {
<p>
In a flowing <strong>paragraph</strong>, you can use inline elements.
These <strong>inline elements</strong> can be <strong>styled</strong>
and are not placed on new lines.
</p>
}

View File

@@ -0,0 +1,40 @@
-- in --
package main
templ x() {
@something(`Hi
some cool text
foo
bar
`)
@something(`
something
`,
`
something
`,
)
}
-- out --
package main
templ x() {
@something(`Hi
some cool text
foo
bar
`)
@something(`
something
`,
`
something
`,
)
}

View File

@@ -0,0 +1,12 @@
-- in --
package test
templ input(value, validation string) {
<div><div><b>Text</b></div></div>
}
-- out --
package test
templ input(value, validation string) {
<div><div><b>Text</b></div></div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package test
templ nameList(items []Item) {
{{ first := items[0] }}
}
-- out --
package test
templ nameList(items []Item) {
{{ first := items[0] }}
}

View File

@@ -0,0 +1,13 @@
-- in --
package test
templ input(value, validation string) {
<script src="https://example.com/myscript.js"></script>
}
-- out --
package test
templ input(value, validation string) {
<script src="https://example.com/myscript.js"></script>
}

View File

@@ -0,0 +1,20 @@
-- in --
package p
script Style(
a string,
b string,
c string,
) {
console.log(a, b, c);
}
-- out --
package p
script Style(
a string,
b string,
c string,
) {
console.log(a, b, c);
}

View File

@@ -0,0 +1,12 @@
-- in --
package main
templ x() {
<div>{firstName} {lastName}</div>
}
-- out --
package main
templ x() {
<div>{ firstName } { lastName }</div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package main
templ x() {
<div>{pt1}{pt2}</div>
}
-- out --
package main
templ x() {
<div>{ pt1 }{ pt2 }</div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package main
templ x() {
<div>{firstName...} {lastName...}</div>
}
-- out --
package main
templ x() {
<div>{ firstName... } { lastName... }</div>
}

View File

@@ -0,0 +1,26 @@
-- in --
package test
templ input(items []string) {
<div>{ "the" }<div>{ "other" }</div>switch items[0] {
case "a":
<div>{ items[0] }</div>
case "b":
<div>{ items[1] }</div>
}</div>
}
-- out --
package test
templ input(items []string) {
<div>
{ "the" }
<div>{ "other" }</div>
switch items[0] {
case "a":
<div>{ items[0] }</div>
case "b":
<div>{ items[1] }</div>
}
</div>
}

View File

@@ -0,0 +1,30 @@
-- in --
package test
templ table(accountNumber string, registration string) {
<table>
<tr>
<th width="20%">Your account number</th>
<td width="80%">{ accountNumber }</td>
</tr>
<tr>
<td>Registration</td>
<td>{ strings.ToUpper(registration) }</td>
</tr>
</table>
}
-- out --
package test
templ table(accountNumber string, registration string) {
<table>
<tr>
<th width="20%">Your account number</th>
<td width="80%">{ accountNumber }</td>
</tr>
<tr>
<td>Registration</td>
<td>{ strings.ToUpper(registration) }</td>
</tr>
</table>
}

View File

@@ -0,0 +1,34 @@
-- in --
package main
templ x(id string, class string) {
<button
id={id}
name={
"name"
}
class={
"blue",
class,
map[string]bool{
"a": true,
},
}
></button>
}
-- out --
package main
templ x(id string, class string) {
<button
id={ id }
name={ "name" }
class={
"blue",
class,
map[string]bool{
"a": true,
},
}
></button>
}

View File

@@ -0,0 +1,26 @@
-- in --
package main
templ x() {
<li>
<a href="/">
Home
@hello("home") {
data
}
</a>
</li>
}
-- out --
package main
templ x() {
<li>
<a href="/">
Home
@hello("home") {
data
}
</a>
</li>
}

View File

@@ -0,0 +1,20 @@
-- in --
package p
templ List(
list1 list[item],
list2 list[item],
list3 list[item],
) {
<div></div>
}
-- out --
package p
templ List(
list1 list[item],
list2 list[item],
list3 list[item],
) {
<div></div>
}

View File

@@ -0,0 +1,13 @@
-- in --
package goof
templ Hello() {
Hello
}
-- out --
package goof
templ Hello() {
Hello
}

View File

@@ -0,0 +1,14 @@
-- in --
// Go comment
package goof
templ Hello() {
Hello
}
-- out --
// Go comment
package goof
templ Hello() {
Hello
}

View File

@@ -0,0 +1,16 @@
-- in --
// Go comment
package goof
templ Hello() {
Hello
}
-- out --
// Go comment
package goof
templ Hello() {
Hello
}

View File

@@ -0,0 +1,20 @@
-- in --
/********************
* multiline message *
********************/
package goof
templ Hello() {
Hello
}
-- out --
/********************
* multiline message *
********************/
package goof
templ Hello() {
Hello
}

View File

@@ -0,0 +1,32 @@
-- in --
// Go comment
/* Multiline comment on a single line */
/*
Multi-line comment on multiple lines
*/
package goof
templ Hello() {
Hello
}
-- out --
// Go comment
/* Multiline comment on a single line */
/*
Multi-line comment on multiple lines
*/
package goof
templ Hello() {
Hello
}

View File

@@ -0,0 +1,10 @@
-- in --
//go:build dev
package p
-- out --
//go:build dev
package p

View File

@@ -0,0 +1,34 @@
-- in --
package p
templ f() {
@Other(
p.Test,
"s",
){
@another.Component(
p.Test,
3,
"s",
){
<p>hello</p>
}
}
}
-- out --
package p
templ f() {
@Other(
p.Test,
"s",
) {
@another.Component(
p.Test,
3,
"s",
) {
<p>hello</p>
}
}
}

View File

@@ -0,0 +1,22 @@
-- in --
package p
templ f() {
@Other(
p.Test,
"s",
){
<p>hello</p>
}
}
-- out --
package p
templ f() {
@Other(
p.Test,
"s",
) {
<p>hello</p>
}
}

View File

@@ -0,0 +1,22 @@
-- in --
package p
templ f() {
<div>
@Other(
p.Test,
"s",
)
</div>
}
-- out --
package p
templ f() {
<div>
@Other(
p.Test,
"s",
)
</div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package p
templ f() {
@Other(p.Test,"s")
}
-- out --
package p
templ f() {
@Other(p.Test, "s")
}

View File

@@ -0,0 +1,16 @@
-- in --
package p
templ f() {
@Other(p.Test, "s"){
<p>hello</p>
}
}
-- out --
package p
templ f() {
@Other(p.Test, "s") {
<p>hello</p>
}
}

View File

@@ -0,0 +1,16 @@
-- in --
package p
templ f() {
<div>
@Other(p.Test, "s")
</div>
}
-- out --
package p
templ f() {
<div>
@Other(p.Test, "s")
</div>
}

View File

@@ -0,0 +1,12 @@
-- in --
package p
templ f() {
@Other(p.Test)
}
-- out --
package p
templ f() {
@Other(p.Test)
}

View File

@@ -0,0 +1,79 @@
-- in --
package test
templ input(value, validation string) {
<area>
<area></area>
<base>
<base></base>
<br>
<br></br>
<col>
<col></col>
<command>
<command></command>
<embed>
<embed></embed>
<hr>
<hr></hr>
<img>
<img></img>
<input>
<input></input>
<input>Text
<input>Text</input>
<keygen>
<keygen></keygen>
<link>
<link></link>
<meta>
<meta></meta>
<param>
<param></param>
<source>
<source></source>
<track>
<track></track>
<wbr>
<wbr></wbr>
}
-- out --
package test
templ input(value, validation string) {
<area/>
<area/>
<base/>
<base/>
<br/>
<br/>
<col/>
<col/>
<command/>
<command/>
<embed/>
<embed/>
<hr/>
<hr/>
<img/>
<img/>
<input/>
<input/>
<input/>Text
<input/>Text
<keygen/>
<keygen/>
<link/>
<link/>
<meta/>
<meta/>
<param/>
<param/>
<source/>
<source/>
<track/>
<track/>
<wbr/>
<wbr/>
}

View File

@@ -0,0 +1,15 @@
-- in --
package test
templ input(value, validation string) {
<div>
<div><b>Text</b></div></div>
}
-- out --
package test
templ input(value, validation string) {
<div>
<div><b>Text</b></div>
</div>
}