htmlpyramidmarkupchameleontal

TAL removes every TAG


I'm using Chameleon in the Pyramids Framework and TAL. Unfortunately TAL removes every tag up to the first both.

HTML-Template:

<label tal:attributes="for item.id">
    <span i18n:translate="Because:" tal:condition="item.leading_because">Because:</span>
    <span tal:repeat="premise item.premises" tal:attributes="for item.id; id premise.id">
        <span tal:attributes="for item.id; id premise.id" tal:content="premise.title">premise</span>
        <span tal:condition="not:repeat.premise.end">
            <i><span i18n:translate="and"> and </span></i>
        </span>
    </span>
</label>

Rendered Example:

<li>
    <input type="radio" name="discussion-button-group" onclick="location.href=&quot;http://localhost:4284/d/cat-or-dog/r/11/undermine/29&quot;" id="11">
    <label for="11">
        Because: Cats are fluffy and Cats are small
    </label>

Now I'm missing all span-Tags in "Because ...", does somebody knows, why?

Thx


Solution

  • After some testing and thoughts about the mysterious span- and label-tag, this will solve any problem:

    <li tal:repeat="item items">
        <input type="radio" name="discussion-button-group" onclick="" tal:attributes="id item.id; onclick item.url">
        <label tal:attributes="for item.id" tal:condition="item.leading_because">
            <span tal:omit-tag="" tal:attributes="for item.id" i18n:translate="Because:">Because:</span>&nbsp;
        </label>
            <span tal:repeat="premise item.premises" tal:omit-tag="">
            <label tal:attributes="for item.id; id premise.id" tal:content="premise.title">premise</label>
        <label tal:condition="not:repeat.premise.end">&nbsp;<em i18n:translate="and">and</em>&nbsp;</label>
    </span>
    

    So I'll have an input tag filled with labels :)