formatting using dust templates

33 views
Skip to first unread message

JBD

unread,
Jun 4, 2015, 7:58:53 PM6/4/15
to nod...@googlegroups.com

Hi

 

I am trying to figure out why some html I'm trying to display isn't showing correctly.  I use a formatted text box that saves the markup like this:

 

Lorem <strong>ipsum</strong> dolor sit amet…

 

Instead of like:

 

Lorem <strong>ipsum<strong> dolor sit amet…

 

So when I display it with:

{Destination.Description } or {Destination.Description|s } or {Destination.Description|h } or any other combo from the dust docs Iv'e tried 

It comes out like:

Lorem <strong>ipsum</strong> dolor sit amet

 

when it is rendered in the browser.


Does anyone know how to fix that?


Thanks,


JBD

Aria Stewart

unread,
Jun 4, 2015, 8:06:09 PM6/4/15
to nod...@googlegroups.com
That's not a dust problem -- it's encoded once already in your edit box, so dust is just faithfully reproducing that text.

You want to unescape the html entities -- check out the ent and he modules.

Aria

Ryan Graham

unread,
Jun 4, 2015, 8:11:40 PM6/4/15
to nod...@googlegroups.com
Dust will escape for you by default, which can be disabled with |h like you tried...

...but it looks like what you need is a step further, to unescape your string. There might be a filter for this outside of dustjs, but I don't believe it has anything like that builtin.

~Ryan

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/cab86248-c666-418b-89fe-355023762f87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JBD

unread,
Jun 5, 2015, 10:45:35 PM6/5/15
to nod...@googlegroups.com
Thanks.  Yeah I turned off the encoding in the formatted text control and it solved the problem.
Reply all
Reply to author
Forward
0 new messages