Archive for the ‘template’ Tag
BBCode markup in Django
Why BBCode?
I’m a big fan of reStructuredText but faced the problem of being forced to use two versions of one text field: one without any markup for RSS, one with markup for rendering HTML. I found no easy solution how to remove reST markup, so I decided to change markup for this project.
I chose BBCode because it’s pretty easy to understand for ordinary users and it’s easy to remove since BBCode uses a syntax similar to HTML, just with squared brackets.
Example tags: [b][i][u][s][color][size][link][img][list][center][quote]
Use a templatetag without the load statement
Templatetags are extremely useful, they are similar to helpers in ruby on rails. If you don’t know them you should check out the documentation on how to use and write them: http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system
For my blog-application I wanted the post-time as word like ‘Morning’, ‘Afternoon’, ‘Evening’, etc. rather than the normal time format. I was searching on http://www.djangosnippets.org and found a templatetag called “Fuzzy Time of Day“ from wayalan.
Read more »
Comments (4)
Comments (1)