* Fix several minor html canonicalization problems. FB's chm still gpf's in the index load.

git-svn-id: trunk@13660 -
This commit is contained in:
marco 2009-09-06 17:06:36 +00:00
parent 9da0729d7c
commit 1e5b89049a
2 changed files with 14 additions and 2 deletions

View File

@ -43,6 +43,8 @@ Type
function combinepaths(relpath,basepath:String):String;
function CHMResolve( href: ansistring; var AFileId,ALinkId : longint):boolean;
function stringreplace(const s:ansistring;const oldstr:ansistring; const newstr:ansistring):ansistring;
implementation
var CHMIndex : TStringList; // list to register open CHMs.
@ -292,6 +294,11 @@ begin
end
end;
function stringreplace(const s:ansistring;const oldstr:ansistring; const newstr:ansistring):ansistring;
begin
result:=sysutils.stringreplace(s,oldstr,newstr,[rfreplaceall]);
end;
initialization
ChmIndex:=TStringlist.create;
ChmIndex.sorted:=true;

View File

@ -1346,6 +1346,11 @@ end;
Function TCHMTopicRenderer.CanonicalizeURL(const Base,Relative:String):string;
begin
if copy(relative,1,6)='http:/' then // external links don't need to be fixed since we can't load them.
begin
CanonicalizeUrl:=relative;
exit;
end;
if copy(relative,1,7)<>'ms-its:' then
CanonicalizeUrl:=combinepaths(relative,base)
else
@ -1358,8 +1363,8 @@ begin
{$IFDEF WDEBUG}
DebugMessageS({$i %file%},' chmresolve "'+HRef+'"',{$i %line%},'1',0,0);
{$ENDIF WDEBUG}
resolved:=false;
resolved:=false; AFileID:=0; ALinkID:=0;
href:=stringreplace(href,'%20',' ');
if copy(href,1,7)='ms-its:' then
resolved:=CHMResolve(Href,AFileId,ALinkID);
if not resolved then