Re: images in posts

Wari Wahab <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
will wrote:

>So I suspect your issue could be solved with a cvs update.
>
Yeah, I nailed that bug a while ago (1-2 days to be somewhat exact). 
Make sure you do a `cvs update -d` and you'll probably be 'lightly' 
suprised by the fact that your entryparser will not work anymore :) 
Isn't life on the bleeding edge fun?

Entryparsers are now a callback plugin, so you just need to add three 
more lines to the code to self-register your entryparser. The resulting 
code would look like:

----------
from docutils.core import publish_string
def cb_entryparser(args):
    args['rst'] = parse
    return args

def parse(filename, request):
    d = file(filename).read()
    title = d.split('\n')[0]
    d = d[len(title):]
    html = publish_string(d, writer_name='html')
    body = html[html.find('<body>') + 6:html.find('</body>')]
    return {'title': title,
            'body': body}
-----------

Actually, the main benefits of this is that the rst.py can be a 
preformatter as well by adding a cb_preformat() callback to it. Be sure 
to add a postformat call before you return your text (see the 
defaultEntryParser in pyblosxom.py) to see how you could do this 
(tools_runcallback("postformat", etc, etc)) Than you can add nifty stuff 
at your site, like a postformatter that deals with thumbnails, it takes 
nasty stuff out of your rst parser, so your rst parser is just that - 
something clean :)

The new callback mechanism breaks all the old plugins, but adds a more 
powerful interface for plugins and how they are executed - like what you 
witnessed with the bug.



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.