-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtest.gsp
155 lines (124 loc) · 4.13 KB
/
test.gsp
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
<%@ page import="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<script type="text/javascript">
function test() {
var s = '<g:if test="${var}">value</g:if>';
var a = 3;
return a;
}
${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}
<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>
</script>
<g:javascript>
function test() {
var s = "<g:if test="${var}">value</g:if>"; // Not worth fixing?
var a = 3;
return a;
}
${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}
<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>
</g:javascript>
<asset:script>
function test() {
var s = "<g:if test="${var}">value</g:if>"; // Not worth fixing?
var a = 3;
return a;
}
${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}
<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>
</asset:script>
<g:javascript src="file.js" />
<r:script>
function test() {
/*
Not worth fixing?
*/
var s = <g:if test="${var}">value</g:if>; //
var a = 3;
return a;
}
${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}
<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>
</r:script>
</head>
<body>
<!-- An HTML comment
<hr class="${groovyVar}" /> -->
%{-- A GSP comment
<hr class="${groovyVar}" /> --}%
<%-- A JSP comment
<hr class="${groovyVar}" /> --%>
<div class="htmlAttr" id="${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}">
HTML tag content
</div>
${[a: groovyVar, b: 5, c: new com.package.Class(arg)]} test
<g:form action="${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}">
Grails tag content
</g:form>
<div class="htmlAttr" id="<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>">
HTML tag content
n
</div>
<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %> test
<g:form action="<%= [a: groovyVar, b: 5, c: new com.package.Class(arg)] %>">
Grails tag content
other
</g:form>
<r:image uri="resourcesTags" />
<custom:myTag arg="${[a: groovyVar, b: 5, c: new com.package.Class(arg)]}">
a
b
</custom:myTag>
<div id="logout">
<span>You are signed in as ${ session.pasport == null ? [a: "test"] : session.passport.user_name }</span>
<g:link controller="logout">
<span class="logout dark-button">LOGOUT</span>
b
</g:link>
</div>
<!-- hayseed's examples -->
<div id="logout">
<span>You are signed in as <%= session.pasport == null ? [a: "test"] : session.passport.user_name %></span>
<g:link controller="logout">
<span class="logout dark-button">LOGOUT</span>
</g:link>
</div>
<thead>
<tr>
<th><%= session.passport == null ? [a: "test"] : session.passport.user_name %>'s Roles</th>
</tr>
</thead>
%{-- This is broken for some highlighters. First part is embedded groovy, but it closes at the first } --}%
<g:each in="${schedules.groupBy{it.lcRequest}.sort{it.key.title}}" var="request">
<!-- END hayseed's examples -->
${val1 == 0 ? 0 : val2 / val3} %{-- A GSP comment --}%
${val1 == 0 ? [a: b] : [a: b]}
${val1 == 0 ? (val2 ? 1 : 2) : (val2 ? 3 : 4)}
${a?:b}
<tag> ${ a / b} </tag>
<tag> ${/a<b/} </tag>
<g:formatNumber number="${val1 == 0 ? 0 : val2 / val3}" type="percent" />
<%
x != y ? (10 + 3) : new Integer(7)
def h = 4
%>
<%!
def method(String a) {
def regex = /\$\{\}/
def str = "something"
}
%>
<%=
x != y ? (10 + 3) : new Integer(7)
def h = 4
%>
${
x != y ? (10 + 3) : new Integer(7)
x != y ? (10 + 3) : new Integer(7)
}
<g:hiddenField name="someName${i+1}" class="someClass anotherClass${i+1}" value="${entry.key}"/>
</body>
</html>