Sparkコード式をエスケープする方法は2つあります。
- 単一アイテムのエスケープ
- ブロック全体のエスケープ
単一アイテムのエスケープ
これは、式の種類ごとに3つのエスケープ文字のいずれかを使用して実行できます。説明するのではなく、以下はスパークビューでこれを行う方法の例です。
<div>
$${Encoded.Escaped.with.a.dollar < 0}
\${Encoded.Escaped.with.a.backslash < 0}
`${Encoded.Escaped.with.a.backtick < 0}
</div>
<div>
!!{Unencoded.Escaped.with.a.dollar < 0}
\!{Unencoded.Escaped.with.a.backslash < 0}
`!{Unencoded.Escaped.with.a.backtick < 0}
</div>
<div>
$$!{Encoded.Silent.Nulls.Escaped.with.a.dollar < 0}
\$!{Encoded.Silent.Nulls.Escaped.with.a.backslash < 0}
`$!{Encoded.Silent.Nulls.Escaped.with.a.backtick < 0}
</div>
結果は次のように逐語的に出力されます。
<div>
${Encoded.Escaped.with.a.dollar < 0}
${Encoded.Escaped.with.a.backslash < 0}
${Encoded.Escaped.with.a.backtick < 0}
</div>
<div>
!{Unencoded.Escaped.with.a.dollar < 0}
!{Unencoded.Escaped.with.a.backslash < 0}
!{Unencoded.Escaped.with.a.backtick < 0}
</div>
<div>
$!{Encoded.Silent.Nulls.Escaped.with.a.dollar < 0}
$!{Encoded.Silent.Nulls.Escaped.with.a.backslash < 0}
$!{Encoded.Silent.Nulls.Escaped.with.a.backtick < 0}
</div>
ブロック全体のエスケープ
新しい特殊タグを使用して、<ignore>
次のようにブロック内にあるものを逐語的に出力できます。
<html>
<head>
<title>ignore test</title>
</head>
<body>
<h1>ignore test</h1>
<p>${System.DateTime.Now}</p>
<ignore>
<div>
Regular text ${This.isnt.code < 0}
<var dummy="This isn't a variable" />
</div>
</ignore>
</body>
</html>
お役に立てば幸い、
ロブ