glossary formatter

Lee Joramo <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Way back in March, I started to investigate pyblosxom as a replacement 
for Radio Userland. Of course, I got side tracked on this project, but 
I am back and very close to moving to pyblosxom.

One of the things that I did while testing pyblosxom in March was 
creating a Glossary Preformatter to replace the "shortcuts" feature 
found in Radio. I posted the code to this list and there was some good 
feed back on improvements.

I have now tried to work with pyblosxom-0.7beta1, but have not been 
able to get my Glossary code to work. Reviewing this mailing list and 
the dev list and the various pyblosxom web sites, I see that a 
PostFormatter feature was added partly in response to my Glossary 
formatter.

I have tried to figure this out, but am now fairly lost. Below is the 
original code, what changes do I need to make? How do I set this up to 
run on all pages? Is there a document that explains all of this that I 
have missed?

Thanks!

#
# Glossary Formatter
#
from libs.preformatters.base import PreFormatterBase
import string

class PreFormatter(PreFormatterBase):
	def __init__(self, text = ''):
		self.text = ''.join(text)

	def parse(self):
		result = self.text
		glossary = getGlossary()
		for word in glossary.keys():
			result = string.replace(result, word, glossary[word])
		return result

def getGlossary():
	glossary = {
	'{joramo}':    '<a href="http://www.joramo.com">Lee Joramo</a>',
	'{google}':    '<a href="http://www.google.com">Google</a>',
	'{joramo.jpeg}': '<img src="/images/my/leeajoramo.jpeg">',
	'{copyright}': 'My attorney said: Eat SPAM and EGGS every hour!',
	}
	return glossary



-- 
Lee Joramo
(970) 261-8426            www.joramo.com
3363-1/2 C Road           [email protected]
Palisade, CO 81526





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
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.