Hi all,

We’re upgrading our version of shindig from 2.0.0 to 2.5.0-beta5 and have hit 
an issue with OpenSocial templates.

We’re seeing a stray “</ostemplate>” tag get output in the rendered HTML from a 
gadget which uses opensocial templates.  The source snippet and output are 
pasted below.  You’ll notice the template has a <script> tag within it.  The 
script tag does some manipulation of the elements created by the template 
itself with a library.

Are script tags within OpenSocial templates not allowed?  What is the preferred 
alternative for this scenario if not?  I’ve read most of the OSML 0.9 spec and 
haven’t seen anything regarding it: 
http://opensocial-resources.googlecode.com/svn/spec/0.9/OpenSocial-Markup-Language-Tags.xml

As best I can tell from searching this list, this may be related to the issues 
discussed in the following mail thread: 
http://markmail.org/message/5azybf2efmvrsmdt

Full disclosure:  I’ve just been introduced to OpenSocial templates and am 
inheriting this code for this upgrade, I’ve done some basic reading on 
templates, so I know some but may be missing something fundamental.

Also, I tried to send this email earlier and it didn’t seem to go through to 
the list, so apologies if you got this twice.

Many thanks!
-Matt

Here is the template:
        <script type="text/os-template" 
xmlns:os="http://ns.opensocial.org/2008/markup"; 
xmlns:company_menu="http://info.company.org/smii/company_menu"; 
tag="company_menu:wrapper" >
            <os:If condition="${My.data.status != '200'}">
                <div class="sectionWrapper errorMessage">Service is unavailable 
at this time.</div>
            </os:If>
            <os:If condition="${My.data.status == '200'}">
                <div class="sectionWrapper" style="display: none">
                    <div class="company_header">
                        <div class="navigation">
                            <a 
href="javascript:ddtreemenu.flatten('treemenu_${My.name}', 'expand')">Expand</a>
                            <span>|</span>
                            <a 
href="javascript:ddtreemenu.flatten('treemenu_${My.name}', 
'contract')">Collapse</a>
                        </div>
                        <div class="title">${My.title}</div>
                    </div>
                    <ul id="treemenu_${My.name}" class="treeview">
                        <os:Html code="${My.data.content}"/>
                    </ul>
                    <script type="text/javascript">
                        ddtreemenu.createTree("treemenu_${My.name}", true);
                    </script>
                </div>
            </os:If>
        </script>

And here is the resulting HTML (cleansed), random ostamplate tag bolded:
<div class="sectionWrapper" style="display: none">
<div class="company_header">
    <div class="navigation">
        <a 
href="javascript:ddtreemenu.flatten(&#39;treemenu_about_company&#39;, 
&#39;expand&#39;)">Expand</a>
        <span>|</span>
        <a 
href="javascript:ddtreemenu.flatten(&#39;treemenu_about_company&#39;, 
&#39;contract&#39;)">Collapse</a>
    </div>
    <div class="title">About</div>
</div>
<ul class="treeview" id="treemenu_about_company">
  <li><a href="javascript: void(0);">General Information</a>
  <ul>
    <li><a 
href="http://www.company.com/stuff1";>Stuff<http://www.company.com/stuff1%22%3EStuff>
 1</a></li>
    <li><a 
href="http://www.company.com/stuff2";>Stuff<http://www.company.com/stuff2%22%3EStuff>
 2</a></li>
  </ul>
</ul>
<script type="text/javascript">
   ddtreemenu.createTree("treemenu_about_company", true);
</ostemplate></script></div>

Reply via email to