Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/HTMLCreate.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4.2.6 by h677, Tue Nov 1 17:05:35 2005 UTC revision 1.4.2.7 by h677, Wed Nov 2 18:10:55 2005 UTC
# Line 43  type Line 43  type
43                  function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;                  function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
44                  function SkinedRes(skin: string; Res: TResRec; No: string): string;                  function SkinedRes(skin: string; Res: TResRec; No: string): string;
45                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;                  function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
                 function ConvRes(const Body, Bbs, Key,  ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;  
46                  procedure CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
47                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);                  procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
48          end;          end;
# Line 326  function THTMLCreate.ConvRes(const Body, Line 325  function THTMLCreate.ConvRes(const Body,
325  const  const
326          GT      = '>';          GT      = '>';
327          SN      = '0123456789';          SN      = '0123456789';
         ZN      = '0123456789';  
328          FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';          FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
329  var  var
330          i : integer;          i : integer;
# Line 341  var Line 339  var
339          token : array[0..5] of string;          token : array[0..5] of string;
340          ch : string;          ch : string;
341          db : boolean;          db : boolean;
342            len : integer;
343  begin  begin
344          //s に本文を全部入れる          //s に本文を全部入れる
345          s        :=     Body;          s        :=     Body;
# Line 356  begin Line 354  begin
354          token[5] := '<A ';          token[5] := '<A ';
355    
356          //          //
357          while Length(s) > 0 do begin          while Length(s) > 2 do begin
358                  pmin := Length(s) + 1;                  pmin := Length(s) + 1;
359                  i       := length(token);                  i       := Length(token);
360                  for j := 0 to length(token) - 1 do begin                  for j := 0 to Length(token) - 1 do begin
361                          pos := AnsiPos(token[j], s);                          pos := AnsiPos(token[j], s);
362                          if pos <> 0 then begin                          if pos <> 0 then begin
363                                  if pos < pmin then begin                                  if pos < pmin then begin
# Line 375  begin Line 373  begin
373                  Result := Result + Copy(s, 1, pmin - 1);                  Result := Result + Copy(s, 1, pmin - 1);
374                  Delete(s, 1, pmin - 1);                  Delete(s, 1, pmin - 1);
375    
376                  if i = length(token) then begin                  if i = 6 then begin
377                          //ヒットなし                          //ヒットなし
378                  end else if (i = 4) or (i = 5) then begin                  end else if (i = 4) or (i = 5) then begin
379                          //'<a ' or '<A' でヒット '</a>' or '</A>' までコピー                          //'<a ' or '<A' でヒット '</a>' or '</A>' までコピー
# Line 397  begin Line 395  begin
395                          No := '';                          No := '';
396                          sw := false;                          sw := false;
397                          db := false;                          db := false;
398                          while j <= Length(s) do begin                          len := Length(s);
399                            while j <= len do begin
400                                  if (ByteType(s, j) = mbSingleByte) then begin                                  if (ByteType(s, j) = mbSingleByte) then begin
401                                          //1byte文字                                          //1byte文字
402                                          ch := s[j];                                          ch := s[j];
# Line 410  begin Line 409  begin
409                                          db := true;                                          db := true;
410                                  end;                                  end;
411    
412                                  if AnsiPos(ch, SN) > 0 then begin                                  if System.Pos(ch, SN) > 0 then begin
413                                          No := No + ch;                                          No := No + ch;
414                                  end else if (ch = '-') then begin                                  end else if (ch = '-') then begin
415                                          if sw then break;                                          if sw then break;
# Line 421  begin Line 420  begin
420                                  end;                                  end;
421                          end;                          end;
422                          //終端まで行っての終了かチェック                          //終端まで行っての終了かチェック
423                          if j <= Length(s) then begin                          if j <= len then begin
424                                  if db then j := j - 2                                  if db then j := j - 2
425                                  else j := j - 1;                                  else j := j - 1;
426                          end;                          end;
# Line 433  begin Line 432  begin
432    
433                                  if not DatToHTML then begin                                  if not DatToHTML then begin
434                                          Result := Result + Format(FORMAT_LINK,                                          Result := Result + Format(FORMAT_LINK,
435                                                                  [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue])                                                                  [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
                                                         + Copy(s, 1, j - 1) + '</a>';  
436                                  end else begin                                  end else begin
437                                          Result := Result + Format('<a href="#%s">', [st])                                          Result := Result + Format('<a href="#%s">', [st]);
                                                         + Copy(s, 1, j - 1) + '</a>';  
438                                  end;                                  end;
439                                    Result := Result + Copy(s, 1, j - 1) + '</a>';
440                          end;                          end;
441                          Delete(s, 1, j - 1);                          Delete(s, 1, j - 1);
442                  end;                  end;
443          end;          end;
444  end;          Result := Result + s;
 {  
 function THTMLCreate.ConvRes(const Body, Bbs, Key,  
         ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;  
         DatToHTML: boolean = false): string;  
 type  
         PIndex = ^TIndex;  
         TIndex = record  
                 FIndexFrom      : integer;  
                 FIndexTo                : integer;  
                 FNo                              : string;  
         end;  
 const  
         GT      = '&gt;';  
         SN      = '0123456789-';  
         ZN      = '0123456789−';  
         FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';  
 var  
         i : integer;  
         s : string;  
         b : TMbcsByteType;  
         sw: boolean;  
         sp: integer;  
         No: string;  
         sx: string;  
         List: TList;  
         oc      : string;  
         st, et: string;  
         chk : boolean;  
         al : boolean;  
         procedure Add(IndexFrom, IndexTo: integer; const No: string);  
         var  
                 FIndex : PIndex;  
         begin  
                 New(FIndex);  
                 FIndex.FIndexFrom       := IndexFrom;  
                 FIndex.FIndexTo         := IndexTo;  
                 FIndex.FNo                               := No;  
                 List.Add(FIndex);  
         end;  
         procedure separateNumber(var st: String; var et: String; const Text, Separator: String);  
         var  
                 p : Integer;  
         begin  
                 p := Pos(Separator, Text);  
                 if (p > 0 ) then begin  
                         st := Copy(Text, 1, p - 1);  
                         et := Copy(Text, p + Length(Separator), Length(Text));  
                 end else begin  
                         st := Text;  
                         et := Text;  
                 end;  
         end;  
 begin  
         s        :=     Body;  
         Result   :=     Body;  
         i        :=     1;  
         sw      :=      False;  
         No      :=      '';  
         List:=  TList.Create;  
         oc      :=      '';  
         sp      :=      0;  
         chk :=  False;  
         al      :=      False;  
         while true      do      begin  
                 b :=    ByteType(s, i);  
                 case    b of  
                         mbSingleByte    : begin  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (Pos('<A HREF', oc) = 0) then   begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (Pos('<A HREF', oc) = 1) then   begin  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,4) = GT) then    begin  
                                         if      (Pos('<A HREF', oc) = 0) then   begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 3;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      ((not sw) and (Copy(s,i,1) = ',')) or  
                                                 ((not sw) and (Copy(s,i,1) = '=')) then begin  
                                         if      ((not Chk) and (oc = '</A>')) or  
                                                         ((Chk) and      (oc = '')) or  
                                                         ((not Chk) and (al)) then  
                                         begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 oc:='';  
                                         end;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,1);  
                                         if      (AnsiPos(sx, SN) > 0)   then    begin  
                                                 No      :=      No      + sx;  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')       then   begin  
                                                         Add(sp, i, No);  
                                                         al := True;  
                                                 end;  
                                                 sw      :=      False;  
                                                 Dec(i);  
                                                 No      := '';  
                                                 oc:='';  
                                         end;  
                                 end else begin  
                                         if      Copy(s,i,1) = '<' then  begin  
                                                 oc      :=      '<';  
                                         end else begin  
                                                 oc      :=      oc + AnsiUpperCase(Copy(s,i,1));  
                                         end;  
                                         chk :=  False;  
                                         al      :=      False;  
                                 end;  
                         end;  
                         mbLeadByte      : begin  
                                 if      (not sw) and (Copy(s,i,4) = '>>') then        begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 3;  
                                         chk :=  True;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,2) = '>') then  begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         Inc(i);  
                                         chk :=  True;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,2);  
                                         if      (AnsiPos(sx, ZN) > 0)   then    begin  
                                                 No      :=      No      + ZenToHan(sx);  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')      and (No <> '−') then   begin  
                                                         Add(sp, i, No);  
                                                 end;  
                                                 sw      :=      False;  
                                                 Dec(i);  
                                                 No      :=      '';  
                                         end;  
                                 end else begin  
                                         oc      :=      '';  
                                         chk :=  False;  
                                 end;  
                                 al      :=      False;  
                         end;  
                 end;  
                 inc(i);  
                 if      (i > Length(Body))      then    begin  
                         if      (sw)    then    begin  
                                 if      (No <> '')      then    Add(sp, i, No);  
                         end;  
                         Break;  
                 end;  
         end;  
         for i :=        List.Count - 1  downto  0 do    begin  
                 separateNumber(st, et, PIndex(List[i]).FNo, '-');  
                 if not DatToHTML then  
                         Result :=       Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format(FORMAT_LINK, [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +  
                                         Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(Result,PIndex(List[i]).FIndexTo,Length(Result))  
                 else  
                         Result :=       Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format('<a href="#%s">', [st]) +  
                                         Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));  
   
                 Dispose(PIndex(List[i]));  
         end;  
         List.Free;  
 end;  
 }  
 function THTMLCreate.ConvRes(  
         const Body, Bbs, Key, ParamBBS, ParamKey,  
         ParamStart, ParamTo, ParamNoFirst,  
         ParamTrue, FullURL : string  
 ): string;  
 type  
         PIndex = ^TIndex;  
         TIndex = record  
                 FIndexFrom      : integer;  
                 FIndexTo                : integer;  
                 FNo                              : string;  
         end;  
 const  
         GT      = '&gt;';  
         SN      = '0123456789-';  
         ZN      = '0123456789−';  
 var  
         i : integer;  
         s : string;  
         b : TMbcsByteType;  
         sw: boolean;  
         sp: integer;  
         No: string;  
         sx: string;  
         List: TList;  
         oc      : string;  
         st, et: string;  
         chk : boolean;  
         al : boolean;  
         procedure Add(IndexFrom, IndexTo: integer; const No: string);  
         var  
                 FIndex : PIndex;  
         begin  
                 New(FIndex);  
                 FIndex.FIndexFrom       := IndexFrom;  
                 FIndex.FIndexTo         := IndexTo;  
                 FIndex.FNo                               := No;  
                 List.Add(FIndex);  
         end;  
         function ChooseString(const Text, Separator: string; Index: integer): string;  
         var  
                 S : string;  
                 i, p : integer;  
         begin  
                 S :=    Text;  
                 for i :=        0 to    Index - 1 do    begin  
                         if      (AnsiPos(Separator, S) = 0) then        S :=    ''  
                         else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));  
                 end;  
                 p :=    AnsiPos(Separator, S);  
                 if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;  
         end;  
 begin  
         { v1.0 b2 - 03 }  
         s        :=     Body;  
         Result   :=     Body;  
         i        :=     1;  
         sw      :=      False;  
         No      :=      '';  
         List:=  TList.Create;  
         oc      :=      '';  
         sp      :=      0;  
         chk :=  False;  
         al      :=      False;  
         while true      do      begin  
                 b :=    ByteType(s, i);  
                 case b of  
                         mbSingleByte    : begin  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then    begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin  
                                         if      (Pos('<A HREF', AnsiUpperCase(oc)) = 1) then    begin  
                                                 i :=    i + 7;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,4) = GT) then    begin  
                                         if      (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then    begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 i :=    i + 3;  
                                                 oc:='';  
                                                 chk :=  True;  
                                         end;  
                                 end else  
                                 if      ((not sw) and (Copy(s,i,1) = ',')) or  
                                                 ((not sw) and (Copy(s,i,1) = '=')) then begin  
                                         if      ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or  
                                                         ((Chk) and      (oc = '')) or  
                                                         ((not Chk) and (al)) then  
                                         begin  
                                                 sw      :=      True;  
                                                 sp      :=      i;  
                                                 //i :=  i + 1;  
                                                 oc:='';  
                                         end;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,1);  
                                         if      (Pos(sx, SN) > 0)       then    begin  
                                                 No      :=      No      + sx;  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')       then   begin  
                                                         Add(sp, i, No);  
                                                         al := True;  
                                                 end;  
                                                 sw      :=      False;  
                                                 //  
                                                 i := i - 1;  
                                                 //  
                                                 No      := '';  
                                                 oc:='';  
                                                 //chk :=        False;  
                                         end;  
                                 end else begin  
                                         if      Copy(s,i,1) = '<' then  oc      :=      '';  
                                         oc      :=      oc + Copy(s,i,1);  
                                         chk :=  False;  
                                         al      :=      False;  
                                 end;  
                         end;  
                         mbLeadByte      : begin  
                                 if      (not sw) and (Copy(s,i,4) = '>>') then        begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 3;  
                                         chk :=  True;  
                                 end else  
                                 if      (not sw) and (Copy(s,i,2) = '>') then  begin  
                                         sw      :=      True;  
                                         sp      :=      i;  
                                         i :=    i + 1;  
                                         chk :=  True;  
                                 end else  
                                 if      (sw) then begin  
                                         sx      :=      Copy(s,i,2);  
                                         if      (AnsiPos(sx, ZN) > 0)   then    begin  
                                                 No      :=      No      + ZenToHan(sx);  
                                         end else begin  
                                                 if      (No <> '') and (No <> '-')      and (No <> '−') then   begin  
                                                         Add(sp, i, No);  
                                                 end;  
                                                 sw      :=      False;  
                                                 i := i - 1;  
                                                 No      :=      '';  
                                         end;  
                                 end else begin  
                                         oc      :=      '';  
                                         chk :=  False;  
                                 end;  
                                 al      :=      False;  
                         end;  
                 end;  
                 inc(i);  
                 if      (i > Length(Body))      then    begin  
                         if      (sw)    then    begin  
                                 if      (No <> '')      then    Add(sp, i, No);  
                         end;  
                         Break;  
                 end;  
         end;  
         for i :=        List.Count - 1  downto  0 do    begin  
                 if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin  
                         st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);  
                         et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);  
                 end else begin  
                         st      :=      PIndex(List[i]).FNo;  
                         et      :=      PIndex(List[i]).FNo;  
                 end;  
                 Result :=       Copy(Result,0, PIndex(List[i]).FIndexFrom - 1) +  
                                         Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',  
                                                                 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +  
                                         Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +  
                                         Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));  
                 Dispose(PIndex(List[i]));  
         end;  
         List.Free;  
445  end;  end;
446    
447  function THTMLCreate.ConvertResAnchor(res: string): string;  function THTMLCreate.ConvertResAnchor(res: string): string;
# Line 881  begin Line 509  begin
509                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
510                          html.BeginUpdate;                          html.BeginUpdate;
511                          try                          try
                                 //doc.open;  
512                                  // ヘッダ                                  // ヘッダ
                                 //doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),  
513                                  html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),                                  html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
514                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
                                 //      '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );  
                                 //doc.Write('<p id="idSearch"></p>' + #13#10 );  
515                                  html.Add('<p id="idSearch"></p>');                                  html.Add('<p id="idSearch"></p>');
516                                  for i := 0 to threadItem.Count - 1 do begin                                  for i := 0 to threadItem.Count - 1 do begin
517                                          // 1 は必ず表示                                          // 1 は必ず表示
# Line 911  begin Line 535  begin
535                                                  try                                                  try
536                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
537                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinNewmarkFileName ) then
                                                                         //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )  
538                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
539                                                                  else                                                                  else
540                                                                          //doc.Write( '<a name="new"></a>' + #13#10 );                                                                          //doc.Write( '<a name="new"></a>' + #13#10 );
541                                                                          html.Append( '<a name="new"></a>' );                                                                          html.Append( '<a name="new"></a>' );
542                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
                                                                 //doc.Write('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);  
543                                                                  html.Append('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');                                                                  html.Append('<a name="new"></a><div class="new">新着レス <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
544                                                          end else begin                                                          end else begin
                                                                 //doc.Write('</dl>');  
545                                                                  html.Append('</dl>');                                                                  html.Append('</dl>');
                                                                 //doc.Write('<a name="new"></a>');  
546                                                                  html.Append('<a name="new"></a>');                                                                  html.Append('<a name="new"></a>');
                                                                 //doc.Write('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');  
547                                                                  html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');                                                                  html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>新着レス ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
                                                                 //doc.Write('<dl> + #13#10');  
548                                                                  html.Append('<dl>');                                                                  html.Append('<dl>');
549                                                          end;                                                          end;
550                                                  except                                                  except
                                                         //doc.Write( '<a name="new"></a>' + #13#10);  
551                                                          html.Append( '<a name="new"></a>');                                                          html.Append( '<a name="new"></a>');
552                                                  end;                                                  end;
553                                          end;                                          end;
554    
555                                          // レス                                          // レス
                                         //doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );  
556                                          html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );                                          html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
557    
558                                          if ThreadItem.Kokomade = (i + 1) then begin                                          if ThreadItem.Kokomade = (i + 1) then begin
# Line 944  begin Line 560  begin
560                                                  try                                                  try
561                                                          if GikoSys.Setting.UseSkin then begin                                                          if GikoSys.Setting.UseSkin then begin
562                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                                  if FileExists( GikoSys.GetSkinBookmarkFileName ) then
                                                                         //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )  
563                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )                                                                          html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
564                                                                  else                                                                  else
                                                                         //doc.Write( '<a name="koko"></a>' + #13#10 );  
565                                                                          html.Append( '<a name="koko"></a>' );                                                                          html.Append( '<a name="koko"></a>' );
566                                                          end else if GikoSys.Setting.UseCSS then begin                                                          end else if GikoSys.Setting.UseCSS then begin
                                                                 //doc.Write('<a name="koko"></a><div class="koko">ココまで読んだ</div>' + #13#10 );  
567                                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>' );                                                                  html.Append('<a name="koko"></a><div class="koko">ココまで読んだ</div>' );
568                                                          end else begin                                                          end else begin
                                                                 //doc.Write('</dl>');  
569                                                                  html.Append('</dl>');                                                                  html.Append('</dl>');
                                                                 //doc.Write('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');  
570                                                                  html.Append('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');                                                                  html.Append('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>ココまで読んだ</b></font></td></tr></table>');
                                                                 //doc.Write('<dl>' + #13#10 );  
571                                                                  html.Append('<dl>' );                                                                  html.Append('<dl>' );
572                                                          end;                                                          end;
573                                                  except                                                  except
                                                         //doc.Write( '<a name="koko"></a>' + #13#10 );  
574                                                          html.Append( '<a name="koko"></a>' );                                                          html.Append( '<a name="koko"></a>' );
575                                                  end;                                                  end;
576                                          end;                                          end;
# Line 969  begin Line 578  begin
578    
579    
580                                  // スキン(フッタ)                                  // スキン(フッタ)
                                 //doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );  
581                                  html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );                                  html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
582                          finally                          finally
                                 //doc.Close;  
583                                  html.EndUpdate;                                  html.EndUpdate;
584                          end;                          end;
585    
# Line 993  var Line 600  var
600          SkinNewRes: string;          SkinNewRes: string;
601          SkinRes: string;          SkinRes: string;
602          strTmp : string;          strTmp : string;
603          function ReplaceRes( skin: string ): string;          threadKey : string;
         begin  
                 Result := SkinedRes( skin, Res, No );  
         end;  
604  begin  begin
605          if ThreadItem <> nil then begin          if ThreadItem <> nil then begin
606                  // スキン使用                  // スキン使用
# Line 1005  begin Line 609  begin
609                          // フォントやサイズの設定                          // フォントやサイズの設定
610                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;                          UserOptionalStyle := GikoSys.SetUserOptionalStyle;
611                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;                          CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
612                          //doc.open;  
613                            threadKey := ChangeFileExt(ThreadItem.FileName, '');
614                          html.BeginUpdate;                          html.BeginUpdate;
615                          try                          try
616                                  //doc.charset := 'Shift_JIS';                                  //doc.charset := 'Shift_JIS';
# Line 1016  begin Line 621  begin
621                                          if Length( UserOptionalStyle ) > 0 then                                          if Length( UserOptionalStyle ) > 0 then
622                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',                                                  SkinHeader := CustomStringReplace( SkinHeader, '</head>',
623                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');                                                          '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
                                         //doc.Write( SkinHeader + #13#10);  
624                                          html.Append( SkinHeader);                                          html.Append( SkinHeader);
625                                  except                                  except
626                                  end;                                  end;
# Line 1031  begin Line 635  begin
635                                  except                                  except
636                                  end;                                  end;
637    
                                 //doc.Write('<p id="idSearch"></p>' + #13#10);  
638                                  html.Append('<p id="idSearch"></p>');                                  html.Append('<p id="idSearch"></p>');
                                 //doc.Write('<a name="top"></a>' + #13#10);  
639                                  html.Append('<a name="top"></a>');                                  html.Append('<a name="top"></a>');
640    
641                                  for i := 0 to ReadList.Count - 1 do begin                                  for i := 0 to ReadList.Count - 1 do begin
# Line 1052  begin Line 654  begin
654                                                                  Continue;                                                                  Continue;
655                                                  end;                                                  end;
656                                          end;                                          end;
   
657                                          // 新着マーク                                          // 新着マーク
658                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin                                          if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
659                                                  try                                                  try
660                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinNewmarkFileName ) then
                                                                 //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size )  + #13#10)  
661                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
662                                                          else                                                          else
                                                                 //doc.Write( '<a name="new"></a>' + #13#10 );  
663                                                                  html.Append( '<a name="new"></a>' );                                                                  html.Append( '<a name="new"></a>' );
664                                                  except                                                  except
                                                         //doc.Write( '<a name="new"></a>' + #13#10 );  
665                                                          html.Append( '<a name="new"></a>' );                                                          html.Append( '<a name="new"></a>' );
666                                                  end;                                                  end;
667                                          end;                                          end;
# Line 1072  begin Line 670  begin
670                                                  No := IntToStr(i + 1);                                                  No := IntToStr(i + 1);
671    
672                                                  Res := DivideStrLine(ReadList[i]);                                                  Res := DivideStrLine(ReadList[i]);
673                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');                                                  Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, threadKey, 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
674                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);                                                  Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
675    
676                                                  try                                                  try
677                                                          if NewReceiveNo <= (i + 1) then                                                          if NewReceiveNo <= (i + 1) then
678                                                                  // 新着レス                                                                  // 新着レス
679                                                                  strTmp := ReplaceRes( SkinNewRes )                                                                  strTmp := SkinedRes( SkinNewRes, Res, No )
680                                                          else                                                          else
681                                                                  // 通常のレス                                                                  // 通常のレス
682                                                                  strTmp := ReplaceRes( SkinRes );                                                                  strTmp := SkinedRes( SkinRes, Res, No  );
683    
                                                         //doc.Write( strTmp + #13#10 );  
684                                                          html.Append( strTmp );                                                          html.Append( strTmp );
685                                                  except                                                  except
686                                                  end;                                                  end;
# Line 1093  begin Line 690  begin
690                                                  // ここまで読んだ                                                  // ここまで読んだ
691                                                  try                                                  try
692                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then                                                          if FileExists( GikoSys.GetSkinBookmarkFileName ) then
                                                                 //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )  
693                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )                                                                  html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
694                                                          else                                                          else
                                                                 //doc.Write( '<a name="koko"></a>' + #13#10 );  
695                                                                  html.Append( '<a name="koko"></a>' );                                                                  html.Append( '<a name="koko"></a>' );
696                                                  except                                                  except
                                                         //doc.Write( '<a name="koko"></a>' + #13#10 );  
697                                                          html.Append( '<a name="koko"></a>' );                                                          html.Append( '<a name="koko"></a>' );
698                                                  end;                                                  end;
699                                          end;                                          end;
700                                  end;                                  end;
701    
                                 //doc.Write('<a name="bottom"></a>' + #13#10);  
702                                  html.Append('<a name="bottom"></a>' );                                  html.Append('<a name="bottom"></a>' );
703                                  // スキン(フッタ)                                  // スキン(フッタ)
704                                  try                                  try
                                         //doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );  
705                                          html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );                                          html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
706                                  except                                  except
707                                  end;                                  end;
708                          finally                          finally
                                 //doc.close;  
709                                  html.EndUpdate;                                  html.EndUpdate;
710                          end;                          end;
711                  end;                  end;
# Line 1325  begin Line 916  begin
916    
917                                  ReadList := TStringList.Create;                                  ReadList := TStringList.Create;
918                                  try                                  try
919                                            ReadList.BeginUpdate;
920                                          if ThreadItem.IsLogFile then begin                                          if ThreadItem.IsLogFile then begin
921                                                  FileName := ThreadItem.GetThreadFileName;                                                  FileName := ThreadItem.GetThreadFileName;
922                                                  ReadList.LoadFromFile(FileName);                                                  ReadList.LoadFromFile(FileName);
# Line 1350  begin Line 942  begin
942                                                  CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);                                                  CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
943                                          end;                                          end;
944                                  finally                                  finally
945                        ReadList.EndUpdate;
946                                          ReadList.Free;                                          ReadList.Free;
947                                  end;                                  end;
948                          end;                          end;

Legend:
Removed from v.1.4.2.6  
changed lines
  Added in v.1.4.2.7

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26