mkp.yieldUnescaped(...) does indeed also prevent characters like < and > to
be escaped.
The pre tag does work to display the newlines, but it has the drawback that
paragraphs of text are not wrapped inside a table cell. The table simply
becomes very very wide.
So still searching for a better option.
Perhaps escape the string first, then perform the replaceAll for the
newlines, and then render unescaped? How do I escape the string?
Tim Yates wrote:
>
> But if you've got any nasty script tags or anything in the markup you're
> sending out enescaped, you could be in bother...
>
> Wouldn't a <pre> tag or something inside the <td> handle newlines as they
> are?
>
> Tim
>
> On Thu, May 6, 2010 at 3:13 PM, Mick Knutson <
mknu...@baselogic.com>
> wrote:
>
>> builder.yieldUnescaped(...)
>>
>> or
>>
>> mkp.yieldUnescaped(...)
>>
>> ---
>> Thank You…
>>
>> Mick Knutson, President
>>
>>
>>
>> On Thu, May 6, 2010 at 10:06 AM, MichaelM
>> <
nabb...@mail21.e4ward.com>wrote:
>>
>>>
>>> I have a string with embedded newlines that I want to display in a HTML
>>> page
>>> using the markup builder.
>>> For the newlines to display, they will have to be converted into <br>.
>>>
>>> This does not work:
>>> description = """line 1
>>> line 2"""
>>> // Display in table cell
>>> td(iss.description.replaceAll("\n", "<br>"))
>>>
>>> The br angled brackets are escaped (as one would expect).
>>> So how can I get it to convert?
>>> --
>>> View this message in context:
>>>
http://old.nabble.com/MarkupBuilder%3A-converting-newline-to-br-tag-tp28474120p28474120.html
>>
>
>
--
View this message in context:
http://old.nabble.com/MarkupBuilder%3A-converting-newline-to-br-tag-tp28474120p28475201.html