【问题标题】:How is Mustache "logic-less"?小胡子如何“无逻辑”?
【发布时间】:2013-08-23 15:24:49
【问题描述】:

Definition of "logic":

根据严格的原则进行推理或评估 有效性:“经验是比演绎逻辑更好的指导”。

Mustache 的“部分”使用基于布尔值from the documentation 的块显示形式的条件逻辑:

模板:

Shown.
{{#nothin}}
  Never shown!
{{/nothin}}

哈希:

{
  "person": true,
}

输出:

Shown.

因此,我很想知道如果我(可能是幼稚/无知)定义下的逻辑出现在其模板中,Mustache 以何种方式被视为“无逻辑”?

【问题讨论】:

  • 来自维基百科:Mustache is described as a "logic-less" system because it lacks any explicit control flow statements, like if and else conditionals or for loops; however, both looping and conditional evaluation can be achieved using section tags processing lists and lambdas.
  • 这不是矛盾吗?因为如果可以实现条件评估(无论语法如何)它包含逻辑?

标签: php javascript templates logic mustache


【解决方案1】:

与许多其他模板系统相比,它被称为“无逻辑”。我不认为有任何特别深刻的主张。 What's the advantage of Logic-less template (such as mustache)? 的答案可能也很有启发性。

【讨论】:

    猜你喜欢
    • 2012-11-24
    • 1970-01-01
    • 2011-08-29
    • 1970-01-01
    • 2013-03-31
    • 2015-06-08
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多