From a3e3f6048125666511d50e9fb043f16d8c599370 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 5 Feb 2004 15:20:47 +0000 Subject: [PATCH] added html_of_html_msg --- helm/ocaml/logger/ui_logger.ml | 17 ++++++++++++++++- helm/ocaml/logger/ui_logger.mli | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/helm/ocaml/logger/ui_logger.ml b/helm/ocaml/logger/ui_logger.ml index 5be084efc..09e50e627 100644 --- a/helm/ocaml/logger/ui_logger.ml +++ b/helm/ocaml/logger/ui_logger.ml @@ -14,13 +14,28 @@ type html_msg = [ `Error of html_tag | `Msg of html_tag ] let string_of_html_msg = let rec string_of_html_tag = function | `T s -> s - | `L msgs -> String.concat "" (List.map string_of_html_tag msgs) + | `L msgs -> String.concat "\n" (List.map string_of_html_tag msgs) | `BR -> "\n" in function | `Error tag -> "Error: " ^ string_of_html_tag tag | `Msg tag -> string_of_html_tag tag +let html_of_html_msg = + let rec string_of_html_tag = function + | `T s -> s + | `L msgs -> + sprintf "" + (String.concat "\n" + (List.map + (fun msg -> sprintf "
  • %s
  • " (string_of_html_tag msg)) + msgs)) + | `BR -> "
    \n" + in + function + | `Error tag -> "Error: " ^ string_of_html_tag tag ^ "" + | `Msg tag -> string_of_html_tag tag + class html_logger ?width ?height ?packing ?show () = let scrolled_window = GBin.scrolled_window ?packing ?show () in let vadj = scrolled_window#vadjustment in diff --git a/helm/ocaml/logger/ui_logger.mli b/helm/ocaml/logger/ui_logger.mli index c66a22635..d64603a4b 100644 --- a/helm/ocaml/logger/ui_logger.mli +++ b/helm/ocaml/logger/ui_logger.mli @@ -3,6 +3,7 @@ type html_tag = [ `BR | `L of html_tag list | `T of string ] type html_msg = [ `Error of html_tag | `Msg of html_tag ] val string_of_html_msg: html_msg -> string +val html_of_html_msg: html_msg -> string class html_logger: ?width:int -> ?height:int -> ?packing:(GObj.widget -> unit) -> ?show:bool -> -- 2.39.2