1 2 3 4 <html> 5 <head><title><?cs var:Title ?></title> 6 <style> 7 @import(http://www.clearsilver.net?<?cs var:UrlArg ?>) 8 </style> 9 <script> 10 var default_escape = "<?cs var:BlahJs ?>"; 11 var explicit_escape = "<?cs var:js_escape(BlahJs) ?>"; 12 document.writeln("<style>"); 13 var style_in_script = "<?cs var:BlahJs?>"; 14 document.writeln("</style>"); 15 </script> 16 <img alt="default escape" src="http://www.clearsilver.net?<?cs var:UrlArg ?>"/> 17 <img alt="explicit escape" src="http://www.clearsilver.net?<?cs var:url_escape(UrlArg) ?>"/> 18 implicit: <?cs var:Title ?> 19 explicit escape: <?cs var:html_escape(Title) ?> 20 uvar: <?cs uvar:Title ?> 21 implicit_slice: <?cs var:string.slice(Title, 7, 100) ?> 22 slice_explicit_escape: <?cs var:string.slice(html_escape(Title), 7, 100) ?> 23 explicit_escape_slice: <?cs var:html_escape(string.slice(Title, 7, 100)) ?> 24 </head> 25 </html> 26 non-html output: <?cs var:Title ?> 27 <script>Script outside HTML: <?cs var:BlahJs ?></script> 28 <script><html>Script outside HTML with HTML inside: <?cs var:BlahJs ?></html></script> 29 30 <script>Script outside HTML: <?cs var:BlahJs ?></script> 31 32 33 <?cs def:get_var(var) ?> 34 get_var: <?cs var:var ?> 35 <?cs escape: "url" ?> 36 get_var_inside_url_escape: <?cs var:var ?> 37 get_var_inside_url_escape_with_explicit_escape: <?cs var:url_escape(var) ?> 38 <?cs /escape ?> 39 <?cs escape: "none" ?> 40 get_var_inside_none_escape: <?cs var:var ?> 41 get_var_inside_none_escape_with_explicit_url_escape: <?cs var:url_escape(var) ?> 42 <?cs /escape ?> 43 <?cs /def ?> 44 45 <?cs if #1 == #1 ?> 46 <?cs if #2 == #2 ?> 47 nested ifs 48 <?cs /if ?> 49 <?cs /if ?> 50 51 <?cs escape: "html" ?> 52 Calling get_var(UrlArg) from within 'escape: "html"' <br/> 53 --> <?cs call:get_var(UrlArg) ?> 54 <?cs /escape ?> 55 56 Including test_escape.cs: <br/> 57 --- 58 <?cs escape: "html" ?> 59 <?cs include! "test_escape.cs" ?> 60 <?cs /escape ?> 61 ---- 62 63 <?cs escape: "html" ?> 64 escape level 1 65 <?cs escape: "js" ?> 66 escape level 2 67 <?cs /escape ?> 68 <?cs /escape ?> 69