KRL 扩展报价
在 KRL 中进行扩展引用有两种方法。其中之一记录在 Kynetx 文档的 Literals 下。看起来像这样:
var = <<
Some text
>>;
该语法允许您在文本中嵌入 beestings(例如,#{var}
)。
但是,我还看到使用了另一种语法,即 <| ... |>
相反。这两种类型的扩展引用机制有什么区别?各自的局限性/优点是什么?
There are two ways to do extended quoting in KRL. One of them is documented under Literals on Kynetx Docs. That looks like this:
var = <<
Some text
>>;
That syntax allows you to embed beestings (e.g., #{var}
) in the text.
However, I've also seen another syntax used, with <| ... |>
instead. What is the difference between these two types of extended quoting mechanisms? What are the limitations/advantages of each?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
<<>>扩展引号用于文本和 html。
<| |>扩展引号用于 javascript。在发出 javascript 时使用这些引号允许引擎将其作为 javascript 进行处理,这不仅解析速度更快,而且对换行符的处理也不同。
发出应始终与 <| 一起使用|>。
有趣的事实:我们称这些为小丑帽。 :)
<<>> extended quotes are used for text and html.
<| |> extended quotes are used for javascript. Using these quotes when emitting javascript allows for the engine to process it as javascript, which not only parses faster, but also has different handling for newlines.
emit should always be used with <| |>.
Fun Fact: We call these clownhats. :)