Skip to content

Commit c2d62d2

Browse files
committed
Merge branch '2.3.x' into 2.4.x
2 parents e654ef9 + bece67b commit c2d62d2

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

grails-test-suite-uber/src/test/groovy/org/codehaus/groovy/grails/web/sitemesh/FullSitemeshLifeCycleTests.groovy

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,46 @@ class FullSitemeshLifeCycleTests extends AbstractGrailsTagTests {
192192

193193
assertEquals 'good', result
194194
}
195+
196+
// GRAILS-11484
197+
void testMultilineTitle() {
198+
def template = '''
199+
<html>
200+
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
201+
<title>
202+
This is the title
203+
</title></head>
204+
<body onload="test();">body text</body>
205+
</html>
206+
'''
207+
208+
assertOutputEquals '''
209+
<html>
210+
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
211+
<title>
212+
This is the title
213+
</title></head>
214+
<body onload="test();">body text</body>
215+
</html>
216+
''', template
217+
218+
def layout = '''
219+
<html>
220+
<head><title>Decorated <g:layoutTitle /></title><g:layoutHead /></head>
221+
<body><h1>Hello</h1><g:layoutBody /></body>
222+
</html>
223+
'''
224+
def result = applyLayout(layout, template)
225+
226+
assertEquals '''
227+
<html>
228+
<head><title>Decorated
229+
This is the title
230+
</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
231+
</head>
232+
<body><h1>Hello</h1>body text</body>
233+
</html>
234+
''', result
235+
}
236+
195237
}

grails-web-sitemesh/src/main/groovy/org/codehaus/groovy/grails/web/sitemesh/GSPSitemeshPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void writeHead(Writer out) throws IOException {
9393
}
9494
String headAsString = headBuffer.toString();
9595
// strip out title for sitemesh version of <head>
96-
out.write(headAsString.replaceFirst("<title(\\s[^>]*)?>(.*?)</title>",""));
96+
out.write(headAsString.replaceFirst("(?is)<title(\\s[^>]*)?>(.*?)</title>",""));
9797
}
9898
else {
9999
headBuffer.writeTo(out);

0 commit comments

Comments
 (0)