views:

254

answers:

1

I'm a bit compulsive about having clean, readable and perfectly indented HTML. With Django’s template engine I almost have been able to achieve this with the exception of block text, or rather HTML generated by TinyMCE through the admin panel. The closest I could get is using the wordwrap filter; however this tag does not take any arguments to add an indentation to the new line. Is there any other way to achieve this?

A: 

I think your only option would be to create your own filter.

Django's django.template.defaultfilters.wordwrap uses the django.utils.text.wrap method to wrap text. You could look at that and modify the output in any way you want.

But it looks like a lot of work for having slightly more readable HTML. Sometimes good enough, is...

celopes
Ah, alright - yeah that is more trouble than its worth, but I just wanted to make sure I wasn't overlooking wordwrap or a similar filter. Thanks
KeyboardInterrupt