Kwissle

My real-time quiz battle game Kwissle.com

Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Photos

Photoalbum, both old and new.

Twitter

Follow me on Twitter

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 
Python

Add links to a text (take III)

http://www.peterbe.com/plog/add-hrefs-III/addhrefs-0.7.tgz

22nd of March 2005

I've now made some improvements to my little addhrefs script. If you don't know what this is, read Add links to a text (take II) and Add links to a text with URLs which explains what this does.

The latest changes are that you can now pass your own function for turning an email or a URL into a link. For example:

 >>> from addhrefs import addhrefs
 >>> def emailify(e):return '<a href="/sendemail?to=%s">%s</a>'%(e,e)
 >>> print addhrefs("Hello foo@bar.com", emaillinkfunction=emailify)
 Hello <a href="sendemail?to=foo@bar.com">foo@bar.com</a>

You can also do the same with URLs by filling the urllinkfunction parameter.

Download: addhrefs-0.6.tgz

UPDATE Bug fixed version: addhrefs-0.7.tgz



Comment

 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.