Bladeren bron

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

git-svn-id: trunk@13660 -
marco 16 jaren geleden
bovenliggende
commit
1e5b89049a
2 gewijzigde bestanden met toevoegingen van 14 en 2 verwijderingen
  1. 7 0
      ide/wchmhwrap.pas
  2. 7 2
      ide/whtmlhlp.pas

+ 7 - 0
ide/wchmhwrap.pas

@@ -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;

+ 7 - 2
ide/whtmlhlp.pas

@@ -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