Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

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

Open
ericchen0121 opened this issue Dec 5, 2014 · 7 comments

Comments

@ericchen0121
Copy link

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!

@mquandalle
Copy link
Owner

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

@mquandalle
Copy link
Owner

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.

@ericchen0121
Copy link
Author

👍 let me know the end result! Appreciate your efforts!

@rndD
Copy link

rndD commented Feb 19, 2015

@mquandalle thank you for this nice package. 👍
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.

@bkuri
Copy link

bkuri commented Sep 10, 2015

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
Copy link

bkuri commented Oct 13, 2015

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

@dalgard
Copy link

dalgard commented Oct 14, 2015

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.

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

No branches or pull requests

5 participants