preformatters and entry parsers

David Ascher <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
1. It looks to me like only the default txt (plain) entry parser calls
the cb_preformat and cb_postformat callbacks.  Shouldn't all entry
parsers call them?

2. Also, I'm once again stumbling on an 'order of data collection'
problem.  Here's the scenario.

I was thinking that I could implement a version of the 'extended
entry' concept by supporting the following markup:

>>>>
Title of the entry

Summary:
   This is the summary of the entry that shows
   up in the index

This is the body of the entry, in other words the 'extended' entry.
>>>>

Something like this _would_ have worked:

def cb_preformat(args):
    lines = args['story']
    entry = []
    summary = []
    target = entry
    for line in lines:
        if line.startswith("Summary:"):
            target = summary
            continue
        if not line.startswith(' ') and target == summary:
            target = entry
            continue
        target.append(line)
    request = args["request"]
    config = request.getConfiguration()
    renderer = args['renderer']
    if len(renderer.getContent()) == 1:
        return ''.join(entry)
    else:
        return ''.join(summary)


except that args['renderer'] (which I saw the comments plugin using to
figure out whether a single entry was being shown or not) isn't
available at the time that cb_preformat is called.

I want this concept to work with all entry parsers, hence my idea of
putting it in the preformat as a 'filter'.

Are there other ways of finding out if we're looking at a single entry
or an index?

--david


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
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.