[Chicago] make some text a link via css or javascript
Cosmin Stejerean
cosmin at offbytwo.com
Thu May 14 21:07:57 CEST 2009
On Thu, May 14, 2009 at 1:43 PM, Lukasz Szybalski <szybalski at gmail.com>wrote:
> Hello,
> Not really python related, but since the notes system is written in
> python I figured somebody might know the answer to this:
>
> I have python based "notes" system.
> Whenever somebody enters a note like: "See ticket#45" is there a way
> for me using css or javascript to convert "ticket#45" on the fly to a
> link like:
> http://example.com/trac/ticket/14
>
Regular expressions are built into JavaScript. Here's an example that will
do what you want.
var re = /ticket#(\d+)/g
var text = "See ticket#123 and ticket#124"
text.replace(re, '<a href="http://example.com/trac/ticket/$1>ticket#$1</a>')
--
Cosmin Stejerean
http://offbytwo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20090514/5e60aa72/attachment.htm>
More information about the Chicago
mailing list