meteor-jade icon indicating copy to clipboard operation
meteor-jade copied to clipboard

Unable to add param to helper template method with #{ } - update docs?

Open ericchen0121 opened this issue 9 years ago • 7 comments

I have a template helper method momentify that accepts one argument, createdAt

The spacebars syntax works... {{ momentify createdAt }} This syntax does not... #{ momentify createdAt }

After reading some of the other issues, you probably would say that momentify createdAt is not a valid javascript definition, thus you don't want the jade compiler to support it, which I understand. (1) Is this correct?

However, this is not documented anywhere in your Readme. (2) For future users... I'd add a little note to the readme docs explaining this special case, since it was unclear since you mentioned you recommended using the #{ } jade syntax, thus, I figured it would be used interchangeably with the spacebars syntax.

Thanks!

ericchen0121 avatar Dec 05 '14 07:12 ericchen0121

(1) Correct! (2) I agree, docs need some love

mquandalle avatar Dec 05 '14 15:12 mquandalle

Hum, after a second thought on (1), did I really say somewhere that I don't want to support this syntax? That seems a reasonable expectation assuming things like if helper arg1 arg2 work in meteor-jade. So I might add this functionality, and improve the docs anyway.

mquandalle avatar Dec 05 '14 16:12 mquandalle

:+1: let me know the end result! Appreciate your efforts!

ericchen0121 avatar Dec 09 '14 08:12 ericchen0121

@mquandalle thank you for this nice package. :+1: May ask you to add explanation of this case in docs? You will save time for people who want to give a try to meteor-jade.

rndD avatar Feb 19 '15 14:02 rndD

I'm referencing the following issues here, since I believe #98 is the first time this bug is mentioned and they all point to the same problem (my apologies if I missed one!): #113 #122 #147 #153 #157

BTW, question 1 from the OP isn't actually solved by switching from #{momentify date} to #{momentify(date)}. The latter just prints that exact text instead of parsing it. The only way I can make it work is switching it to its spacebars equivalent: {{momentify date}}. HTH

bkuri avatar Sep 10 '15 08:09 bkuri

There now exists a fork that seems to fix this issue: https://github.com/dalgard/meteor-jade

bkuri avatar Oct 13 '15 00:10 bkuri

Yes, I've modified a fork of this package to support passing arguments to helpers, together with a few other useful features. The fork has been released as dalgard:jade.

I will keep the new package in sync with the original, should there be any updates, and generally continue maintenance until, hopefully, the two packages can be merged.

dalgard avatar Oct 14 '15 11:10 dalgard