From 49a539f29c4245a5b3478dd23eb218f075670386 Mon Sep 17 00:00:00 2001 From: Cuihtlauac ALVARADO Date: Fri, 6 Sep 2024 10:58:22 +0200 Subject: [PATCH] Formatting --- src/ocamlorg_package/lib/ocamlorg_package.ml | 3 +++ src/ocamlorg_web/lib/handler.ml | 23 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ocamlorg_package/lib/ocamlorg_package.ml b/src/ocamlorg_package/lib/ocamlorg_package.ml index 4fd56f8e8d..086e485114 100644 --- a/src/ocamlorg_package/lib/ocamlorg_package.ml +++ b/src/ocamlorg_package/lib/ocamlorg_package.ml @@ -1,9 +1,12 @@ module Import = Import open Import + module Name = struct include OpamPackage.Name + let of_string_opt str = try Some (of_string str) with _ -> None end + module Version = OpamPackage.Version module Info = Info module Statistics = Packages_stats diff --git a/src/ocamlorg_web/lib/handler.ml b/src/ocamlorg_web/lib/handler.ml index abe7c8912a..c7eb2099b8 100644 --- a/src/ocamlorg_web/lib/handler.ml +++ b/src/ocamlorg_web/lib/handler.ml @@ -796,7 +796,8 @@ let is_ocaml_yet t id req = |> List.concat_map (fun (category : Data.Is_ocaml_yet.category) -> category.packages) |> List.filter_map (fun (p : Data.Is_ocaml_yet.package) -> - let name = Ocamlorg_package.Name.of_string p.name in (* FIXME: Failure *) + let name = Ocamlorg_package.Name.of_string p.name in + (* FIXME: Failure *) match Ocamlorg_package.get_latest t name with | Some x -> Some x | None -> @@ -913,7 +914,9 @@ let packages_autocomplete_fragment t req = | _ -> Dream.html "" let package_overview t kind req = - let? name = Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" in + let? name = + Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" + in let version_from_url = Dream.param req "version" in let? package, frontend_package = Package_helper.of_name_version t name version_from_url @@ -1043,7 +1046,9 @@ let package_overview t kind req = ~search_index_digest ~toc ~deps_and_conflicts frontend_package) let package_versions t _kind req = - let? name = Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" in + let? name = + Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" + in let version_from_url = Dream.param req "version" in let? _package, frontend_package = Package_helper.of_name_version t name version_from_url @@ -1051,7 +1056,9 @@ let package_versions t _kind req = Dream.html (Ocamlorg_frontend.package_versions frontend_package) let package_documentation t kind req = - let? name = Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" in + let? name = + Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" + in let version_from_url = Dream.param req "version" in let? package, frontend_package = Package_helper.of_name_version t name version_from_url @@ -1185,7 +1192,9 @@ let package_documentation t kind req = ~content:doc.content frontend_package) let package_file t kind req = - let? name = Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" in + let? name = + Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" + in let version_from_url = Dream.param req "version" in let? package, frontend_package = Package_helper.of_name_version t name version_from_url @@ -1210,7 +1219,9 @@ let package_file t kind req = ~search_index_digest ~content_title:path ~toc frontend_package) let package_search_index t kind req = - let? name = Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" in + let? name = + Ocamlorg_package.Name.of_string_opt @@ Dream.param req "name" + in let version_from_url = Dream.param req "version" in let? package, _ = Package_helper.of_name_version t name version_from_url in let open Lwt.Syntax in