/crunchy/src/plugins/username.py

http://crunchy.googlecode.com/ · Python · 15 lines · 7 code · 0 blank · 8 comment · 0 complexity · 8e75e8afa89bb11dfc9a25b8db0c83ed MD5 · raw file

  1. '''
  2. Username plugin.
  3. Enable the insertion of a user's username anywhere in a page.
  4. '''
  5. from src.interface import plugin, Element, SubElement
  6. def register():
  7. '''registers a simple tag handler'''
  8. plugin['register_tag_handler']("span", "title", "username", insert_username)
  9. def insert_username(page, elem, dummy):
  10. '''Inserts the username, replacing the text previously used as a placeholder.'''
  11. elem.text = page.username