Re: showing source code in blog posts

Dieter Plaetinck <dieter-7FYLOmueu/[email protected]> Mon, 1 Nov 2010 14:04:27 +0100
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Well, like I said, the pages are rendered exactly like they were before
and my lighttpd logs contain no errors (and the pyblosxom logging
doesn't work for me, but that's another story)

There definitely are \n in the text.
In fact, I now tried this:

in plugins/comments.py:
def cb_preformat(args):
    return ''.join(args['story']) + '<h1>comments</h1>'

in plugins/pygments.py:
def cb_preformat(args):
    return ''.join(args['story']) + '<h1>PYGMENTS</h1>'


Then my rendered stories contain '<h1>comments</h1>', but not
'<h1>PYGMENTS</h1>'
I also tried putting the pygments plugin first in py["load_plugins"] in
the config.py, but no change.

here's the entire pygments.py source code
http://sprunge.us/TGST
I checked permissions/ownership, it's correct (and the same as the
other plugins)
This is my entire config:
http://sprunge.us/OfGb

Dieter



On Mon, 01 Nov 2010 08:46:00 -0400
will kahn-greene <[email protected]> wrote:

> When you say "I can't get it to work", what does that entail?  What's
> failing?  Does it do something, but not the right thing?  Are there \n
> in the text?  Is there an error?...
> 
> 
> On 11/01/2010 05:50 AM, Dieter Plaetinck wrote:
> > 
> > Thanks, that seems like a good idea.
> > I've been looking at the markdown and linebreak parser plugins to
> > see how to do it, but I can't get it to work.
> > Just to get the first step working (modifying the page content), I
> > use this code (comments stripped for clarity):
> > 
> > 
> > __author__ = 'Dieter Plaetinck <dieter-7FYLOmueu/[email protected]>'
> > __version__ = "0.1"
> > PREFORMATTER_ID = 'pygments'
> > 
> > import re
> > def cb_preformat(args):
> >     if args['parser'] == PREFORMATTER_ID:
> >         return parse(''.join(args['story']))
> > 
> > def parse(text):
> >     text = re.sub('\n','<h1>somethinghappens</h1>',text)
> >     return text
> > 
> > 
> > and my config:
> > $ grep pygment /srv/http/dieterblog/config.py
> > py["load_plugins"] = ["comments", "tags", 'pygments']
> > py['parser'] = 'pygments'
> > the code is in this file: /srv/http/dieterblog/plugins/pygments.py
> > 
> > Normally I should see "<h1>somethinghappens</h1>" all over the
> > place, right?  But my pages are the way they were before, as if
> > it's still using the plain parser.  When I use the debug renderer
> > it confirms that Request.get_configuration() dict contains parser
> > -> pygments
> > 
> > No errors in my lighttpd error log either.
> > 
> > Dieter
> > 
> > ------------------------------------------------------------------------------
> > Nokia and AT&T present the 2010 Calling All Innovators-North
> > America contest Create new apps & games for the Nokia N8 for
> > consumers in  U.S. and Canada $10 million total in prizes - $4M
> > cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt
> > SDK, Web Runtime, or Java and Publish to Ovi Store
> > http://p.sf.net/sfu/nokia-dev2dev
> > _______________________________________________ pyblosxom-users
> > mailing list pyblosxom-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > https://lists.sourceforge.net/lists/listinfo/pyblosxom-users
> > 


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev