On Oct 26, 11:57 am, "Cooke, Mark" <[email protected]> wrote: > Folks, > > I am trying to put some javascript into my genshi template (for a plugin) but > it is rejected as follows: > > TemplateSyntaxError: not well-formed (invalid token): line 32, column 18 > > ...which turns out to be the first '<' character in the line: > > if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) > > So I have been searching to find out how to include javascript in genshi > templates and can only find questions but no documentation or answers I > understand. > > I am using `<xi:include href="layout.html" />` and trying to include the > <script>...</script> in the <head>...</head> block. What am I doing wrong? > > Many thanks for any help, > > ~ mark c
Templates are XHTML and need to be parsed correctly. < is a token reserved for XML tags/elements, so you need to escape it (as <) or wrap the code in a CDATA section. This is a general web XML/XHTML/HTML/ JavaScript issue, and lots of information available on the web: http://stackoverflow.com/questions/66837/when-is-a-cdata-section-necessary-within-a-script-tag :::simon -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.
