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

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

Comments

Your email will never ever be published.

Previous:
U.S. memory championship March 20, 2005 Misc. links
Next:
Read in passwords with bash March 25, 2005 Linux
Related by category:
A Python dict that can report which keys you did not use June 12, 2025 Python
Faster way to sum an integer series in Python August 28, 2025 Python
Combining Django signals with in-memory LRU cache August 9, 2025 Python
Native connection pooling in Django 5 with PostgreSQL June 25, 2025 Python
Related by keyword:
Add links to a text (take II) November 10, 2004 Python
Control comment spam April 5, 2005 Python