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

spacebars style expression for jade #82

Closed
wants to merge 1 commit into from

Conversation

mrzafod
Copy link

@mrzafod mrzafod commented Nov 1, 2014

rel to #81 #80
rules: you can use a helper inside jade with brackets, you can pass any arguments (i.e. another helpers) inside brackets

    +if anyHelper(arg1, arg2, arg3, ...)
    div(class=anyHelper(arg1, arg2, arg3, ...))
    h1= anyHelper(arg1, arg2, arg3, ...)
    h1 #{anyHelper(arg1, arg2, arg3, ...)}

----------------------------------------------------------------------------
rules: you can use a helper inside jade with brackets, you can pass any arguments (i.e. another helpers) inside brackets
Samples:
 	+if anyHelper(arg1, arg2, arg3, ...)
 	div(class=anyHelper(arg1, arg2, arg3, ...))
 	h1= anyHelper(arg1, arg2, arg3, ...)
 	h1 #{anyHelper(arg1, arg2, arg3, ...)}
@timothyarmes
Copy link

Hi,

Would someone mind pulling this request and publishing please? As for #80 I'm also stuck trying to internationalise a jade file...

That's be great :)

Tim

@mquandalle
Copy link
Owner

Unfortunately the way the replace works (val.replace(/\(|\)|\,/g, " ");) is too hacky and error prone. It will create bugs if for instance someone use a parenthesis inside a text attribute (myhelper("()")). I think we need a more general way to handle JavaScript expressions (cf #1) with a proper parser. But I'm not sure what a good short term solution would be. Any idea?

@mquandalle
Copy link
Owner

I'm closing this PR because:

  • The implementation is too hacky (see above)
  • All the examples provided can already be written using spacebars mustaches inside jade templates

@mquandalle mquandalle closed this Nov 21, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants