- let is_uri txt =
- try
- let u = UriManager.strip_xpointer (UriManager.uri_of_string txt) in
- ignore(Http_getter.resolve' u); true
- with
- | Http_getter_types.Key_not_found _
- | Http_getter_types.Unresolvable_URI _ -> false
- | UriManager.IllFormedUri u -> failwith ("Malformed URI '" ^ u ^ "'")
- in
- let is_whelp txt = Pcre.pmatch ~rex:whelp_RE txt in
- if is_whelp txt then
- begin
- set_whelp_query txt;
-
-
- (MatitaScript.instance ())#advance ~statement:(txt^".") ()
- end
- else
- begin
- let entry =
- if is_uri txt then
- (`Uri txt)
- else
- (`Dir (add_terminating_slash txt))
- in
- self#_load entry;
- self#_historyAdd entry
- end
-
-
+ if is_whelp txt then begin
+ set_whelp_query txt;
+ (MatitaScript.instance ())#advance ~statement:(txt ^ ".") ()
+ end else begin
+ let entry =
+ match txt with
+ | txt when is_uri txt -> `Uri (fix_uri txt)
+ | txt when is_dir txt -> `Dir (add_trailing_slash txt)
+ | txt ->
+ (try
+ entry_of_string txt
+ with Invalid_argument _ ->
+ raise (Browser_failure (sprintf "unsupported uri: %s" txt)))
+ in
+ self#_load entry;
+ self#_historyAdd entry
+ end
+