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

Double-quoted string with space is not correctly handled in template #109

Closed
suppadeliux opened this issue Feb 24, 2020 · 1 comment
Closed
Assignees
Labels
s: invalid This doesn't seem right

Comments

@suppadeliux
Copy link

suppadeliux commented Feb 24, 2020

I want to populate an input inside a form, with data coming from the handler, and not from the user.
But the problem is that when I declare the html property as an string, and bind it to the variable inside the html, everything goes wrong, and the output gives only a string with some extra double quotes at the beginning, and the rest of the output is broken.

I tried to escape the " in the string, but this doesnt work.

My theory is that this comes from the parser from Plush, but this is only a personal theory.

In example.go

func (context buffalo.Context) error {
     val := `value="Hello World"`

     context.Set("inputvalue", val)

     return context.Render(200, MyOwnContext(c).REngine.HTML("form.html"))
}

In form.html

<form action="" method="post" novalidate>
        <label><b>My value : </b></label>
        <input class="form-control" type="text" <%= inputvalue %>>
</form>

The Final output inside the input:

"Hello

Does someone have the same problem when testing the same code.?

Thank you for all your answers!

go.sum

github.com/gobuffalo/plush v3.8.3+incompatible h1:kzvUTnFPhwyfPEsx7U7LI05/IIslZVGnAlMA1heWub8=
github.com/gobuffalo/plush v3.8.3+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI=

go.mod

github.com/gobuffalo/buffalo v0.15.4
@suppadeliux suppadeliux changed the title Plush returns wrong string when <%= %> is used in template Double-quoted string with space is not correctly handled in template with <%= %> Feb 24, 2020
@suppadeliux suppadeliux changed the title Double-quoted string with space is not correctly handled in template with <%= %> Double-quoted string with space is not correctly handled in template Feb 24, 2020
@sio4
Copy link
Member

sio4 commented Sep 5, 2022

Not sure but I confirmed plush worked fine with the same situation and buffalo also does its job properly.

The only think I couldn't imagine is this part: MyOwnContext(c).REngine.HTML("form.html") What is your own context? I just guess that the answer may be inside your own context or REngine.

Just guessing. Please reopen the issue if you still have this issue or some more information to help the investigation.

@sio4 sio4 closed this as completed Sep 5, 2022
@sio4 sio4 self-assigned this Sep 5, 2022
@sio4 sio4 added the s: invalid This doesn't seem right label Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants