| MQBS -> "*"
| MQBSS -> "**"
-let str_ftoken = function
- | MQFC i -> "/" ^ string_of_int i
- | MQFS -> "/*"
- | MQFSS -> "/**"
-
let str_prot = function
| Some s -> s
| None -> "*"
| 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 *)