OSDN Git Service

Partially implemented
authornaru <bottle@mikage.to>
Wed, 17 Sep 2003 08:25:12 +0000 (08:25 +0000)
committernaru <bottle@mikage.to>
Wed, 17 Sep 2003 08:25:12 +0000 (08:25 +0000)
Design and image saving not yet implemented

bottleclient/Logs.pas

index 200abbb..6aa8a7f 100755 (executable)
@@ -488,23 +488,59 @@ procedure TBottleLogList.PrintHTMLBottle(Strs: TStringList;
 var
   i: integer;
   InScope1, InSync: boolean;
+  Talk, Tag: String;
+  S0, S1: integer;
+  procedure TalkEnd;
+  var Cl: String;
+  begin
+    if Talk = '' then
+      Exit;
+    if InSync then Cl := 'synchronized'
+    else if InScope1 then Cl := 'scope1'
+    else Cl := 'scope0';
+    with Strs do
+    begin
+      Add('  <tr class="' + Cl + '">');
+      Add('    <td class="talk">' + XMLEntity(Talk) + '</td>');
+      Add('  </tr>');
+    end;
+    Talk := '';
+  end; // of sub-procedure TalkEnd
 begin
   SsParser.EscapeInvalidMeta := false;
   SsParser.LeaveEscape := false;
   SsParser.InputString := Bottle.Script;
   InScope1 := false;
   InSync := false;
+  S0 := 0;
+  S1 := 10;
   for i := 0 to SsParser.Count-1 do
-  begin
-    if SsParser.MarkUpType[i] <> mtStr then
-      Continue;
-    with Strs do
-    begin
-      Add('  <tr>');
-      Add('    <td>' + XMLEntity(SsParser[i]) + '</td>');
-      Add('  </tr>');
+    case SsParser.MarkUpType[i] of
+      mtStr:
+        Talk := Talk + XMLEntity(SsParser.Str[i]);
+      mtTag:
+        begin
+          Tag := SsParser.Str[i];
+          if (Tag = '\h') then
+          begin
+            if InScope1 and not InSync then
+              TalkEnd;
+            InScope1 := false;
+          end else if (Tag = '\u') then
+          begin
+            if not InScope1 and not InSync then
+              TalkEnd;
+            InScope1 := true;
+          end else if Tag = '\_s' then
+          begin
+            TalkEnd;
+            InSync := not InSync;
+          end else if SsParser.Match(Tag, '\n') > 0 then
+          begin
+            Talk := Talk + #13#10;
+          end;
+        end;
     end;
-  end;
 end;
 
 procedure TBottleLogList.SaveToHTML(const FileName: String;
@@ -520,9 +556,10 @@ begin
       Add('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">');
       Add('<html>');
       Add('<style type="text/css"><!--');
-      Add('table.bottle {}');
-      Add('talk.scope0 {color: black}');
-      Add('talk.scope1 {color: brown}');
+      Add('table.bottle td{font-family: monospace}');
+      Add('table.bottle tr.scope0 td.talk{color: black}');
+      Add('table.bottle tr.scope1 td.talk{color: brown}');
+      Add('table.bottle tr.synchronized td.talk{color: pink}');
       Add('--></style>');
       for i := 0 to Self.Count-1 do
       begin