## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements.  See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership.  The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License.  You may obtain a copy of the License at
##
##   http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied.  See the License for the
## specific language governing permissions and limitations
## under the License.
#title( 'EscapeTool' )
<p>
#set( $demo = $text.demo )
$demo.thisPage.insert("#doclink( 'EscapeTool' true )").
</p>

#demoTableStart()

#set( $desc = 'Renders a backslash (\)' )
#demo( 'esc' 'b' $desc )

#set( $desc = 'Renders a backslash (\)' )
#demo( 'esc' 'backslash' $desc )

#set( $desc = 'Renders a dollar sign ($)' )
#demo( 'esc' 'd' $desc )

#set( $desc = 'Renders a dollar sign ($)' )
#demo( 'esc' 'dollar' $desc )

#set( $desc = 'Renders an exclamation mark (!)' )
#demo( 'esc' 'e' $desc )

#set( $desc = 'Renders an exclamation mark (!)' )
#demo( 'esc' 'exclamation' $desc )

#set( $desc = 'Renders a hash (#)' )
#demo( 'esc' 'h' $desc )

#set( $desc = 'Renders a hash (#)' )
#demo( 'esc' 'hash' $desc )

#set( $desc = 'Renders a double quotation mark (")' )
#demo( 'esc' 'q' $desc )

#set( $desc = 'Renders a double quotation mark (")' )
#demo( 'esc' 'quote' $desc )

#set( $desc = "Renders a single quotation mark (')" )
#demo( 'esc' 's' $desc )

#set( $desc = "Renders a single quotation mark (')" )
#demo( 'esc' 'singleQuote' $desc )

#set( $desc = 'Escapes the characters in a String using HTML entities.' )
#demo1( 'esc' 'html' 8 $desc )

#set( $desc = 'Escapes the characters in a String using UTF-8 URL character encoding.' )
#demo1( 'esc' 'url' 8 $desc )

#set( $desc = 'Escapes the characters in a String using Java String rules.' )
#demo1( 'esc' 'java' 8 $desc )

#set( $desc = 'Escapes the characters in a String using JavaScript String rules.' )
#demo1( 'esc' 'javascript' 8 $desc )

#set( $desc = 'Escapes the characters in a String to be suitable to pass to an SQL query.' )
#demo1( 'esc' 'sql' 8 $desc )

#set( $desc = 'Escapes the characters in a String using XML entities.' )
#demo1( 'esc' 'xml' 8 $desc )

#set( $desc = 'Escapes the characters in a <code>String</code> using java.util.Properties rules for escaping keys.' )
#demo1( 'esc' 'propertyKey' 8 $desc )

#set( $desc = 'Escapes the characters in a <code>String</code> using java.util.Properties rules for escaping values.' )
#demo1( 'esc' 'propertyValue' 8 $desc )

#demoCustom( 'esc' )
</table>

#set( $java = "He didn't say, ${esc.q}Stop!${esc.q}" )
#set( $javascript = $java )
#set( $html = '<bread> & <butter>' )
#set( $url = 'food/dinner?appetizer=bread & butter' )
#set( $xml = $html )
#set( $sql = "McHale's Navy" )
#set( $propKey = ' C:\Program Files' )
#set( $propValue = ' C:\Program Files' )

<div align="center">
  <a name="fullDemo"><h3>$demo.mainExampleHeader</h3></a>
<form method="post" action="$link.self.anchor('fullDemo')">
<textarea name="demo" rows="10" cols="65">##
#if( $params.demo )##
$params.demo##
#else##
${esc.d}java
${esc.d}esc.java(${esc.d}java)

${esc.d}javascript
${esc.d}esc.javascript(${esc.d}javascript)

${esc.d}html
${esc.d}esc.html(${esc.d}html)

${esc.d}url
${esc.d}esc.url(${esc.d}url)

${esc.d}xml
${esc.d}esc.xml(${esc.d}xml)

${esc.d}sql
${esc.d}esc.sql(${esc.d}sql)

${esc.d}propKey
${esc.d}esc.propertyKey(${esc.d}propKey)

${esc.d}propValue
${esc.d}esc.propertyValue(${esc.d}propValue)

${esc.d}esc.dollar
${esc.d}esc.d

${esc.d}esc.hash
${esc.d}esc.h

${esc.d}esc.backslash
${esc.d}esc.b

${esc.d}esc.quote
${esc.d}esc.q

${esc.d}esc.singleQuote
${esc.d}esc.s

${esc.d}esc.exclamation
${esc.d}esc.e##
#end##
</textarea>
  <br>
  <input type="submit" value="$demo.try">
  #if( $params.layout )
  <input type="hidden" name="layout" value="$params.layout">
  #end
</form>

#if( $params.demo )
$demo.mainResultsIntro:
<pre>
  $render.eval($params.demo)
</pre>
#end
</div>
