ContentBBcode is a pluggable set of BBcode-like tags that can perform various operations - from inserting some data from the database to JS wrappers. You can read about the "system" on
Django wiki. Here I'll show you few examples. Note that Diamanda is still in beta and CBC syntax may change, the parser still needs some fixing.
Plugins are located in
diamandas/cbcplugins/cbcplugins and are used on wiki pages. The parser is located in
diamandas/cbcplugins/cbcparser.py. The basic and most comonly used plugin is
art:
from wiki.models import *
def render(dic, text):
for i in dic:
page = Page.objects.get(slug=i['attributes']['slug'])
text = text.replace(i['tag'], '<img src="/site_media/wiki/img/1.png" alt="" /> <a href="/wiki/page/' + page.slug + '/">' + page.title + '</a> - ' + page.description + '<br />')
return text
#[ rk:art slug="slugname" ]
The plugin tries to get a page from the database using page slug to find it. It will replace the tag with a link to that page using it normal title and description. rk:art is used to make lists of pages and "categories".
- Added: 14.07.2008 by riklaunim