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

Meta charset #56

Closed
Miha-x64 opened this issue Oct 23, 2017 · 6 comments
Closed

Meta charset #56

Miha-x64 opened this issue Oct 23, 2017 · 6 comments

Comments

@Miha-x64
Copy link

Hello.
Is there a way to declare <meta charset="UTF-8" />? Also, why meta function accepts code block, like a container-tag?
Actual signature:

meta(name: String?, content: String?, block: kotlinx.html.META.() -> kotlin.Unit)
@Miha-x64
Copy link
Author

Miha-x64 commented Oct 23, 2017

UPDATE. This was stupid, I've forgot +. I don't know where I've found this coode construct.
Original comment:

Also, this code

head {
    unsafe {
        raw("<meta charset=\"UTF-8\" />")
    }
    title("$titleText — Admin")
}

executes to

<!DOCTYPE html>
<html>
  <head>
    <title>Crud index — Admin</title>
  </head>
</html>

This is very sad that 'type-safe' builder just throws some code away.

@cy6erGn0m
Copy link
Contributor

Is it DOM builder or stream? JS or JVM?

@Miha-x64
Copy link
Author

It's ApplicationCall#respondHtml extension in Ktor. It uses writer.appendHTML().html(builder) — looks like stream for me. JVM.

cy6erGn0m pushed a commit that referenced this issue Nov 3, 2017
@cy6erGn0m
Copy link
Contributor

I can't reproduce this. I've just added two tests and both works well. Are you sure that it hasn't been removed by some other tool? (for example, because of tag close for meta that doesn't conform to the specification)

@Miha-x64
Copy link
Author

Miha-x64 commented Nov 3, 2017

Can't reproduce this? It was edited two days ago, that was my fault...

cy6erGn0m pushed a commit that referenced this issue Nov 7, 2017
@cy6erGn0m
Copy link
Contributor

Btw, this should be better than unsafe

meta { charset = "utf-8" }

however I also added charset parameter to the builder function as well

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