Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you not interpolate tag strings into htl strings? #41

Closed
grahamas opened this issue Nov 10, 2024 · 1 comment
Closed

Can you not interpolate tag strings into htl strings? #41

grahamas opened this issue Nov 10, 2024 · 1 comment

Comments

@grahamas
Copy link

grahamas commented Nov 10, 2024

br_str = "</br>"
br_htl_str = @htl "$br_str" # &lt;/br>

If no, is there a way to join htl strings? Like

br = @htl "</br>"
join([br, br], @htl "") # &lt;/br>&lt;/br>
@grahamas grahamas changed the title Tags mangled when joining htl strings Can you not interpolate tag strings into htl strings? Nov 10, 2024
@fonsp
Copy link
Member

fonsp commented Dec 17, 2024

Hey! HypertextLiteral has the interpolation feature for this. When you interpolate a vector of items, they will be inserted one-by-one.

julia> b1 = @htl "</br>"
</br>

julia> @htl "$([b1, b1])"
</br></br>

julia> b2 = "</br>"
"</br>"

julia> @htl "$([b2, b2])"
&lt;/br>&lt;/br>

@fonsp fonsp closed this as completed Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants