From: Claudio Sacerdoti Coen Date: Tue, 9 Mar 2004 16:09:13 +0000 (+0000) Subject: Partially ported to new disambiguating parser. X-Git-Tag: v0_0_4~26 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=144b71e5ca75b56c0cc3cc63e2b2045ef9deb6c0;p=helm.git Partially ported to new disambiguating parser. Some bugs left (e.g. in aliases) --- diff --git a/helm/searchEngine/html/index.html b/helm/searchEngine/html/index.html index e7b73b5d2..fb5c2d45a 100644 --- a/helm/searchEngine/html/index.html +++ b/helm/searchEngine/html/index.html @@ -551,13 +551,14 @@ function templateambigpdq2_listainterpretazioni(document,elenco,labels) function templateambigpdq2_invia(document,elenco) { stringa=top.topurl+"/"+top.current_query+"?term="+top.terminecic; - stringa=stringa+"&aliases="; - controllo=stringa.length; + stringa=stringa+"&aliases=&interpretation_choices="; + var parsa = ""; + controllo=parsa.length; for (j=0;j (fun _ -> None) in + let interpretation_choices = + try + let choices_raw = req#param "interpretation_choices" in + Some (parse_interpretation_choices choices_raw) + with Http_types.Param_not_found _ -> None + in let module Chat: DisambiguateTypes.Callbacks = struct @@ -410,52 +418,45 @@ print_endline ("id_to_uris: " ^ (DisambiguatingParser.EnvironmentP3.to_string id raise Chat_unfinished)) let interactive_interpretation_choice interpretations = - let html_interpretations_labels = - String.concat ", " - (List.map - (fun l -> - "\'" ^ - (String.concat "
" - (List.map - (fun (id, value) -> - let id = javascript_quote id in - let value = javascript_quote value in - sprintf "alias id %s = %s" id value) - l)) ^ - "\'") - interpretations) - in - let html_interpretations = - String.concat ", " - (List.map - (fun l -> - "\'" ^ - (String.concat " " - (List.map - (fun (id, value) -> - let id = javascript_quote id in - let value = javascript_quote value in - sprintf "alias id %s = %s" - id - (MQueryMisc.wrong_xpointer_format_from_wrong_xpointer_format' - value)) - l)) ^ - "\'") + match interpretation_choices with + Some l -> prerr_endline "CARRAMBA" ; l + | None -> + let html_interpretations_labels = + String.concat ", " + (List.map + (fun l -> + "\'" ^ + (String.concat "
" + (List.map + (fun (id, value) -> + let id = javascript_quote id in + let value = javascript_quote value in + sprintf "%s = %s" id value) + l)) ^ + "\'") interpretations) - in - Http_daemon.send_basic_headers ~code:200 outchan ; - Http_daemon.send_CRLF outchan ; - iter_file - (fun line -> - let processed_line = - apply_substs - [interpretations_RE, html_interpretations; - interpretations_labels_RE, html_interpretations_labels] - line - in - output_string outchan (processed_line ^ "\n")) - interactive_interpretation_choice_TPL; - raise Chat_unfinished + in + let html_interpretations = + let rec aux n = + function + [] -> [] + | _::tl -> ("'" ^ string_of_int n ^ "'")::(aux (n+1) tl) + in + String.concat ", " (aux 0 interpretations) + in + Http_daemon.send_basic_headers ~code:200 outchan ; + Http_daemon.send_CRLF outchan ; + iter_file + (fun line -> + let processed_line = + apply_substs + [interpretations_RE, html_interpretations; + interpretations_labels_RE, html_interpretations_labels] + line + in + output_string outchan (processed_line ^ "\n")) + interactive_interpretation_choice_TPL; + raise Chat_unfinished let input_or_locate_uri ~title = UriManager.uri_of_string "cic:/Coq/Init/DataTypes/nat_ind.con" @@ -558,7 +559,8 @@ print_endline ("id_to_uris: " ^ (DisambiguatingParser.EnvironmentP3.to_string id let processed_line = apply_substs [results_RE, theory_of_result results ; - new_aliases_RE, new_aliases] + (* CSC: Bug here: this is a string, not an array! *) + new_aliases_RE, "'" ^ javascript_quote new_aliases ^ "'"] line in output_string outchan (processed_line ^ "\n"))