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

Allow terminating void elements with semicolons (;) #96

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@lfairy
Owner

lfairy commented Jul 30, 2017

When Rust and HTML syntax differ, Maud tends to side with Rust syntax. This can be seen with string literals, for example, where we use backslash escapes instead of HTML entities. Using ; to terminate void
elements is consistent with this idea.

Moreover, this reduces confusion around the generated code. Maud does not insert an extra slash into the HTML output (as per the spec) but the syntax may imply otherwise.

This confusion may have been the cause of a bug I found in the wild, where the code omitted the trailing slash on an input element. I suspect that this is because the author thought that a trailing slash in the Maud template would lead to one in the HTML output. Switching to semicolons would prevent this misconception.

Allow terminating void elements with semicolons (;)
When Rust and HTML syntax differ, Maud tends to side with Rust syntax.
This can be seen with string literals, for example, where we use
backslash escapes instead of HTML entities. Using `;` to terminate void
elements is consistent with this idea.

Moreover, this reduces confusion around the generated code. Maud does
not insert an extra slash into the HTML output (as per the spec) but
the syntax may imply otherwise.

This confusion may have been the cause of a [bug I found in the
wild][1], where the code omitted the trailing slash on an `input`
element. I suspect that this is because the author thought that a
trailing slash in the Maud template would lead to one in the HTML
output. Switching to semicolons would prevent this misconception.

[1]: anowell/quasar#3

@lfairy lfairy force-pushed the void-elements-semicolons branch from 93b460e to 88bf052 Jul 30, 2017

@lfairy lfairy closed this Aug 4, 2017

@lfairy

This comment has been minimized.

Owner

lfairy commented Aug 4, 2017

Merged in 1785071

@lfairy lfairy deleted the void-elements-semicolons branch Aug 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment