From: Stefano Zacchiroli Date: Mon, 5 Apr 2004 17:22:29 +0000 (+0000) Subject: added html_of_html_tag X-Git-Tag: dead_dir_walking~88 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=c5dad1d18ea23c4ce58d5f769ef2dc0a634240b8;p=helm.git added html_of_html_tag --- diff --git a/helm/ocaml/logger/helmLogger.ml b/helm/ocaml/logger/helmLogger.ml index b4234b03c..ce535d26c 100644 --- a/helm/ocaml/logger/helmLogger.ml +++ b/helm/ocaml/logger/helmLogger.ml @@ -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 "" + (String.concat "\n" + (List.map + (fun msg -> sprintf "
  • %s
  • " (html_of_html_tag msg)) + msgs)) + | `BR -> "
    \n" + | `DIV (indent, color, tag) -> + sprintf "
    \n%s\n
    " + (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 "" - (String.concat "\n" - (List.map - (fun msg -> sprintf "
  • %s
  • " (string_of_html_tag msg)) - msgs)) - | `BR -> "
    \n" - | `DIV (indent, color, tag) -> - sprintf "
    \n%s\n
    " - (match color with None -> "" | Some color -> "color: " ^ color ^ "; ") - (float_of_int indent *. 0.5) - (string_of_html_tag tag) - in function - | `Error tag -> "Error: " ^ string_of_html_tag tag ^ "" - | `Msg tag -> string_of_html_tag tag + | `Error tag -> "Error: " ^ html_of_html_tag tag ^ "" + | `Msg tag -> html_of_html_tag tag let log_callbacks = ref [] diff --git a/helm/ocaml/logger/helmLogger.mli b/helm/ocaml/logger/helmLogger.mli index e31019e6e..6717e9410 100644 --- a/helm/ocaml/logger/helmLogger.mli +++ b/helm/ocaml/logger/helmLogger.mli @@ -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