【问题标题】:TAL removes every TAGTAL 删除每个标签
【发布时间】:2016-04-30 23:40:39
【问题描述】:

我在 Pyramids 框架和 TAL 中使用 Chameleon。不幸的是,TAL 删除了每个标签,直到第一个。

HTML 模板:

<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>

渲染示例:

<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>

现在我错过了“因为...”中的所有跨度标签,有人知道吗,为什么?

谢谢

【问题讨论】:

    标签: html pyramid markup chameleon tal


    【解决方案1】:

    我认为你的结束标签搞砸了。您不匹配这些对。

    【讨论】:

    • 不,它们匹配。只是这里的对齐方式不对。
    【解决方案2】:

    在对神秘的跨度标签和标签标签进行一些测试和思考后,这将解决任何问题:

    <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>
    

    所以我会有一个用标签填充的输入标签:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-21
      • 2016-11-09
      • 2018-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-10
      相关资源
      最近更新 更多