"</body>" + ..
"</html>";
+ // Process URLs and Emails
+ htmlcode = processHTMLLinks(htmlcode);
+
// Update the main description
set(Desc,"String",htmlcode);
set(msgText,"String",str);
endfunction
+
+// =============================================================================
+// processHTMLLinks
+// + Find URLs and emails
+// + Convert them in HTML
+// =============================================================================
+
+function txtout = processHTMLLinks(txtin)
+
+ regexUrl = "/((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\:\/\/)(www|[a-zA-Z0-9])[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(\/($|[a-zA-Z0-9\.\,\;\?\''\\\+&%\$#\=~_\-\/]+))*/";
+ regexEmail = "/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/";
+ txtout = "";
+
+ // Process URLs
+
+ [mat_start,mat_end,mat_match] = regexp(txtin,regexUrl);
+
+ if ~isempty(mat_match) then
+ mat_end = [ 0 mat_end ];
+ for i=1:size(mat_match,"*")
+ txtout = txtout + part(txtin,[mat_end(i)+1:mat_start(i)-1]) ..
+ + "<a href="""+mat_match(i)+""" target=""_blank"">" ..
+ + mat_match(i) ..
+ + "</a>";
+ end
+ txtout = txtout + part(txtin,mat_end(size(mat_end,"*"))+1:length(txtin));
+ txtin = txtout;
+ txtout = "";
+ end
+
+ // Process Emails
+
+ [mat_start,mat_end,mat_match] = regexp(txtin,regexEmail);
+
+ if ~isempty(mat_match) then
+ mat_end = [ 0 mat_end ];
+ for i=1:size(mat_match,"*")
+ txtout = txtout + part(txtin,[mat_end(i)+1:mat_start(i)-1]) ..
+ + "<a href=""mailto:"+mat_match(i)+""" target=""_blank"">" ..
+ + mat_match(i) ..
+ + "</a>";
+ end
+ txtout = txtout + part(txtin,mat_end(size(mat_end,"*"))+1:length(txtin));
+ else
+ txtout = txtin;
+ end
+
+endfunction
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH ATOMS -->
+// <-- INTERACTIVE TEST -->
+//
+// <-- Non-regression test for bug 6977 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6977
+//
+// <-- Short Description -->
+// In the presentation frame: Make http entries hyperlinked (with target="_blank").
+// Presently, even a simple selection to copy/paste displayed URLs into the web
+// browser is impossible.
+
+atomsGui();
+
+// Select a module which description conntains an URL or an email.
+// The text should be hyperlinked and the default browser (or email client) should
+// be opened