Re: glossary formatter

Lee Joramo <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
Wari

Okay I got my glossary postformatter working. One note about your 
sample code, I needed to assign the value of 'text' back to 
args['entry_data']['body']. I got stumped on this for far too long.

#
# libs/plugins/glossary.py
# Add Radio Userland style shortcuts to pyblosxom
#
def cb_postformat(args):
	text = args['entry_data']['body']
	glossary = getGlossary()
	for word in glossary.keys():
		text = text.replace(word, glossary[word])
	args['entry_data']['body'] = text	

def getGlossary():
	# in the future getGlossary() will probably read in a pickled 
dictionary
	glossary = {
	# LINKS
	'{joramo}':	   '<a href="http://www.joramo.com">Lee Joramo</a>',
	'{google}':	   '<a href="http://www.google.com">Google</a>'
	}
	
If all goes as planned, I will convert my site to pyblosxom tonight. 
And I will post glossary.py on my site.	
-- 
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.