djangosnippets.org: Latest snippets tagged with 'bbcode'https://djangosnippets.org/tags/bbcode/2008-07-04T13:54:00.446749-05:00BBCode templatefilter (generate & strip)
2008-07-04T13:54:00.446749-05:00b23https://djangosnippets.org/snippets/853/<p>Parse a string for <a href="http://en.wikipedia.org/wiki/Bbcode">BBCode</a> and generate it to (X)HTML by using the <a href="http://code.google.com/p/postmarkup/">postmarkup libary</a>.</p>
<p>In your template for generating (X)HTML:</p>
<p>{% load bbcode %}</p>
<p>{{ value|bbcode }}</p>
<p>In your template for removing BBCode fragments:</p>
<p>{% load bbcode %}</p>
<p>{{ value|strip_bbcode }}</p>
Freely redistributable