]> matita.cs.unibo.it Git - helm.git/commitdiff
added html_of_html_tag
authorStefano Zacchiroli <zack@upsilon.cc>
Mon, 5 Apr 2004 17:22:29 +0000 (17:22 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Mon, 5 Apr 2004 17:22:29 +0000 (17:22 +0000)
helm/ocaml/logger/helmLogger.ml
helm/ocaml/logger/helmLogger.mli

index b4234b03cff9f0ec357f830d6bff6970de49878d..ce535d26c1dfec76e89936d3eeb93d4488cf1c6c 100644 (file)
@@ -29,25 +29,25 @@ let string_of_html_msg =
     | `Error tag -> "Error: " ^ aux 0 tag
     | `Msg tag -> aux 0 tag
 
+let rec html_of_html_tag = function
+  | `T s -> s
+  | `L msgs ->
+      sprintf "<ul>\n%s\n</ul>"
+        (String.concat "\n"
+          (List.map
+            (fun msg -> sprintf "<li>%s</li>" (html_of_html_tag msg))
+            msgs))
+  | `BR -> "<br />\n"
+  | `DIV (indent, color, tag) ->
+      sprintf "<div style=\"%smargin-left:%fcm\">\n%s\n</div>"
+        (match color with None -> "" | Some color -> "color: " ^ color ^ "; ")
+        (float_of_int indent *. 0.5)
+        (html_of_html_tag tag)
+
 let html_of_html_msg =
-  let rec string_of_html_tag = function
-    | `T s -> s
-    | `L msgs ->
-        sprintf "<ul>\n%s\n</ul>"
-          (String.concat "\n"
-            (List.map
-              (fun msg -> sprintf "<li>%s</li>" (string_of_html_tag msg))
-              msgs))
-    | `BR -> "<br />\n"
-    | `DIV (indent, color, tag) ->
-        sprintf "<div style=\"%smargin-left:%fcm\">\n%s\n</div>"
-          (match color with None -> "" | Some color -> "color: " ^ color ^ "; ")
-          (float_of_int indent *. 0.5)
-          (string_of_html_tag tag)
-  in
   function
-    | `Error tag -> "<b>Error: " ^ string_of_html_tag tag ^ "</b>"
-    | `Msg tag -> string_of_html_tag tag
+    | `Error tag -> "<b>Error: " ^ html_of_html_tag tag ^ "</b>"
+    | `Msg tag -> html_of_html_tag tag
 
 let log_callbacks = ref []
 
index e31019e6ee7d442d894affb0149ed1ba78809aff..6717e941063a0ad15435de3cb1166d454ccd5c85 100644 (file)
@@ -7,9 +7,15 @@ type html_tag =
   ]
 type html_msg = [ `Error of html_tag | `Msg of html_tag ]
 
+  (** html_msg to plain text converter *)
 val string_of_html_msg: html_msg -> string
+
+  (** html_msg to html text converter *)
 val html_of_html_msg: html_msg -> string
 
+  (** html_tag to html text converter *)
+val html_of_html_tag: html_tag -> string
+
 type logger_fun = ?append_NL:bool -> html_msg -> unit
 
 val register_log_callback: logger_fun -> unit