Skip to content

Commit

Permalink
Move to yocaml2
Browse files Browse the repository at this point in the history
  • Loading branch information
gr-im committed Aug 4, 2024
1 parent 9c64634 commit 38b53fa
Show file tree
Hide file tree
Showing 20 changed files with 307 additions and 288 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.1
version = 0.26.2
profile = default
parse-docstrings
break-separators = before
Expand Down
2 changes: 2 additions & 0 deletions articles/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(mdx
(files *.md))
5 changes: 3 additions & 2 deletions articles/fold-gof.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description:
Summary of a response regarding the encoding of visitors without
pattern matching in OCaml, using the fold function.

referenced_people:
referenced_humans:
- [hakimba, https://hakimba.github.io/oxywa/]
- [xvw, https://xvw.lol]

Expand Down Expand Up @@ -128,9 +128,10 @@ end
Now, we shall implement the constructors `some` and `none` so that they adhere
to this interface:

<!-- $MDX skip -->
```ocaml
module Option_obj : sig
val some : 'a -> 'a option_obj
val some : 'a -> 'a option_obj
val none : unit -> 'a option_obj
val fold : 'a option_obj -> ('a -> 'b) -> (unit -> 'b) -> 'b
end
Expand Down
3 changes: 1 addition & 2 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(executable
(name "site")
(public_name "site")
(promote (until-clean))
(libraries fmt.tty logs logs.fmt cmdliner yocaml_unix generator))
(libraries cmdliner yocaml_eio generator))
22 changes: 9 additions & 13 deletions bin/site.ml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
let default_port = 8888
let default_target = "_site"
let run_build target = Yocaml_unix.execute @@ Generator.Rule.all ~target
let default_target = Yocaml.Path.rel [ "_site" ]
let run_build target = Yocaml_eio.run ~level:`Debug (Generator.Rule.all ~target)

let run_watch target port =
let server =
Yocaml_unix.serve ~filepath:target ~port @@ Generator.Rule.all ~target
in
let () = run_build target in
Lwt_main.run server
Yocaml_eio.serve ~target ~level:`Info ~port (Generator.Rule.all ~target)

module Cmd = struct
open Cmdliner

let path_conv =
Arg.conv ~docv:"PATH"
((fun str -> str |> Yocaml.Path.from_string |> Result.ok), Yocaml.Path.pp)

let docs = Manpage.s_common_options
let exits = Cmd.Exit.defaults
let version = "dev"

let target_arg =
let doc =
Format.asprintf
"The directory in which the site should be generated (default: [%s])."
default_target
in
let doc = "target directory" in
let arg = Arg.info ~doc ~docs [ "target"; "output" ] in
Arg.(value @@ opt file default_target arg)
Arg.(value @@ opt path_conv default_target arg)

let port_arg =
let doc =
Expand Down
17 changes: 9 additions & 8 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
(generate_opam_files)
(opam_file_location inside_opam_directory)
(executables_implicit_empty_intf)
(using mdx 0.4)

(source (github gr-im/site))
(license GPL-3.0-or-later)
Expand All @@ -16,15 +17,15 @@
(description "Source code of the generator of my personal website")
(depends
(ocaml (>= 5.0.0))
(logs (>= 0.7.0))
(mdx (>= 2.4.1))
(cmdliner (>= 1.0.0))
(yocaml (= 1.0.0))
(yocaml_unix (= 1.0.0))
(yocaml_yaml (= 1.0.0))
(yocaml_jingoo (= 1.0.0))
(yocaml_syndication (= 1.0.0))
(cmarkit (= 0.3.0))
(ocamlformat (and :with-dev-setup (= 0.26.1)))
yocaml
yocaml_eio
yocaml_yaml
yocaml_jingoo
yocaml_syndication
yocaml_omd
(ocamlformat (and :with-dev-setup (= 0.26.2)))
(ocp-indent :with-dev-setup)
(merlin :with-dev-setup)
(utop :with-dev-setup)))
2 changes: 1 addition & 1 deletion lib/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name generator)
(public_name site.generator)
(libraries yocaml yocaml_yaml yocaml_jingoo cmarkit))
(libraries yocaml yocaml_yaml yocaml_jingoo yocaml_omd))
8 changes: 0 additions & 8 deletions lib/markdown.ml

This file was deleted.

1 change: 0 additions & 1 deletion lib/markdown.mli

This file was deleted.

Loading

0 comments on commit 38b53fa

Please sign in to comment.