mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 11:00:32 +02:00
wiki: internal links with anchors
git-svn-id: trunk@35892 -
This commit is contained in:
parent
1ae66cb238
commit
cc9350c2d2
@ -214,6 +214,8 @@ var
|
||||
Node: TDOMElement;
|
||||
TargetPage: TW2XHTMLPage;
|
||||
FoundImgFile: String;
|
||||
DocumentName: String;
|
||||
Anchor: String;
|
||||
begin
|
||||
Result:=false;
|
||||
if LinkToken.Token=wptExternLink then exit;
|
||||
@ -277,10 +279,20 @@ var
|
||||
|
||||
// default: a page
|
||||
if URL<>'' then begin
|
||||
Filename:=PageToFilename(URL,true,false);
|
||||
p:=Pos('#',URL);
|
||||
if p<1 then begin
|
||||
DocumentName:=URL;
|
||||
Anchor:='';
|
||||
end else begin
|
||||
DocumentName:=LeftStr(URL,p-1);
|
||||
Anchor:=copy(URL,p+1,length(URL));
|
||||
end;
|
||||
Filename:=PageToFilename(DocumentName,true,false);
|
||||
TargetPage:=TW2XHTMLPage(ShortFilenameToPage[Filename]);
|
||||
if (TargetPage<>nil) then begin
|
||||
URL:=GetPageLink(TargetPage);
|
||||
if Anchor<>'' then
|
||||
URL+='#'+Anchor;
|
||||
end else if (not FileExistsUTF8(Filename)) then begin
|
||||
if WarnMissingPageLinks and WarnURL(LinkToken.Link) then
|
||||
Log('WARNING: TWiki2XHTMLConverter.InsertLink "'+dbgstr(LinkToken.Link)+'": file not found: "'+Filename+'" at '+W.PosToStr(LinkToken.LinkStartPos,true));
|
||||
|
@ -1536,7 +1536,7 @@ begin
|
||||
case Result[i] of
|
||||
' ',#9:
|
||||
Result[i]:='_';
|
||||
#0..#8,#10..#31,'#','$','[',']','{','}','<','>':
|
||||
#0..#8,#10..#31,'$','[',']','{','}','<','>':
|
||||
Delete(Result,i,1);
|
||||
'%':
|
||||
begin
|
||||
|
@ -290,6 +290,7 @@ begin
|
||||
WikiHelp.ImagesDirectory:=SetDirSeparators('../images');
|
||||
WikiHelp.Converter.OutputDir:='';
|
||||
WikiHelp.Converter.CSSFilename:='wiki.css';
|
||||
WikiHelp.Converter.WarnMissingPageLinks:=true;
|
||||
WikiHelp.OnScanned:=@WikiHelpScanned;
|
||||
WikiHelp.OnSearched:=@WikiHelpSearched;
|
||||
WikiHelp.ResultsCSSURL:='wiki.css';
|
||||
|
Loading…
Reference in New Issue
Block a user