Re: [flask] Line breaks vs new lines in text area boxes
- From:
- Ron DuPlain
- Date:
- 2010-12-16 @ 01:01
Hi Dan,
On Wed, Dec 15, 2010 at 7:57 PM, Dan Ross <dan@rosspixelworks.com> wrote:
> I've used Flask for a daily lyric site (dailylyric.appspot.com).
>
> When the lyric is entered in a text area box, I've had to remove new
> lines (if the poster pressed enter) and replace them with HTML so the
> post displays correctly.
>
> When a poster edits an entry, I'm going to have to do the reverse.
>
> This isn't a big deal code wise, but it makes me wonder if I'm missing
> a built-in way of doing it.
You can write a template filter to do this, and tweak to your requirement:
http://flask.pocoo.org/snippets/28/
This doesn't change the content, just how it's rendered.
-Ron