Closed jaydenseric closed 8 years ago
Ugh, now I have to implement it haha.
Thanks for the hint, I'll check if this is possible
Rad! You're doing amazing work :)
This project is saving our bacon on a last-minute Node -> PHP refactor. If I see the chance I'll try to make some contributions.
Official Jade can't handle #{tagName + 'def'}yzd.someItem
.
Do we need it? It seems official Jade only likes #{...}
-tags, without anything around it. It's easier to lex, but in reality I could do both.
What do you think?
We only need the simpler Pug implementation. More thorough interpolation from what I can tell would only enhance, not break the Pug syntax so if it's not too hard it would be nice to have.
Perhaps we could raise an issue in the Pug project and see what they think.
It's nice to take for granted compatibility though, maybe someone will find themselves refactoring PHP Jade components back to Pug and will hit issues.
Too late :P
The syntax is pretty basic, but you can use abc#{$someVar}def
, abc#{$someVar}
, just #{$someVar}
and #{$someVar}def
. Inside the {}, complete expressions (should) be allowed (including function calls etc.). Just using {} inside the {} (e.g. code blocks) should fail, the regex is too basic for that :)
I will make another re-release, so clear your composer-cache and delete the vendor directory, then update again (in like 10 minutes!)
Also, Tale Jade contains many features that are not compatible to Node.js Jade, just the other way around is compatible :)
Picking up from comments in #95.
I found a comment revealing that tag name interpolation has actually been suported in Jade/Pug since at least 2013.
Here is an example of what we use it for (in JS Pug):
A work around would be if statements and a bit of duplication. This would restrict you to a whitelist of options though. In this usage example we only need to support two tags anyway.