mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 04:29:31 +02:00
Small fix by Andrey to fix links
git-svn-id: trunk@48269 -
This commit is contained in:
parent
d83e1a33ca
commit
79f2398e6a
@ -257,7 +257,7 @@ Type
|
|||||||
FPageInfos: TFPObjectList; // list of TPageInfo objects
|
FPageInfos: TFPObjectList; // list of TPageInfo objects
|
||||||
FLinkUnresolvedCnt: Integer;
|
FLinkUnresolvedCnt: Integer;
|
||||||
function GetPageCount: Integer;
|
function GetPageCount: Integer;
|
||||||
|
function LinkFix(ALink:String):String;
|
||||||
Protected
|
Protected
|
||||||
FAllocator: TFileAllocator;
|
FAllocator: TFileAllocator;
|
||||||
Procedure LinkUnresolvedInc();
|
Procedure LinkUnresolvedInc();
|
||||||
@ -431,24 +431,13 @@ end;
|
|||||||
|
|
||||||
function TMultiFileDocWriter.ResolveLinkID(const Name: String): DOMString;
|
function TMultiFileDocWriter.ResolveLinkID(const Name: String): DOMString;
|
||||||
var
|
var
|
||||||
res,s: String;
|
res: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
res:=Engine.ResolveLink(Module,Name, True);
|
res:=Engine.ResolveLink(Module,Name, True);
|
||||||
// engine can return backslashes on Windows
|
// engine can return backslashes on Windows
|
||||||
if Length(res) > 0 then
|
res:= LinkFix(res);
|
||||||
begin
|
Result:=UTF8Decode(res);
|
||||||
s:=Copy(Res, 1, Length(CurDirectory) + 1);
|
|
||||||
if (S= CurDirectory + '/') or (s= CurDirectory + '\') then
|
|
||||||
begin
|
|
||||||
// TODO: I didn`t see a call to this code on a processing the lcl ana lazutil. What is that?
|
|
||||||
Res := Copy(Res, Length(CurDirectory) + 2, Length(Res));
|
|
||||||
//writeLn('INFO: ResolveLinkID "\" - ', Res);
|
|
||||||
end
|
|
||||||
else if not IsLinkAbsolute(Res) then
|
|
||||||
Res := BaseDirectory + Res;
|
|
||||||
end;
|
|
||||||
Result:=UTF8Decode(Res);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMultiFileDocWriter.ResolveLinkIDUnStrict(const Name: String
|
function TMultiFileDocWriter.ResolveLinkIDUnStrict(const Name: String
|
||||||
@ -474,9 +463,27 @@ begin
|
|||||||
// have cut last element
|
// have cut last element
|
||||||
res:= Engine.ResolveLink(Module, Copy(Name, 1, IdLast-1), True);
|
res:= Engine.ResolveLink(Module, Copy(Name, 1, IdLast-1), True);
|
||||||
end;
|
end;
|
||||||
|
res:= LinkFix(res);
|
||||||
Result:=UTF8Decode(res);
|
Result:=UTF8Decode(res);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMultiFileDocWriter.LinkFix(ALink: String): String;
|
||||||
|
var
|
||||||
|
res, s:String;
|
||||||
|
begin
|
||||||
|
res:= ALink;
|
||||||
|
if Length(res) > 0 then
|
||||||
|
begin
|
||||||
|
// If the link is in the same directory as current dir, then remove the directory part.
|
||||||
|
s:=Copy(res, 1, Length(CurDirectory) + 1);
|
||||||
|
if (S= CurDirectory + '/') or (s= CurDirectory + '\') then
|
||||||
|
res := Copy(res, Length(CurDirectory) + 2, Length(res))
|
||||||
|
else if not IsLinkAbsolute(res) then
|
||||||
|
res := BaseDirectory + res;
|
||||||
|
end;
|
||||||
|
Result:= res;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Used for:
|
{ Used for:
|
||||||
- <link> elements in descriptions
|
- <link> elements in descriptions
|
||||||
- "see also" entries
|
- "see also" entries
|
||||||
|
Loading…
Reference in New Issue
Block a user