Thu, 07 Dec 2006

Rendering

By default, PyBlosxom uses a renderer that is based on the Blosxom template language. The renderer allows a template writer to insert variables into their weblog templates. At rendering time, the renderer replaces the variables with their actual values -- that's the meaning of 'render' in the context of PyBlosxom.

The Blosxoms combine several distinct templates in order to create a page in a weblog:

  • head - the content of this template is inserted before any entries are rendered.
  • date_head - the content of this templete in inserted at the start of a new day (the output is sorted chronologically).
  • story - the content of this template is inserted once for each entry to be rendered.
  • date_foot - the content of this templete in inserted at the end of a day (the output is sorted chronologically).
  • foot - the content of this template is appended after all entries have been rendered.
render.jpg

The Blosxom renderer also has callback functions that you can provide in order to override behavior. The callbacks are named after the templates they are associated. They are all executed right before the template is rendered. There is also a callback that isn't associated with a template, cb_story_end that is called after the store template is rendered. Also, these callbacks are passed different arguments. They are passed a dictionary that contains all the variables that the renderer will use for template rendering.

  • cb_head - before the head template is rendered.
  • cb_date_head - before the date_head template is rendered.
  • cb_story - before the story template is rendered.
  • cb_story_end - the story template is rendered.
  • cb_date_foot - before the date_foot template is rendered.
  • cb_foot - before the foot template is rendered.

[23:16] | [] | #-permalink-#