Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuihtlauac ALVARADO committed Sep 6, 2024
1 parent 7f623b8 commit 49a539f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/ocamlorg_package/lib/ocamlorg_package.ml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 17 additions & 6 deletions src/ocamlorg_web/lib/handler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1043,15 +1046,19 @@ 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
in
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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 49a539f

Please sign in to comment.