[Home]WikiPatches/AutoMailto

UseModWiki | WikiPatches | RecentChanges | Preferences

Automatically turn e-mail adresses into mailto: links.

Checked for UseMod 1.0

Add this code:

s/([A-z0-9-_]+(?:\.[A-z0-9-_]+)*\@[A-z0-9-_]+(?:\.[A-z0-9-_]+)*(?:\.[A-z]{2,})+)/<a href="mailto:$1">$1<\/a>/g;

right before the closing bracket of the first if in CommonMarkup to automatically turn e-mail addresses like <brad@ltc.com> into mailto: links.


This is a small modification to make the feature configurable:

Add the new variable $AutoMailto? into # Configuration/constant variables.

Add this line into # Minor options:

$AutoMailto = 1;        # converts e-mails in format name@host into mailto: hyperlinks

Change the line of the original patch above to this one:

if ($AutoMailto) {
   s/([A-z0-9-_]+(?:\.[A-z0-9-_]+)*\@[A-z0-9-_]+(?:\.[A-z0-9-_]+)*(?:\.[A-z]{2,})+)/<a href="mailto:$1">$1<\/a>/g;
}

To allow e-mail addresses to be wrapped (particularly useful in tables with long addresses), change to:
s/([A-z0-9-_]+(?:\.[A-z0-9-_]+)*)\@([A-z0-9-_]+(?:\.[A-z0-9-_]+)*(?:\.[A-z]{2,})+)/<a href="mailto:$1\@$2">$1 @ $2<\/a>/g;


Contributors: <brad@ltc.com>, FerdinandPrantl, DavidAndel
The following does NOT belong to this page. Please find an appropriate location.

If you use the simple preformatted text method (just putting a space at the front of each line), then some wiki markup will be processed. To enter code samples without any wiki markup at all, use the <pre> ... </pre> tags. For example:


<pre>
enter your code here
</pre>

Yeah, but the browser still messes up the ampersand-less-than-semicolon kind of stuff. bdl


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 5, 2007 12:16 pm by MarkusLude (diff)
Search: