41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
package testtextwhitespace
|
|
|
|
templ WhitespaceIsAddedWithinTemplStatements() {
|
|
<p>
|
|
This is some text.
|
|
if true {
|
|
So is this.
|
|
}
|
|
</p>
|
|
}
|
|
|
|
const WhitespaceIsAddedWithinTemplStatementsExpected = `<p>This is some text. So is this.</p>`
|
|
|
|
templ InlineElementsAreNotPadded() {
|
|
<p>Inline text <b>is spaced properly</b> without adding extra spaces.</p>
|
|
}
|
|
|
|
const InlineElementsAreNotPaddedExpected = `<p>Inline text <b>is spaced properly</b> without adding extra spaces.</p>`
|
|
|
|
templ WhiteSpaceInHTMLIsNormalised() {
|
|
<p>
|
|
newlines and other whitespace are stripped
|
|
but it is normalised
|
|
like HTML.
|
|
</p>
|
|
}
|
|
|
|
const WhiteSpaceInHTMLIsNormalisedExpected = `<p>newlines and other whitespace are stripped but it is normalised like HTML.</p>`
|
|
|
|
templ WhiteSpaceAroundValues() {
|
|
<p>templ allows { "strings" } to be included in sentences.</p>
|
|
}
|
|
|
|
const WhiteSpaceAroundValuesExpected = `<p>templ allows strings to be included in sentences.</p>`
|
|
|
|
const WhiteSpaceAroundTemplatedValuesExpected = `<div>templ allows whitespace around templated values.</div>`
|
|
|
|
templ WhiteSpaceAroundTemplatedValues(prefix, statement string) {
|
|
<div>{ prefix } { statement }</div>
|
|
}
|