summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre MARECHAL <pierre.marechal@scilab.org>2010-05-16 21:46:06 +0200
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-05-19 14:26:27 +0200
commit78e7f3ce529a4d9f0901b17badac8ce7badbb5a4 (patch)
treee96cb6673430392de912fc282bb3408667666082
parent6c6315bec3dce92505f7fde38e9d8d597996a83b (diff)
downloadscilab-78e7f3ce529a4d9f0901b17badac8ce7badbb5a4.zip
scilab-78e7f3ce529a4d9f0901b17badac8ce7badbb5a4.tar.gz
bug 6977 fixed: ATOMS GUI: In the presentation frame, URLs and emails were not hyperlinked.
Change-Id: I87ef571dbe049aa4389d21c4f9495f227553cedf
-rw-r--r--scilab/CHANGES_5.3.X3
-rw-r--r--scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci51
-rw-r--r--scilab/modules/atoms/tests/nonreg_tests/bug_6977.tst25
3 files changed, 79 insertions, 0 deletions
diff --git a/scilab/CHANGES_5.3.X b/scilab/CHANGES_5.3.X
index 2cd3093..93806ce 100644
--- a/scilab/CHANGES_5.3.X
+++ b/scilab/CHANGES_5.3.X
@@ -303,6 +303,9 @@ ATOMS:
303 one, the ATOMS GUI claimed that the newest version was 303 one, the ATOMS GUI claimed that the newest version was
304 installed. 304 installed.
305 305
306* bug 6977 fixed - ATOMS GUI: In the presentation frame, URLs and emails were
307 not hyperlinked.
308
306Bug fixes: 309Bug fixes:
307========== 310==========
308 311
diff --git a/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci b/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
index 322ff6ae..f916cf8 100644
--- a/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
+++ b/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
@@ -262,6 +262,9 @@ function updateDescFrame()
262 "</body>" + .. 262 "</body>" + ..
263 "</html>"; 263 "</html>";
264 264
265 // Process URLs and Emails
266 htmlcode = processHTMLLinks(htmlcode);
267
265 // Update the main description 268 // Update the main description
266 set(Desc,"String",htmlcode); 269 set(Desc,"String",htmlcode);
267 270
@@ -425,3 +428,51 @@ function showWarning(msg)
425 set(msgText,"String",str); 428 set(msgText,"String",str);
426 429
427endfunction 430endfunction
431
432// =============================================================================
433// processHTMLLinks
434// + Find URLs and emails
435// + Convert them in HTML
436// =============================================================================
437
438function txtout = processHTMLLinks(txtin)
439
440 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\.\,\;\?\''\\\+&amp;%\$#\=~_\-\/]+))*/";
441 regexEmail = "/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/";
442 txtout = "";
443
444 // Process URLs
445
446 [mat_start,mat_end,mat_match] = regexp(txtin,regexUrl);
447
448 if ~isempty(mat_match) then
449 mat_end = [ 0 mat_end ];
450 for i=1:size(mat_match,"*")
451 txtout = txtout + part(txtin,[mat_end(i)+1:mat_start(i)-1]) ..
452 + "<a href="""+mat_match(i)+""" target=""_blank"">" ..
453 + mat_match(i) ..
454 + "</a>";
455 end
456 txtout = txtout + part(txtin,mat_end(size(mat_end,"*"))+1:length(txtin));
457 txtin = txtout;
458 txtout = "";
459 end
460
461 // Process Emails
462
463 [mat_start,mat_end,mat_match] = regexp(txtin,regexEmail);
464
465 if ~isempty(mat_match) then
466 mat_end = [ 0 mat_end ];
467 for i=1:size(mat_match,"*")
468 txtout = txtout + part(txtin,[mat_end(i)+1:mat_start(i)-1]) ..
469 + "<a href=""mailto:"+mat_match(i)+""" target=""_blank"">" ..
470 + mat_match(i) ..
471 + "</a>";
472 end
473 txtout = txtout + part(txtin,mat_end(size(mat_end,"*"))+1:length(txtin));
474 else
475 txtout = txtin;
476 end
477
478endfunction
diff --git a/scilab/modules/atoms/tests/nonreg_tests/bug_6977.tst b/scilab/modules/atoms/tests/nonreg_tests/bug_6977.tst
new file mode 100644
index 0000000..5d4df80
--- /dev/null
+++ b/scilab/modules/atoms/tests/nonreg_tests/bug_6977.tst
@@ -0,0 +1,25 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Pierre MARECHAL
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- TEST WITH ATOMS -->
9// <-- INTERACTIVE TEST -->
10//
11// <-- Non-regression test for bug 6977 -->
12//
13// <-- Bugzilla URL -->
14// http://bugzilla.scilab.org/show_bug.cgi?id=6977
15//
16// <-- Short Description -->
17// In the presentation frame: Make http entries hyperlinked (with target="_blank").
18// Presently, even a simple selection to copy/paste displayed URLs into the web
19// browser is impossible.
20
21atomsGui();
22
23// Select a module which description conntains an URL or an email.
24// The text should be hyperlinked and the default browser (or email client) should
25// be opened