开发者

Django Templates: Wordwrap and indent block text

I'm a bit compulsive about having clean, readable and perfectly indented HTML. With Django’s templat开发者_JAVA百科e 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?


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜