简体   繁体   中英

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 (eg, #{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?

<<>> 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. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM