aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/test/resources/templates/test.vm
blob: d448220976695278fcd1687295bc884cda2abb5a (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#*

@test test.vm

This template is used for Velocity regression testing.
If you alter this template make sure you change the
corresponding comparison file so that the regression 
test doesn't fail incorrectly.

*#

<html>
<body>

$name

#if ($customer)
    $customer.Name
#end


## this is a comment.

#if ($customer)
    this is the first line
#end

## This is the test bed.

this is testing for wild loose commas , ,

$100


#set($foo = "bar")

This is the $foo way.

#if ($foo)
    This is $bar.
#elseif ($bar)
    This is the first elseif!
#elseif ($foo)
    This is the second elseif!
#else
    This is the else
#end

#if ($foo)
    This is the if.
#else
    This is the else.
#end


\#set \$foo = "bar"

\$foo   => $foo
\$foo;  => $foo;
\$foo.  => $foo.
\$foo.. => $foo..
\$foo/  => $foo/
\$foo"  => $foo"
\$foo\  => $foo\
\$foo<  => $foo<
\$foo-  => $foo-
\$fooo+ => $fooo+
\$foo-x => $foo-x
\$foo$  => $foo$



#set($iam_cool = "jon")
$iam_cool
$!nada nothing here

function preload(imgObj,imgSrc)
{
    if (document.images) 
    {
        eval(imgObj+' = new Image()')
        eval(imgObj+'.src = "'+imgSrc+'"')
    }
}

function changeImage(layer,imgName,imgObj)
{
    if (document.images)
    {
        if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
        else document.images[imgName].src = eval(imgObj+".src")
    }
}

#if ($javascript)
    function changeImage(layer,imgName,imgObj)
    {
        if (document.images)
        {
            if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
            else document.images[imgName].src = eval(imgObj+".src")
        }
    }
#end

<!-- This is an HTML comment -->


$provider2.Title

#set($a = "x")
$a

#set($b = $a)
$b

<input type="text" name="email" value="">
<input type="text" name="email" value="$!schmarg">


#set($c = $provider.Title)
$c


#set($d = $provider.getTitle())
$d


#set($provider.Title = "crocodile hunter!")



$provider.Title



<!-- look here -->

#set($provider.Title = $d)
$provider.Title



#set($provider.Title = $provider.Name)
$provider.Title


#set($provider.Title = $provider.getName())
$provider.Title



#set($a = true)

#set($b = false)

#set($provider.State = true)

#set($provider.State = false)



#if ($provider.StateTrue)
    This is a property that returns a boolean
    value of true.
#end

#if (true)
    This expression is always (true).
#end


Foreach with a variable.

#foreach ($element in $list)
    This is $element.
#end

Foreach with an array.

<table>
#foreach ($element in $provider.Array)
    <tr>
        <td>This is $element</td>
    </tr>        
#end
</table>


#foreach ($element in $provider.Vector)
    This is the $element.
#end


Foreach with a method.

#foreach ($element in $provider.getCustomers())
    This is $element.
#end

$10.00

"this is great"

(this is also great)

This is the \#stuff and this
is the way \#to \#go.

this = that

I am a $provider.getTitle().

#if ($provider.theAPLRules())
    Yes the APL rules!
#else
    It still rules!
#end

</body>
</html>