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

Terse mode only enabled after the doctype has been processed #1918

Open
leider opened this issue Apr 1, 2015 · 7 comments
Open

Terse mode only enabled after the doctype has been processed #1918

leider opened this issue Apr 1, 2015 · 7 comments
Labels

Comments

@leider
Copy link

leider commented Apr 1, 2015

Rendering a tag with an attribute that does not have a value, like <div ui-view></div> works only if done from within one jade file but not via included mixin.

See pull request #1917

PR is only for documentation.

Question: Is this a bug, feature or "tragic" side effect?

@ForbesLindesay
Copy link
Member

Thanks for reporting. This is true of any code that is "above" the doctype. Essentially the default doctype is something akin to xhtml, but it changes to the more modern html doctype when it sees doctype html. We should really be able to make this work regardless of where the doctype is specified.

@ForbesLindesay ForbesLindesay changed the title different rendering result for attire without value Terse mode only enabled after the doctype has been processed Aug 7, 2015
ForbesLindesay added a commit to pugjs/pug-code-gen that referenced this issue Aug 7, 2015
@TimothyGu TimothyGu added this to the 2.0.0 milestone Aug 15, 2015
@TimothyGu
Copy link
Member

Deassigning this to 2.0.0. It's not of blocking significance.

@TimothyGu TimothyGu removed this from the 2.0.0 - Modules and Plugins milestone Nov 1, 2015
@leider
Copy link
Author

leider commented Nov 1, 2015

agree. Shall I leave the issue open?

@TimothyGu
Copy link
Member

Yes please.

On Sun, Nov 1, 2015 at 1:33 AM Andreas Leidig [email protected]
wrote:

agree. Shall I leave the issue open?


Reply to this email directly or view it on GitHub
#1918 (comment).

@bartdorsey
Copy link

bartdorsey commented Apr 9, 2020

I just ran into this bug, and it manifested in a slightly different and unusual way. We had a mixin that appeared in a template AFTER a extends layout.pug. The layout file contains the doctype.html but somehow inside the mixin terse mode isn't enabled.

extends layout.pug

mixin option(value, text)
  option(value=value selected=(value === favoriteBeatle)) #{text}

block content
   +option('John', 'John')

I'm assuming this is because the extends happens after the mixin is parsed or something.

As a workaround for now, if you put the mixin inside of the block content it works fine, but I thought I would post this here as addition information related to this bug.

@bartdorsey
Copy link

Honestly at this point pug should just REMOVE the whole concept of terse mode and always render the attributes according to the HTML5 standard.

@ajimix
Copy link

ajimix commented Sep 25, 2020

I'm also facing this problem as it's now common in the HTML5 standard to have terse attributes but pug has this issue.
The issue was opened in 2015 and based on the lack of updates in Pug recently, it seems unlikely that this will ever be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants