mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 06:16:05 +02:00
wiki test: opening external links
git-svn-id: trunk@35856 -
This commit is contained in:
parent
f11f069e84
commit
4945f1f1fe
@ -335,6 +335,7 @@ var
|
||||
|
||||
// normalize link to get the page, e.g. convert spaces to underscores
|
||||
function WikiInternalLinkToPage(Link: string): string;
|
||||
function WikiIsExternalLink(Link: string): boolean;
|
||||
|
||||
function GetWikiPageID(doc: TDOMNode): string;
|
||||
function GetWikiPageID(s: TStream): string;
|
||||
@ -1560,6 +1561,25 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function WikiIsExternalLink(Link: string): boolean;
|
||||
// check if Link starts with a scheme http://
|
||||
var
|
||||
p: PChar;
|
||||
begin
|
||||
Result:=false;
|
||||
if Link='' then exit;
|
||||
p:=PChar(Link);
|
||||
while p^ in ['a'..'z','A'..'Z'] do inc(p);
|
||||
if p=PChar(Link) then exit;
|
||||
if p^<>':' then exit;
|
||||
inc(p);
|
||||
if p^<>'/' then exit;
|
||||
inc(p);
|
||||
if p^<>'/' then exit;
|
||||
inc(p);
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function GetWikiPageID(doc: TDOMNode): string;
|
||||
var
|
||||
Node: TDOMNode;
|
||||
|
@ -26,10 +26,10 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, math, FileUtil, LazLogger, LazUTF8, LazFileUtils, laz2_DOM,
|
||||
Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, LCLIntf,
|
||||
IpHtml, Ipfilebroker, IpMsg,
|
||||
CodeToolManager, CodeCache,
|
||||
WikiHelpManager, WikiSearchOptions;
|
||||
WikiHelpManager, WikiSearchOptions, WikiParser;
|
||||
|
||||
type
|
||||
|
||||
@ -258,6 +258,12 @@ begin
|
||||
//Target := TIpHtmlNodeAREA(HotNode).Target;
|
||||
end;
|
||||
debugln(['TWikiSearchDemoForm.ResultsIpHtmlPanelHotClick href=',href]);
|
||||
if WikiIsExternalLink(HRef) then begin
|
||||
// open external page
|
||||
OpenURL(HRef);
|
||||
exit;
|
||||
end;
|
||||
|
||||
// open page in PageIpHtmlPanel
|
||||
ms:=TMemoryStream.Create;
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user