On Sun, 2010-02-21 at 15:27 -0800, Benjamin wrote:
> If you still want to give your users quite a bit of formatting power
> (other than just 'title' and 'body' fields), consider letting them use
> something like markdown, restructured test, or something similar. This
> way your application is safe from running arbitrary HTML, but your
> users get to make things look pretty.
> 
> Django-markup is a great reusable app that enables this sort of thing.
> Take a look at its documentation for use in templates here:
> http://docs.mahner.org/django-markup/usage_templates.html
> 
Yes maybe, but I do not know how it would be if I'd want to reuse them
by some other applications like html2pdf or another etc.. 

Wolud it be better to add some code in linebreak filter? 

if not startswith(('<p>', '<h1>',..)): 

something like that.


> On Feb 21, 4:41 pm, Ali Rıza Keleş <ali.r.ke...@gmail.com> wrote:
> > Hi all,
> >
> > I have a problem about template language.
> >
> > In my model there is a text field for body text of entries. And I markup
> > my text with some html. Like below:
> >
> > Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
> > tempor incididunt ut labore et dolore magna aliqua. <strong>"Ut enim ad
> > minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
> > ex ea commodo consequat."</strong>
> >
> > <h2>Section 1.10.32 of "de Finibus Bonorum et Malorum"</h2>
> >
> > Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
> > dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
> > proident, sunt in culpa qui officia deserunt.
> >
> > Sed ut perspiciatis unde omnis iste natus error sit voluptatem
> > accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab
> > illo inventore veritatis et quasi architecto beatae vitae dicta sunt
> > explicabo.
> >
> > and in my templates use this text like that:
> >
> > {{ body|safe|linebreaks }}
> >
> > and the result is:
> >
> > <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> > eiusmod tempor incididunt ut labore et dolore magna aliqua. <strong>"Ut
> > enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> > aliquip ex ea commodo consequat."</strong></p>
> >
> > <p><h2>Section 1.10.32 of "de Finibus Bonorum et Malorum"</h2></p>
> >
> > <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
> > dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
> > proident, sunt in culpa qui officia deserunt.</p>
> >
> > <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem
> > accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab
> > illo inventore veritatis et quasi architecto beatae vitae dicta sunt
> > explicabo.</p>
> >
> > As you see, h2 tag is inside p tag. And this is not a valid usage for
> > xhtml which is my document's type.
> >
> > I need paragraphs because their styles are applied by css. Also h2s are
> > same.
> >
> > I don't want users-editors- do paragraphs manually, because many of
> > texts are quite long, this is not efficient, so I use linebreaks. Users
> > have some capability of writing html as much as they need. So they can
> > markup h2, strong etc, if it is necessary in text.
> >
> > How can I fix this?
> >
> > Thanks.
> >
> > --
> > Ali Rıza Keleş
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to