From 56e6fd40e7723c2b0301e3fcdb1273692c42e590 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Tue, 25 Jun 2002 08:52:21 +0000 Subject: [PATCH] Wrong xpointers generated. Fixed. --- helm/ocaml/mathql/mQueryUtil.ml | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/helm/ocaml/mathql/mQueryUtil.ml b/helm/ocaml/mathql/mQueryUtil.ml index 97f94f727..cb60eff62 100644 --- a/helm/ocaml/mathql/mQueryUtil.ml +++ b/helm/ocaml/mathql/mQueryUtil.ml @@ -44,11 +44,6 @@ let str_btoken = function | MQBS -> "*" | MQBSS -> "**" -let str_ftoken = function - | MQFC i -> "/" ^ string_of_int i - | MQFS -> "/*" - | MQFSS -> "/**" - let str_prot = function | Some s -> s | None -> "*" @@ -58,21 +53,35 @@ let rec str_body = function | head :: tail -> str_btoken head ^ str_body tail let str_frag l = - let rec str_fi start = function - | [] -> "" - | t :: l -> - (if start then "#1" else "") ^ str_ftoken t ^ str_fi false l - in str_fi true l + match l with + [] -> "" + | l -> + let str_ftokens = + List.fold_left + (fun i t -> + i ^ + match t with + MQFC i -> "/" ^ string_of_int i + | MQFS -> "/*" + | MQFSS -> "/**" + ) "" l + in + "#xpointer(1" ^ str_ftokens ^ ")" +;; let str_tref (p, b, i) = str_prot p ^ ":/" ^ str_body b ^ str_frag i +;; let str_uref (u, i) = - let rec str_fi start = function - | [] -> "" - | i :: l -> - (if start then "#1" else "") ^ string_of_int i ^ str_fi false l - in UriManager.string_of_uri u ^ str_fi true i + UriManager.string_of_uri u ^ + match i with + [] -> "" + | l -> + "#xpointer(1" ^ + List.fold_left (fun i n -> i ^ "/" ^ string_of_int n) "" l ^ + ")" +;; (* raw HTML representation *) -- 2.39.2