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

Malformed string literal for tag attribute #1235

Open
rmarronnier opened this issue Aug 30, 2023 · 3 comments
Open

Malformed string literal for tag attribute #1235

rmarronnier opened this issue Aug 30, 2023 · 3 comments

Comments

@rmarronnier
Copy link
Contributor

From luckyframework/lucky#1823 :

When using the https://luckyframework.org/html tool to convert
<div hx-get="/example" hx-headers='{"myHeader": "My Value"}'>Get Some HTML, Including A Custom Header in the Request</div> to lucky html, we get invalid code :

div "Get Some HTML, Including A Custom Header in the Request", hx_get: "/example", hx_headers: "{"myHeader": "My Value"}"

This results in a compile error :

Error: unexpected token: "myHeader"

@matthewmcgarvey
Copy link
Member

The source of the problem is here

private def wrap_quotes(string : String) : String
QUOTE + string.gsub("\"", "\\\"") + QUOTE
end

@rmarronnier
Copy link
Contributor Author

Thanks for the tip : why the vendor subfolder ? Should I open a PR with a fix in this repo ? Or should it be fixed in this archived repo : https://github.com/luckyframework/html2lucky ?

@jwoertink
Copy link
Member

The archived repo isn't used anymore. It's just what's in vendor now to keep the whole codebase together. I just use vendor as a common pattern in my projects where I have libraries that could be external, but I just wrap them up internally instead.

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

3 participants