|
From: chombee <ch...@la...> - 2010-01-31 18:16:46
|
On Sun, Jan 31, 2010 at 04:16:29PM +0000, Chris G wrote: > > Or perhaps it could be a cb_entryparser plugin that changes the value of > > 'template_name' in the entrydata dict if the request is for an index > > view, using a different story template for index views and for permalink > > pages. See: > > > > http://pyblosxom.sourceforge.net/1.5/dev_writing_plugins.html#writing-an-entryparser > > Ah, it's 'template_name' in the 'entry' dictionary, I was looking for > 'template' rather unsuccessfully. No, just tried that, there's no > 'template name' in there either. I've just looked through the entry > dictionary that you get in cb_story and there's no template, only the > flavour. There is a 'template' argument but that's the actual > template as a string, maybe one could modif that and return in in the > args. No, I'm talking about the entrydata dict that the parse method implemented by a cb_entryparser plugin should return to pyblosxom. This dict is not passed to your plugin from pyblosxom, your plugin creates the dict from scratch and returns it to pyblosxom. Look at the parse method in this example: http://pyblosxom.sourceforge.net/1.5/dev_writing_plugins.html#writing-an-entryparser It constructs and returns a dict `entrydata` with the keys 'title' and 'body'. You could also add any other keys you wanted to this dict, and their values could be used by your flavours or your other plugins. And you can add the 'template_name' key, which is used by pyblosxom: "You can also specify the template to use by setting the "template_name" variable in the returned dict. If the template specified doesn’t exist, PyBlosxom will use the story template for the specified flavour." So if you put 'template_name' = 'story-title-only' in the dict, then pyblosxom will look for a template file called 'story-title-only' in your flavour instead of using the default template file 'story'. > It's just as easy to empty (or not) the 'body'. Yeah, but I consider this solution less optimal. You might want your items on your index views to appear different from how they look on their permalink pages in ways other than just not having a body. Using separate story templates for the two views is more flexible. |