Skip to content

Commit

Permalink
Upgrade ocamlformat
Browse files Browse the repository at this point in the history
  • Loading branch information
xvw committed Dec 14, 2024
1 parent 4cb9b32 commit 84a9ef0
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 0.26.2
version = 0.27.0
profile = janestreet
margin = 80
parse-docstrings
Expand Down
6 changes: 4 additions & 2 deletions js/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
(executable
(name capsule_js)
(modes js)
(preprocess (pps js_of_ocaml-ppx))
(js_of_ocaml (flags :standard))
(preprocess
(pps js_of_ocaml-ppx))
(js_of_ocaml
(flags :standard))
(promote
(until-clean)
(into "../hell/_build")
Expand Down
22 changes: 11 additions & 11 deletions lib/generator/action.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ let process_misc_files (module R : Intf.RESOLVER) =
;;

let layout_arrow
(type a)
(module A : Archetype.Types.ARCHETYPE with type t = a)
(module R : Intf.RESOLVER)
(type a)
(module A : Archetype.Types.ARCHETYPE with type t = a)
(module R : Intf.RESOLVER)
=
let open Yocaml.Task in
Yocaml_jingoo.Pipeline.as_template
Expand All @@ -89,14 +89,14 @@ let layout_arrow
;;

let page_arrow
(type a b)
(module A : Archetype.Types.ARCHETYPE with type t = a and type Input.t = b)
(module R : Intf.RESOLVER)
template
kind
config
source
target
(type a b)
(module A : Archetype.Types.ARCHETYPE with type t = a and type Input.t = b)
(module R : Intf.RESOLVER)
template
kind
config
source
target
=
let open Yocaml.Task in
R.track_common_deps
Expand Down
12 changes: 6 additions & 6 deletions lib/generator/archetype/address.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ module Input = struct
let* page = Raw.Input.validate obj in
record
(fun fields ->
let+ country = required fields "country" string
and+ city = required fields "city" string
and+ zipcode = required fields "zipcode" string
and+ address = required fields "address" string
and+ osm_image = optional fields "osm_image" Model.Url.validate in
{ page; country; city; zipcode; address; osm_image })
let+ country = required fields "country" string
and+ city = required fields "city" string
and+ zipcode = required fields "zipcode" string
and+ address = required fields "address" string
and+ osm_image = optional fields "osm_image" Model.Url.validate in
{ page; country; city; zipcode; address; osm_image })
obj
;;
end
Expand Down
22 changes: 11 additions & 11 deletions lib/generator/archetype/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ let validate =
;;

let normalize
{ title
; repository
; branch
; software_license
; content_license
; owner
; svg
; main_url
; default_cover
; journal_entries_per_page
}
{ title
; repository
; branch
; software_license
; content_license
; owner
; svg
; main_url
; default_cover
; journal_entries_per_page
}
=
let open Yocaml.Data in
record
Expand Down
8 changes: 4 additions & 4 deletions lib/generator/archetype/gallery.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ module Input = struct
let* page = Raw.Input.validate obj in
record
(fun fields ->
let+ elements =
optional_or ~default:[] fields "elements" (list_of validate_elt)
in
{ page; elements })
let+ elements =
optional_or ~default:[] fields "elements" (list_of validate_elt)
in
{ page; elements })
obj
;;
end
Expand Down
16 changes: 8 additions & 8 deletions lib/generator/archetype/journal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ let normalize { page; entries; length; index } =
;;

let full_configure
~config
~source
~target
~kind
~on_synopsis
~length
~entries
~index
~config
~source
~target
~kind
~on_synopsis
~length
~entries
~index
=
Yocaml.Task.Static.on_metadata
(Yocaml.Task.lift
Expand Down
162 changes: 81 additions & 81 deletions lib/generator/feed.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,33 @@ type t =
[@@ocaml.warning "-69"]

let from_source
(type a)
(module P : Yocaml.Required.DATA_PROVIDER)
(module D : Yocaml.Required.DATA_READABLE with type t = a)
?(on = `Source)
~where
~to_entry
~compute_link
path
(type a)
(module P : Yocaml.Required.DATA_PROVIDER)
(module D : Yocaml.Required.DATA_READABLE with type t = a)
?(on = `Source)
~where
~to_entry
~compute_link
path
=
let open Yocaml.Eff in
let* files = read_directory ~on ~only:`Files ~where path in
let+ elements =
List.traverse
(fun file ->
let url = compute_link file in
let+ metadata, _content =
read_file_with_metadata (module P) (module D) ~on file
in
to_entry ~file ~url metadata)
let url = compute_link file in
let+ metadata, _content =
read_file_with_metadata (module P) (module D) ~on file
in
to_entry ~file ~url metadata)
files
in
elements
;;

let journal_entries
(module P : Yocaml.Required.DATA_PROVIDER)
(module R : Intf.RESOLVER)
(module P : Yocaml.Required.DATA_PROVIDER)
(module R : Intf.RESOLVER)
=
let open Yocaml.Eff in
let* files =
Expand All @@ -52,19 +52,19 @@ let journal_entries
let+ elements =
List.traverse
(fun file ->
let url = R.Target.as_journal_entry file in
let+ metadata, content =
read_file_with_metadata
(module P)
(module Archetype.Journal_entry.Input)
~on:`Source
file
in
let metadata =
Archetype.Journal_entry.replace_datetime ~file metadata
in
( (metadata, content, file)
, Archetype.Journal_entry.Input.to_entry ~file ~url metadata ))
let url = R.Target.as_journal_entry file in
let+ metadata, content =
read_file_with_metadata
(module P)
(module Archetype.Journal_entry.Input)
~on:`Source
file
in
let metadata =
Archetype.Journal_entry.replace_datetime ~file metadata
in
( (metadata, content, file)
, Archetype.Journal_entry.Input.to_entry ~file ~url metadata ))
files
in
elements |> Stdlib.List.split
Expand All @@ -73,16 +73,16 @@ let journal_entries
let compute_map_from_tags source m =
List.fold_left
(fun m entry ->
List.fold_left
(fun m tag ->
M.update
tag
(function
| None -> Some [ entry ]
| Some xs -> Some (entry :: xs))
m)
m
(Model.Entry.tags_of entry))
List.fold_left
(fun m tag ->
M.update
tag
(function
| None -> Some [ entry ]
| Some xs -> Some (entry :: xs))
m)
m
(Model.Entry.tags_of entry))
m
source
;;
Expand Down Expand Up @@ -143,12 +143,12 @@ let make (module P : Yocaml.Required.DATA_PROVIDER) (module R : Intf.RESOLVER) =
;;

let create_journal_feed
(module P : Yocaml.Required.DATA_PROVIDER)
(module R : Intf.RESOLVER)
on_synopsis
config
{ journal_meta; _ }
cache
(module P : Yocaml.Required.DATA_PROVIDER)
(module R : Intf.RESOLVER)
on_synopsis
config
{ journal_meta; _ }
cache
=
let by_page = Archetype.Config.journal_entries_per_page config in
let entries = Std.List.split_by_size by_page journal_meta in
Expand All @@ -159,43 +159,43 @@ let create_journal_feed
~state:0
entries
(fun entries state cache ->
let index = state in
let deps = Archetype.Journal.deps_of entries in
let target = R.Target.as_journal_feed_page index in
let source = R.Source.journal_feed in
let length = len in
let+ cache =
Yocaml.Action.Static.write_file_with_metadata
(R.Target.promote target)
(let open Yocaml.Task in
R.track_common_deps
>>> Yocaml.Pipeline.track_files deps
>>> Yocaml.Pipeline.read_file_as_metadata
(module P)
(module Archetype.Journal.Input)
source
>>> Yocaml.Task.empty_body ()
>>> Archetype.Journal.full_configure
~config
~source
~target
~kind:Model.Types.Article
~on_synopsis
~length
~entries
~index
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "journal-feed.html")
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "page-header.html")
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "layout.html"))
cache
in
cache, succ index)
let index = state in
let deps = Archetype.Journal.deps_of entries in
let target = R.Target.as_journal_feed_page index in
let source = R.Source.journal_feed in
let length = len in
let+ cache =
Yocaml.Action.Static.write_file_with_metadata
(R.Target.promote target)
(let open Yocaml.Task in
R.track_common_deps
>>> Yocaml.Pipeline.track_files deps
>>> Yocaml.Pipeline.read_file_as_metadata
(module P)
(module Archetype.Journal.Input)
source
>>> Yocaml.Task.empty_body ()
>>> Archetype.Journal.full_configure
~config
~source
~target
~kind:Model.Types.Article
~on_synopsis
~length
~entries
~index
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "journal-feed.html")
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "page-header.html")
>>> Yocaml_jingoo.Pipeline.as_template
(module Archetype.Journal)
(R.Source.template "layout.html"))
cache
in
cache, succ index)
cache
in
cache
Expand Down
24 changes: 12 additions & 12 deletions lib/generator/model/identity.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ let validate =
;;

let normalize
{ display_name
; first_name
; last_name
; avatar
; website
; custom_attributes
; more_links
; x_account
; mastodon_account
; github_account
; more_accounts
}
{ display_name
; first_name
; last_name
; avatar
; website
; custom_attributes
; more_links
; x_account
; mastodon_account
; github_account
; more_accounts
}
=
let open Yocaml.Data in
let m_instance = Option.map fst mastodon_account
Expand Down
4 changes: 2 additions & 2 deletions lib/generator/model/index.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ let sort_by links = function
| "link-title" | "link-name" | "name" | "title" ->
List.sort
(fun a b ->
let f = if rev then -1 else 1 in
f * Link.compare_title a b)
let f = if rev then -1 else 1 in
f * Link.compare_title a b)
links
| _ -> if rev then List.rev links else links
in
Expand Down
Loading

0 comments on commit 84a9ef0

Please sign in to comment.