File: esc.vm

package info (click to toggle)
velocity-tools 2.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,952 kB
  • sloc: java: 24,414; xml: 7,944; jsp: 459; makefile: 24
file content (160 lines) | stat: -rw-r--r-- 4,464 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
## 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>