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

Using Symbols as attribute values #3

Closed
tshort opened this issue Apr 19, 2018 · 1 comment
Closed

Using Symbols as attribute values #3

tshort opened this issue Apr 19, 2018 · 1 comment

Comments

@tshort
Copy link
Contributor

tshort commented Apr 19, 2018

In some cases, it'd be nice to be able to use Symbols instead of Strings for some values, especially ones that are names. Here's ana example:

julia> m("div", id = :hi, "hello")
<div id=":hi">hello</div>

Right now, this symbol is rendered as ":hi" rather than "hi". The sprint(show, ...) construct causes this. Would it be possible to use print instead to get rid of the colon? Or, could we have some other way to do that?

Great package, by the way! I really like the div.someclass and div."some-class" syntax.

@yurivish
Copy link
Collaborator

yurivish commented Apr 19, 2018

Hi Tom, thanks for the issue — I think this makes sense, and am trying to remember why I thought using show was a good idea at the time. I still occasionally get confused by the printing infrastructure, but revisiting this it looks like print is the better choice here since we don't want to print Julia-specific formatting to the web if there's a better canonical representation.

I just pushed a commit to make your suggested change. And now:

julia> m("div", id = :hi, "hello")
<div id="hi">hello</div>

Great package, by the way! I really like the div.someclass and div."some-class" syntax.

Thanks!

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