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

Another issue with latest version (v1.3.4) #48

Closed
elquimista opened this issue Jan 16, 2016 · 9 comments
Closed

Another issue with latest version (v1.3.4) #48

elquimista opened this issue Jan 16, 2016 · 9 comments
Labels

Comments

@elquimista
Copy link

This issue is related to include statement.

mixin.jade

h2 Hello

1.jade

include mixin.jade

After compilation, it should generate only 1.html with the following contents:

<h2>Hello</h2>

But the result is it generates 1.html as well as mixin.html. And the contents are not good.
mixin.html

<h2>Hello</h2>

1.html

h2 Hello

This is certainly a bug right?

@TorbenKoehn
Copy link
Member

I'll check that right now

@elquimista
Copy link
Author

I came to find out this issue when I was getting an error which didn't use to occur before upgrading to v1.3.4. (I was using v1.3.1)
Here's my jade code:
../Mixin/button_with_preloader.ctp.jade

mixin button_with_preloader(title)
    button= $title

view.ctp.jade

include ../Mixin/button_with_preloader.ctp.jade
...
+button_with_preloader(__('Submit'))#btn_submit_feedback.right._no-margin-bottom

include and using mixin +button_with_preloader was working fine with v1.3.1, but with 1.3.4, it throws an error saying:
Failed to compile Jade: Mixin button_with_preloader is not defined (mixinCall at 33:34)

@TorbenKoehn
Copy link
Member

Yes, that's a bug indeed.

I've added a test for your first code snippets in this thread, these pass (Look at the dev-master branch)

The second thing you posted is a bug, I'm fixing it right now.

@elquimista
Copy link
Author

Yeah, the first snippet works fine. I wonder why it wasn't working before.
And the second snippet, I tried a simpler test:

mixin.jade

mixin button(title)
    button= $title

1.jade

include mixin
+button('Go')

The above code works without any issue. But it throws an error if I change include mixin to include mixin.jade

TorbenKoehn added a commit that referenced this issue Jan 16, 2016
- Fixed a bug where the extensions in the compiler where checked without
the .-prefix in handleImport (#48)
@TorbenKoehn
Copy link
Member

Please update and tell me if this is fixed for you

@elquimista
Copy link
Author

Thanks, it's working now. But I have another issue again.
This code used to be working with earlier version (e.g. 1.3.1)

div(id!='clip_#{$clip->id}')

Now it doesn't work, throwing an error: Failed to compile Jade: Failed to lex jade: Unclosed attribute block.

If I remove ! in the attribute assignment expression, the error doesn't show up, but instead if I inspect the html page in browser, I get <div id="clip_<?=htmlentities(isset($clip->id) ? $clip->id : '', \ENT_QUOTES, 'UTF-8')?>"></div>, which I expected to be <div id="clip_1"></div>.

Please check this and let me know.

@TorbenKoehn
Copy link
Member

Nooo, I broke attribute escaping.

Sorry haha, I'll fix this quickly.

@TorbenKoehn
Copy link
Member

Can you test this again as well? Don't forget to update to 1.3.6

@elquimista
Copy link
Author

It works. thanks 👍

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

No branches or pull requests

2 participants