Genshi templates and Mootools JS selectors

11 views
Skip to first unread message

Vortexmind

unread,
Sep 28, 2008, 6:03:03 PM9/28/08
to Genshi
Hi all
I'm developing a web app using Turbogears 2 with Genshi templates and
Mootools Javascript framework. I am a novice with Genshi and I'm
having a problem.

As you may know, MooTools support a selector $$ to find an array of
elements with a specified selector. For example, $$('a') returns all
the hyperlinks in the document. ( docs: http://mootools.net/docs/Element/Element#dollars
)

My problem is: all my double dollars in my javascript code ($$) are
being processed by genshi and trasformed into single dollar ($), with
different semantic and this causes my scripts to fail.

Is there a way to "escape" those double dollars so that genshi ignore
them, or do I have to include my code in an external file so it
doesn't get processed by the template engine?

Thank you for any help :)



Victor Safronovich

unread,
Sep 28, 2008, 11:42:25 PM9/28/08
to Vortexmind
Hello, Vortexmind.

You wrote 29 ???????? 2008 ?., 4:03:03:

> Is there a way to "escape" those double dollars so that genshi ignore
> them, or do I have to include my code in an external file so it
> doesn't get processed by the template engine?

You should include your javascript in the CDATA xml node, like this
<script type="text/javascript">
<![CDATA[
var $$ = null;
]]>
</script>

--
Regards,
Victor Safronovich

Victor Safronovich

unread,
Sep 28, 2008, 11:52:15 PM9/28/08
to Victor Safronovich
Hello, Victor.

You wrote 29 ???????? 2008 ?., 9:42:25:

> You should include your javascript in the CDATA xml node, like this
> <script type="text/javascript">
> <![CDATA[
> var $$ = null;
]]>>
> </script>

O, I`m sorry, this doesn`t help in your case, try use $$$$ instead
of $$.

--
Regards,
Victor Safronovich

Vortexmind

unread,
Sep 29, 2008, 9:42:25 AM9/29/08
to Genshi

>   O, I`m sorry, this doesn`t help in your case, try use $$$$ instead
>   of $$.

This works :)


P.S. for XHTML compliance, I use

/* <![CDATA[ */

js code

/* ]]> */

as this works also for some older browsers ( details :
http://javascript.about.com/library/blxhtml.htm )
Reply all
Reply to author
Forward
0 new messages