Add links to a text (take III)

22 March 2005   0 comments   Python

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

Mind That Age!

This blog post is 13 years old! Most likely, its content is outdated. Especially if it's technical.

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

Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
U.S. memory championship 20 March 2005
Next:
Read in passwords with bash 25 March 2005
Related by Keyword:
Control comment spam 05 April 2005
Add links to a text (take II) 10 November 2004
Related by Text:
HTML Tree on Hacker News 18 May 2014
YouTube - Nigella's XXXmas 19 December 2008
How and why to use django-mongokit (aka. Django to MongoDB) 08 March 2010
How to track Google Analytics pageviews on non-web requests (with Python) 03 May 2016
hashin 0.7.0 and multiple packages 30 August 2016