First example of the showmore plugin

"Chris Moffitt" <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Here's my first stab at the showmore plugin.  It works to a point, but it
does not link directly to an entry yet.  I haven't figured out how to get
the url.

Here it is -

I call it from a story by putting $showmore('link to more') in the template.

Thoughts or comments are appreciated.

-Chris

"""
If the user puts <!---more---> in a document, then split
the output at the label and present a link to more detailed information
"""
from Pyblosxom import tools

entry = {}

def showmore(var):
    global entry
    registry = tools.get_registry()
    req = registry["request"]
    data = req.getData()
    conf = req.getConfiguration()
    story = entry.getData()
    if entry.has_key('more'):
        output = "<BR /> %s" % var
        return output
    else:
        return ''

def cb_prepare(args):
     request = args["request"]
     data = request.getData()
     data["showmore"] = showmore

def cb_story(args):
    global entry
    entry = args['entry']


def cb_postformat(args):
        text = str(args['entry_data']['body'])
        try:
            first, last = text.split("<!---more--->")
            args['entry_data']['body'] = first
            entry['more'] = last
        except:
            pass





-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
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.