Re: escape nested content in macro?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Saturday, November 6, 2010, 4:01:36 AM, EC wrote:
> Hi,
> I have a macro that needs to escape as javascript its nested content.
>
> Calling:
> <@my_macro>
> This "text"
> Needs to be 'escaped' for JS
> </@my_macro>
>
> I tried things such as:
> <#macro my_macro>
> var v = "<#escape x as x?js_string><#nested></#escape>";
> // do something with v
> </#macro>
>
> But I cannot get anything to work. How do I do something like that
> without defining the text as a variable using assign?
#escape only affects interpolations (i.e. ${...} stuff), also
?js_string only works with strings (and <#...> has no return value).
What's the problem with assignments? Assuming you realize that you can
<#local captured><#nested></#local>.
> Thanks
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev