@@ -7,16 +7,15 @@ function Get-HTMX {
7
7
8
8
The function has no explicit parameters.
9
9
10
- Instead, broadly speaking, arguments become attributes (unless it appears to be a tag) and inputs become children.
10
+ Instead, broadly speaking, arguments become attributes (unless it appears to be a tag or has whitespace ) and inputs become children.
11
11
. NOTES
12
12
Ideally, this command is very forgiving in its input and helps you write HTMX tag in PowerShell.
13
13
14
14
If this proves not to be the case, feel free to open an issue.
15
15
. EXAMPLE
16
16
Get-Htmx div class=container "Hello, World!"
17
- <div class="container">Hello, World!</div>
18
17
. EXAMPLE
19
- htmx button "Click Me" hx-get=api/endpoint hx-trigger=click
18
+ htmx button "Click Me" hx-on:click="alert('Thanks, I needed that!')"
20
19
#>
21
20
[ArgumentCompleter ({
22
21
param (
@@ -144,14 +143,14 @@ function Get-HTMX {
144
143
}
145
144
146
145
# If we do not have children, we can close the tag now.
147
- if (-not $allContent ) { ' />' }
146
+ if (-not $moreChildren ) { ' />' }
148
147
# Otherwise, we will close the tag after the children.
149
148
else { ' >' }
150
149
151
- if ($allContent ) {
150
+ if ($moreChildren ) {
152
151
@ (
153
152
# We will walk over each child and create the child string.
154
- foreach ($contentItem in $allContent ) {
153
+ foreach ($contentItem in $moreChildren ) {
155
154
# If the content has a `ToHtml` method, we will use it.
156
155
if ($contentItem.ToHtml.Invoke ) {
157
156
$contentItem.ToHtml ()
0 commit comments