Grails

Fix the GSP engine so that it does not remove newlines (or add an option)

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.3
  • Fix Version/s: 1.1-beta1
  • Component/s: View technologies
  • Labels:
    None

Description

In a sample GSP file:

<div>
<g:message code="general.text" />

<g:message code="general.text" />

<g:message code="general.text" />
</div>

the produced result is

<div>
Hello WorldHello WorldHello World
</div>

instead of what I would expect:

<div>
Hello World

Hello World

Hello World
</div>

So the GSP engine removes the newlines. This causes problem when rendering plain text (in XML / HTML it generally does not matter).

Tabs and spaces are not removed. If you put some newliens and then a space, the newlines wont even be removed - it appears the code removes all the new line characters next to a GSP tag, apparently.

This is probably an easy fix although beware of regressions I guess maybe an option should be added to remove or not remove the newlines, but I cannot see a situation where removing them would be useful (although the contrary, always removing them, clearly is problematic).

Activity

Hide
Marc Palmer added a comment -

GSP now preserves most whitespace. Tags can control the behaviour, tags updated to correct behaviour.

Tag tests need to bear in mind there is whitespace now. Best to trim before compare / filter all WS.

Show
Marc Palmer added a comment - GSP now preserves most whitespace. Tags can control the behaviour, tags updated to correct behaviour. Tag tests need to bear in mind there is whitespace now. Best to trim before compare / filter all WS.

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: