Talesoft / tale-jade

A complete and fully-functional implementation of the Jade template language for PHP
http://jade.talesoft.codes
MIT License
88 stars 10 forks source link

Itemscope itemtype error #66

Closed jacmoe closed 8 years ago

jacmoe commented 8 years ago

With this:

.blogentry(itemscope itemtype="http://schema.org/BlogPosting")

I get this:

Failed to lex jade: Unclosed attribute block (Line: 2, Offset: 21)

Any pointers?

jacmoe commented 8 years ago

So, I tried this:

.blogentry(itemscope="itemscope" itemtype="http://schema.org/BlogPosting")

And the error goes away, but it renders like this:

<div class="blogentry" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"></div>

I suspect that Jade will render it correctly by default, from reading this SO post: http://stackoverflow.com/questions/11020142/jade-element-attributes-without-value

Edit:
And it does indeed.

I tried to enter the original line into the Jade online demo, and it does the right thing.

<div class="blogentry" itemscope itemtype="http://schema.org/BlogPosting"></div>

So, I think that Tale Jade should handle a line like this:

.blogentry(itemscope itemtype="http://schema.org/BlogPosting")
TorbenKoehn commented 8 years ago

This should be fixed with the new lexer scanners and re-written scanning algorithms that work more consistent and stable.

I'll get the update up as soon as possible.

TorbenKoehn commented 8 years ago

Checked it again.

This is a bug. http://sandbox.jade.talesoft.io/id-56e159b37bbbb.html

Without a ,, it won't even render correctly.

As said above, I've completely re-written attribute parsing in the new branches. I'll try to get the update up today, I don't know if I make it (Compiler still needs a lot of work)

jacmoe commented 8 years ago

Take your time :+1:

I am not in dire need.
Looking forward to it, though. :)

TorbenKoehn commented 8 years ago

Well, you can always get around it by using plain HTML :)

Any line starting with < is handled as plain HTML by Tale Jade (and official Jade)!

jacmoe commented 8 years ago

Well, you can always get around it by using plain HTML :)

That is too easy @TorbenKoehn :)

But thanks for reminding me - I was not aware of that :+1:

TorbenKoehn commented 8 years ago

Some love for you, my friend. Can you test it?

jacmoe commented 8 years ago

It works wonderfully! Thanks :+1: