On Tue, Jan 5, 2010 at 7:34 PM, daiwhea <daiw...@gmail.com> wrote:

> Thanks Alex.
>
> Yes, this can work. But I wonder how to achieve the require below?
>
> In our old php practice, we often use some jseditor to provide some
> kind of WYWG function. So peoples can input text with some style built
> in, such as font-size, font-weight, color, background-color or even
> insert a online image etc. Then, after submit, the content in db is
> some html indeed.
>
> For these html in db, how can I render it properly? Seems Text(_) is
> not suitable for this kind of data now.
>

You can use scala.xml.Unparsed.  This will pass a String to the XML output
without transformation.  However, if the String is malformed XML, the
browser will choke.  If the String contains JavaScript, it could result in
Cross Site Scripting issues.

Please take a look at Lift's Textile parser which transforms Strings in
Textile format to valid, secure XHTML.


>
> On Jan 5, 10:47 pm, Alex Boisvert <alex.boisv...@gmail.com> wrote:
> > The problem is that you're creating a String (not a NodeSeq) and the
> String
> > content is being escaped inside the wrapping elements.
> >
> > Try this,
> >
> > <p> { note.replyContent split '\n' map { Text(_) ++ <br/> } reduceLeft (_
> ++
> > _) } </p>
> >
> > alex
> >
> > On Tue, Jan 5, 2010 at 9:24 AM, daiwhea <daiw...@gmail.com> wrote:
> > > my issue is:
> >
> > > There are some text input by users. There are new line character(\r\n)
> > > in these text. I want to convert those new line characters into <br />
> >
> > > In the snippet, I put <p>{note.replyContent.replaceAll("\n", "<br />")}
> > > </p>. But the converted <br /> was changed to "&lt;br /&gt;" by lift.
> >
> > > So, my question is: In lift, how can I convert those new lines into
> > > <br /> tags?
> >
> > > Thanks in advance. ^_^
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Reply via email to