LinkedInAttic / dustjs-helpers

Helpers for dustjs-linkedin
MIT License
114 stars 70 forks source link

@eq doesn't work #76

Closed mani95lisa closed 10 years ago

mani95lisa commented 10 years ago

data:

{path:'/console'}

usage:

{@eq key="{path}" value="/console"} ok {/eq}

I'm confused by this, I have readed this doc, but it doesn't show how to compare string : https://github.com/linkedin/dustjs/wiki/Dust-Tutorial#Helpers.

Could anybody tell me how to do that? Thanks!

rragan commented 10 years ago

What you show seems fine. It outputs ok as I would expect. The eq helper is comparing the key parameter which is a string interploated with the value of path giving "/console" to the value parameter which is exactly the same string so "ok" is output. What is unclear?

mani95lisa commented 10 years ago

@rragan I'm clear what you say, but I don't got ok. I'm a little confused, I'll have a look again. Thanks!

mani95lisa commented 10 years ago

@rragan I tried again:

{path}
{@eq key="{path}" value="/console"} ok {/eq}

and I just got:

/console

it should be

/consoleok

What's wrong with it? Thanks!

mani95lisa commented 10 years ago

@rragan I have made more test, it seems that dust-helper doesn't work.

I have required it and included dust-helper.js in my .dust too. Anything I missed?

rragan commented 10 years ago

I would guess that for some reason dustjs-helpers is either not loaded or is loaded before dust. In the latter case, dust.helpers will be wiped out in dust initialization.

mani95lisa commented 10 years ago

Thanks, I got it!