KRL extended quoting
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 <| ... |>
开发者_JAVA百科instead. What is the difference between these two types of extended quoting mechanisms? What are the limitations/advantages of each?
<<>> 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. :)
精彩评论