Browse Source

* Fixed bug #14858 where chmsitemap could not properly read a file

git-svn-id: trunk@13947 -
andrew 16 years ago
parent
commit
dd72603442
1 changed files with 14 additions and 3 deletions
  1. 14 3
      packages/chm/src/chmsitemap.pas

+ 14 - 3
packages/chm/src/chmsitemap.pas

@@ -124,6 +124,7 @@ type
     FUseFolderImages: Boolean;
     FWindowName: String;
     FLevel: Integer;
+    FLevelForced: Boolean;
     FWindowStyles: LongInt;
     procedure SetItems(const AValue: TChmSiteMapItems);
   protected
@@ -202,7 +203,7 @@ begin
   else begin // looking for /HTML
     if TagName = '/HTML' then Exclude(FSiteMapTags, smtHTML);
   end;}
-  
+
   //if (smtHTML in FSiteMapTags) then begin
      if not (smtBODY in FSiteMapTags) then begin
        if TagName = 'BODY' then Include(FSiteMapTags, smtBODY);
@@ -210,7 +211,7 @@ begin
      else begin
        if TagName = '/BODY' then Exclude(FSiteMapTags, smtBODY);
      end;
-     
+
      if (smtBODY in FSiteMapTags) then begin
        //WriteLn('GOT TAG: ', AActualTag);
        if TagName = 'UL' then begin
@@ -221,16 +222,26 @@ begin
          //WriteLN('Dec Level');
          DecreaseULevel;
        end
+       else if (TagName = 'LI') and (FLevel = 0) then
+         FLevelForced := True
        else if TagName = 'OBJECT' then begin
          Include(FSiteMapBodyTags, smbtOBJECT);
+         if FLevelForced then
+           IncreaseULevel;
          If FLevel > 0 then // if it is zero it is the site properties
            NewSiteMapItem;
        end
        else if TagName = '/OBJECT' then begin
          Exclude(FSiteMapBodyTags, smbtOBJECT);
+         if FLevelForced then
+         begin
+           DecreaseULevel;
+           FLevelForced := False;
+         end;
        end
        else begin // we are the properties of the object tag
-         if (smbtOBJECT in FSiteMapBodyTags) then begin
+         if (FLevel > 0 ) and (smbtOBJECT in FSiteMapBodyTags) then begin
+
            if LowerCase(GetTagName(AActualTag)) = 'param' then begin
 
              TagAttributeName := GetVal(AActualTag, 'name');