mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 05:49:23 +02:00
+ New bunch of Gabor's changes: see fixes.txt
This commit is contained in:
parent
369efe46ed
commit
ad755d7fb1
@ -8,7 +8,7 @@ const
|
|||||||
ListIndent = 2;
|
ListIndent = 2;
|
||||||
DefIndent = 4;
|
DefIndent = 4;
|
||||||
|
|
||||||
MaxTopicLinks = 500; { maximum link on a single HTML page }
|
MaxTopicLinks = 5000; { maximum number of links on a single HTML page }
|
||||||
|
|
||||||
type
|
type
|
||||||
PTopicLinkCollection = ^TTopicLinkCollection;
|
PTopicLinkCollection = ^TTopicLinkCollection;
|
||||||
@ -239,20 +239,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THTMLTopicRenderer.DocAnchor(Entered: boolean);
|
procedure THTMLTopicRenderer.DocAnchor(Entered: boolean);
|
||||||
var HRef: string;
|
var HRef,Name: string;
|
||||||
begin
|
begin
|
||||||
if Entered and InAnchor then DocAnchor(false);
|
if Entered and InAnchor then DocAnchor(false);
|
||||||
if Entered then
|
if Entered then
|
||||||
begin
|
begin
|
||||||
if DocGetTagParam('HREF',HRef)=false then HRef:='';
|
if DocGetTagParam('HREF',HRef)=false then HRef:='';
|
||||||
if (HRef<>'') and (copy(HRef,1,1)<>'#') then
|
if DocGetTagParam('NAME',Name)=false then Name:='';
|
||||||
|
if Name<>'' then
|
||||||
begin
|
begin
|
||||||
InAnchor:=true;
|
Topic^.NamedMarks^.InsertStr(Name);
|
||||||
AddChar(hscLink);
|
AddChar(hscNamedMark);
|
||||||
HRef:=CompleteURL(URL,HRef);
|
end else
|
||||||
LinkIndexes[LinkPtr]:=TopicLinks^.AddItem(HRef);
|
if (HRef<>'') then
|
||||||
Inc(LinkPtr);
|
begin
|
||||||
end;
|
InAnchor:=true;
|
||||||
|
AddChar(hscLink);
|
||||||
|
if LinkPtr<MaxTopicLinks then
|
||||||
|
begin
|
||||||
|
HRef:=CompleteURL(URL,HRef);
|
||||||
|
LinkIndexes[LinkPtr]:=TopicLinks^.AddItem(HRef);
|
||||||
|
Inc(LinkPtr);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -573,9 +582,10 @@ function TCustomHTMLHelpFile.ReadTopic(T: PTopic): boolean;
|
|||||||
var OK: boolean;
|
var OK: boolean;
|
||||||
HTMLFile: PMemoryTextFile;
|
HTMLFile: PMemoryTextFile;
|
||||||
Name: string;
|
Name: string;
|
||||||
Link: string;
|
Link,Bookmark: string;
|
||||||
P: sw_integer;
|
P: sw_integer;
|
||||||
begin
|
begin
|
||||||
|
Bookmark:='';
|
||||||
OK:=T<>nil;
|
OK:=T<>nil;
|
||||||
if OK then
|
if OK then
|
||||||
begin
|
begin
|
||||||
@ -583,7 +593,12 @@ begin
|
|||||||
begin
|
begin
|
||||||
Link:=TopicLinks^.At((T^.HelpCtx and $ffff)-1)^;
|
Link:=TopicLinks^.At((T^.HelpCtx and $ffff)-1)^;
|
||||||
Link:=FormatPath(Link);
|
Link:=FormatPath(Link);
|
||||||
P:=Pos('#',Link); if P>0 then Delete(Link,P,255);
|
P:=Pos('#',Link);
|
||||||
|
if P>0 then
|
||||||
|
begin
|
||||||
|
Bookmark:=copy(Link,P+1,length(Link));
|
||||||
|
Link:=copy(Link,1,P-1);
|
||||||
|
end;
|
||||||
{ if CurFileName='' then Name:=Link else
|
{ if CurFileName='' then Name:=Link else
|
||||||
Name:=CompletePath(CurFileName,Link);}
|
Name:=CompletePath(CurFileName,Link);}
|
||||||
Name:=Link;
|
Name:=Link;
|
||||||
@ -601,6 +616,10 @@ begin
|
|||||||
OK:=Renderer^.BuildTopic(T,Name,HTMLFile,TopicLinks);
|
OK:=Renderer^.BuildTopic(T,Name,HTMLFile,TopicLinks);
|
||||||
if OK then CurFileName:=Name;
|
if OK then CurFileName:=Name;
|
||||||
if HTMLFile<>nil then Dispose(HTMLFile, Done);
|
if HTMLFile<>nil then Dispose(HTMLFile, Done);
|
||||||
|
if BookMark='' then
|
||||||
|
T^.StartNamedMark:=0
|
||||||
|
else
|
||||||
|
T^.StartNamedMark:=T^.GetNamedMarkIndex(BookMark)+1;
|
||||||
end;
|
end;
|
||||||
ReadTopic:=OK;
|
ReadTopic:=OK;
|
||||||
end;
|
end;
|
||||||
|
@ -134,6 +134,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomHTMLLinkScanner.DocAnchor(Entered: boolean);
|
procedure TCustomHTMLLinkScanner.DocAnchor(Entered: boolean);
|
||||||
|
var P: sw_integer;
|
||||||
begin
|
begin
|
||||||
if Entered then
|
if Entered then
|
||||||
begin
|
begin
|
||||||
@ -398,10 +399,14 @@ end;
|
|||||||
|
|
||||||
procedure THTMLFileLinkScanner.AddLink(const LinkText, LinkURL: string);
|
procedure THTMLFileLinkScanner.AddLink(const LinkText, LinkURL: string);
|
||||||
var D: PHTMLLinkScanFile;
|
var D: PHTMLLinkScanFile;
|
||||||
|
P: sw_integer;
|
||||||
|
DocURL: string;
|
||||||
begin
|
begin
|
||||||
D:=DocumentFiles^.SearchFile(LinkURL);
|
P:=Pos('#',LinkURL);
|
||||||
|
if P=0 then DocURL:=LinkURL else DocURL:=copy(LinkURL,1,P-1);
|
||||||
|
D:=DocumentFiles^.SearchFile(DocURL);
|
||||||
if Assigned(D)=false then
|
if Assigned(D)=false then
|
||||||
ScheduleDoc(LinkURL);
|
ScheduleDoc(DocURL);
|
||||||
inherited AddLink(LinkText,LinkURL);
|
inherited AddLink(LinkText,LinkURL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -444,7 +449,10 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2000-05-17 08:49:16 pierre
|
Revision 1.6 2000-05-29 11:09:14 pierre
|
||||||
|
+ New bunch of Gabor's changes: see fixes.txt
|
||||||
|
|
||||||
|
Revision 1.5 2000/05/17 08:49:16 pierre
|
||||||
readded
|
readded
|
||||||
|
|
||||||
Revision 1.1 2000/04/25 08:42:32 pierre
|
Revision 1.1 2000/04/25 08:42:32 pierre
|
||||||
|
@ -40,6 +40,7 @@ type
|
|||||||
procedure FreeItem(Item: Pointer); virtual;
|
procedure FreeItem(Item: Pointer); virtual;
|
||||||
function GetItem(var S: TStream): Pointer; virtual;
|
function GetItem(var S: TStream): Pointer; virtual;
|
||||||
procedure PutItem(var S: TStream; Item: Pointer); virtual;
|
procedure PutItem(var S: TStream; Item: Pointer); virtual;
|
||||||
|
procedure InsertStr(const S: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PNulStream = ^TNulStream;
|
PNulStream = ^TNulStream;
|
||||||
@ -530,6 +531,11 @@ begin
|
|||||||
ALines^.ForEach(@AddIt);
|
ALines^.ForEach(@AddIt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TUnsortedStringCollection.InsertStr(const S: string);
|
||||||
|
begin
|
||||||
|
Insert(NewStr(S));
|
||||||
|
end;
|
||||||
|
|
||||||
function TUnsortedStringCollection.At(Index: Integer): PString;
|
function TUnsortedStringCollection.At(Index: Integer): PString;
|
||||||
begin
|
begin
|
||||||
At:=inherited At(Index);
|
At:=inherited At(Index);
|
||||||
@ -733,16 +739,30 @@ var P: integer;
|
|||||||
Drive: string[20];
|
Drive: string[20];
|
||||||
IsComplete: boolean;
|
IsComplete: boolean;
|
||||||
S: string;
|
S: string;
|
||||||
|
Ref: string;
|
||||||
|
Bookmark: string;
|
||||||
begin
|
begin
|
||||||
IsComplete:=false;
|
IsComplete:=false; Ref:=URLRef;
|
||||||
P:=Pos(':',URLRef);
|
P:=Pos(':',Ref);
|
||||||
if P=0 then Drive:='' else Drive:=UpcaseStr(copy(URLRef,1,P-1));
|
if P=0 then Drive:='' else Drive:=UpcaseStr(copy(Ref,1,P-1));
|
||||||
if Drive<>'' then
|
if Drive<>'' then
|
||||||
if (Drive='MAILTO') or (Drive='FTP') or (Drive='HTTP') or
|
if (Drive='MAILTO') or (Drive='FTP') or (Drive='HTTP') or
|
||||||
(Drive='GOPHER') or (Drive='FILE') then
|
(Drive='GOPHER') or (Drive='FILE') then
|
||||||
IsComplete:=true;
|
IsComplete:=true;
|
||||||
if IsComplete then S:=URLRef else
|
if IsComplete then S:=Ref else
|
||||||
S:=CompletePath(Base,URLRef);
|
begin
|
||||||
|
P:=Pos('#',Ref);
|
||||||
|
if P=0 then
|
||||||
|
Bookmark:=''
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Bookmark:=copy(Ref,P+1,length(Ref));
|
||||||
|
Ref:=copy(Ref,1,P-1);
|
||||||
|
end;
|
||||||
|
S:=CompletePath(Base,Ref);
|
||||||
|
if Bookmark<>'' then
|
||||||
|
S:=S+'#'+Bookmark;
|
||||||
|
end;
|
||||||
CompleteURL:=S;
|
CompleteURL:=S;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -889,7 +909,10 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2000-05-02 08:42:29 pierre
|
Revision 1.22 2000-05-29 11:09:14 pierre
|
||||||
|
+ New bunch of Gabor's changes: see fixes.txt
|
||||||
|
|
||||||
|
Revision 1.21 2000/05/02 08:42:29 pierre
|
||||||
* new set of Gabor changes: see fixes.txt
|
* new set of Gabor changes: see fixes.txt
|
||||||
|
|
||||||
Revision 1.20 2000/04/25 08:42:36 pierre
|
Revision 1.20 2000/04/25 08:42:36 pierre
|
||||||
|
Loading…
Reference in New Issue
Block a user