Link | text_to_url |
Author | Asle Benoni |
Category | String |
Version | 8.x |
License | Public Domain |
Posted | 21 Feb 2006 |
Updated | 10 Jul 2008 |
More by this author... |
Lasso8 version of a simple tag to make URL and MAILTO: links from a text input or field.
Mail addresses are converted to <a href="mailto:foo@foo.com">foo@foo.com</a>. It searches for any links beginning with "www..." and converts them to <a href=> links. A link without "www" will also be clickable as long as it starts with "http://". Of course it cannot decide if a text like "blueworld.com" is a URL. The tag should guess all kinds of weird URLS.
If the text includes i.e. <a href="http://bw.com">Click here</a> links it does not treat them since these are hard coded already and you don't want to change them. It only treats obvious links that are not already clickable.
Option to choose whether or not to show "http://" in the link text.
Usage: text_to_url:'Please visit us at www.sample.com' -> Please visit us at http://www.sample.com text_to_url:'Please visit us at http://sample.com' -> Please visit us at http://sample.com text_to_url:'Please contact us at support@sample.com' -> Please visit us at suppport@sample.com If you want to leave out the "http://" in the link text you must change the value of local:'linktext'
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag: 'text_to_url', -Required='Field', -optional='target'; /* ############################################################################################################# ## Custom_tag: [text_to_url] ## Version: 1.2.2 ## Date: 6-8-2004 - updated 11-2005 (03-2007 bugfix) for Lasso 8 by suggestion from Johan Solve ## Author: Asle Benoni - asle@benoni.no || use it as you like but at your own risk ;-) ## Function: Takes a textinput containing URLs (HTTP, HTTPS, FTP) and email adresses and converts them to clickable links ## Platform: Lasso 8.5, 8 7 and Lasso 6. ## Availability: FREE - but I would be glad to hear if you are using it or have suggestions/requests for changes ## -> and if you keep the author information here ;-) ## ## A simple tag to make URL and MAILTO links from a text input or field. ## It searches for any links beginning with "www..." and converts them to links. ## A link without "www" will also be clickable as long as there it starts with "http://" ## Of course it cannot decide if a text like "blueworld.com" is a URL. ## The tag should guess all kinds of weird URLS ## If the text includes i.ex. Click here links it does not treat them since ## these are hardcoded already and you don`t want to change them. It only treats obvious links that ## are not already clickable. ## ## Usage: ## text_to_url:'Please visit us at www.sample.com' ## -> Please visit us at http://www.sample.com ## ## text_to_url:'Please visit us at http://sample.com' ## -> Please visit us at http://sample.com ## ## text_to_url:'Please contact us at support@sample.com' ## -> Please visit us at suppport@sample.com ## ## If you want to leave out the "http://" in the link text you must change the value of local:'linktext' ## ############################################################################################################# */ local:'urltext'= ''; local:'linktext'= '\\1'; // Change this value to '\\3' if you DO NOT want the link text to show a leading 'http://' // First we change all "www.xx.xx" to "http://...." #urltext = (String_ReplaceRegExp: #Field, -Find='((? Visit us " #urltext=(String_ReplaceRegExp: #urltext, -Find='((?)(https?://|ftp://)((([A-Za-z0-9$_.+!*(),;/?:@&~=-]+)|%[A-Fa-f0-9]{2})+(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?))', -Replace=''+ #linktext +'',-ignorecase); // Create email-links from found email #urltext = (String_ReplaceRegExp: #urltext, -Find='([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4})', -Replace='\\1',-ignorecase); #urltext = (String_Replace: -Find='\n', -Replace='
\n', #urltext, -EncodeNone); return: @#urltext; /define_tag;
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Small fix