[Trac] PyBlosxom for Trac

Ivo Looser ivo.looser at login.ch
Mon Feb 7 11:47:02 EST 2005


Hi Together

I whould like to use the Trac Wiki Synthax in my Blosxom as Plugin.

Here is the Samplecode for a RST parse.

PREFORMATTER_ID = 'reST'
FILE_EXT = 'rst'

from docutils.core import publish_string
from Pyblosxom import tools

def cb_entryparser(args):
    args[FILE_EXT] = readfile
    return args

def cb_preformat(args):
    if args['parser'] == PREFORMATTER_ID:
        return parse(''.join(args['story']))

def parse(story):
    html = publish_string(story, writer_name='html')
    return html[html.find('<body>') + 6:html.find('</body>')]

def readfile(filename, request):
    entryData = {}
    d = open(filename).read()
    title = d.split('\n')[0]
    d = d[len(title):]
    body = parse(d)
    entryData = {'title': title,
                 'body': body}
    # Call the postformat callbacks
    tools.run_callback('postformat',
            {'request': request,
             'entry_data': entryData})
    
    return entryData

I tryd to take the sample
http://projects.edgewall.com/trac/attachment/wiki/MacroBazaar/WikiFile.py
and adapt it to my nessesary features.

But I get an error when I'm import WikiProcessor. Also I saw the ticket
http://projects.edgewall.com/trac/ticket/801 for this Macro.

I think it whould be nice to use it in Pyblosxom. Is there a plan to
implement wiki to use from other system's?

Maybe someone has help:-)

Thanks in advance.

Ivo




More information about the Trac mailing list