代码之家  ›  专栏  ›  技术社区  ›  Richard

在嵌套的if中放置点的正确方法是什么

  •  0
  • Richard  · 技术社区  · 6 年前

    我有以下代码无法在模板处理器中处理。我相信是if中的点导致解析器提前终止。

    {{range Counter .first .last}}
         {{if eq . $.first}}
            first stuff here
         {{else}}
            some stuff here
         {{end}}
         and the remainder here
    {{end}}
    

    当我看结果字符串时,它会停在内部“if”开始的地方。我想可能有一个点的别名,但还没有找到。虽然医生特别说如果不改变点。

    这种帮助。。。

    <eq . $.firstpid>: error calling eq: incompatible types for comparison
    

    我的印象是模板系统规范化了类型。我得更仔细地调查一下。

    0 回复  |  直到 6 年前