Skip to content

Commit

Permalink
Add a page for the OCaml Changelog entries (#1394)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmattio authored Jul 17, 2023
1 parent 325b35c commit 0fbf762
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Watch mode for executables
date: "2023-02-20-02"
date: "2023-02-20"
tags: [dune, platform, feature]
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Native polling mode for Windows
date: "2023-02-20-03"
date: "2023-02-20"
tags: [dune, platform, feature]
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Dune `concurrent` action
date: "2023-05-31-01"
date: "2023-05-31"
tags: [dune, platform, feature]
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Run code blocks in your `.mld` files
date: "2023-05-31-02"
date: "2023-05-31"
tags: [dune, platform, feature]
---

Expand Down
2 changes: 1 addition & 1 deletion data/changelog/infra/2023-06-28-upgrading-linux-distros.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: OCaml infra upgrading to Debian 12 for OCaml docker images
date: "2023-06-28"
tags: [ocaml-dockerfile, docker-base-images, ocaml-ci, opam-repo-ci, infra]
tags: [infra]
changelog: |
* OCaml Debian images upgraded to Debian 12 ([ocaml-dockerfile#172](https://github.com/ocurrent/ocaml-dockerfile/pull/172/files), @MisterDA)
* Deprecation of Ubuntu 18.04, Alpine 3.16 and 3.17, OracleLinux 7, OpenSUSE 15.2 images ([ocaml-dockerfile#176](https://github.com/ocurrent/ocaml-dockerfile/pull/176/files), @avsm)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Execute Code Blocks in Mld Files
date: "2023-04-17-01"
date: "2023-04-17"
tags: [mdx, platform, feature]
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: New Formatting Options in OCamlFormat
date: "2023-03-06-01"
date: "2023-03-06"
tags: [ocamlformat, platform, feature]
---

Expand Down
1 change: 1 addition & 0 deletions src/global/url.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ let api_with_version v = v2 ^ "/releases/" ^ minor v ^ "/api/index.html"
let api = "/releases/latest/api/index.html"
let books = "/books"
let changelog = "/changelog"
let changelog_entry id = "/changelog/" ^ id
let releases = "/releases"
let release v = "/releases/" ^ v
let workshops = "/workshops"
Expand Down
2 changes: 2 additions & 0 deletions src/ocamlorg_data/data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ end

module Changelog = struct
include Changelog

let get_by_slug slug = List.find_opt (fun x -> String.equal slug x.slug) all
end

module Job = struct
Expand Down
1 change: 1 addition & 0 deletions src/ocamlorg_data/data.mli
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module Changelog : sig
}

val all : t list
val get_by_slug : string -> t option
end

module Job : sig
Expand Down
8 changes: 8 additions & 0 deletions src/ocamlorg_frontend/dune
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
(target changelog.ml)
(action
(run %{bin:dream_eml} %{dep:changelog.eml} --workspace %{workspace_root})))
(rule
(target changelog_entry.ml)
(action
(run
%{bin:dream_eml}
%{dep:changelog_entry.eml}
--workspace
%{workspace_root})))
(rule
(target news.ml)
(action
Expand Down
1 change: 1 addition & 0 deletions src/ocamlorg_frontend/ocamlorg_frontend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let best_practices = Best_practices.render
let blog = Blog.render
let blog_post = Blog_post.render
let changelog = Changelog.render
let changelog_entry = Changelog_entry.render
let books = Books.render
let community = Community.render
let home = Home.render
Expand Down
11 changes: 2 additions & 9 deletions src/ocamlorg_frontend/pages/changelog.eml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ Layout.render
</h1>

<p class="text-lg text-lighter mt-6">Read the latest releases and updates from the OCaml ecosystem.</p>

<p class="text-lg text-lighter mt-6">
<i>
<b>Note:</b> The OCaml Changelog is experimental and is not yet endorsed by the maintainers of the Compiler, OCaml Platform and other featured projects. <br>
We'll work with the maintainers of the projects to agree on the format of the Changelog and the release process as we roll out a stable version.
</i>
</p>
</div>
</div>

Expand Down Expand Up @@ -46,9 +39,9 @@ Layout.render
</div>
<h2
class="my-0 font-sans text-2xl tracking-normal font-extrabold leading-7 changelog-title">
<%s item.title %>
<a href="<%s Url.changelog_entry item.slug %>"><%s item.title %></a>
</h2>
<time datetime="<%s item.date %>" class="block mt-3 font-sans text-sm text-lighter"><%s item.date %></time>
<time datetime="<%s item.date %>" class="block mt-3 font-sans text-sm text-lighter"><%s Utils.human_date item.date %></time>
<% (match item.tags with [] -> () | _ -> %>
<div class="mt-3 flex flex-row flex-wrap justify-start gap-4">
<% item.tags |> List.iter (fun tag -> %>
Expand Down
52 changes: 52 additions & 0 deletions src/ocamlorg_frontend/pages/changelog_entry.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
let render (change : Data.Changelog.t) =
Layout.render
~title:(Printf.sprintf "%s • OCaml Changelog" change.title)
~description:change.title @@
<div class="bg-default dark:bg-dark-default pt-12 pb-10 lg:py-24">
<div class="container-fluid">
<div class="mx-auto max-w-5xl">
<div class="mx-auto max-w-5xl">
<a href="<%s Url.changelog %>"
class="flex justify-start space-x-3 items-center text-primary-600 hover:underline font-semibold mb-4 h-12">
<%s! Icons.arrow_left "h-5 w-5" %>
<div>View all changes</div>
</a>
</div>

<section class="leading-5 pb-10 lg:pb-24 text-zinc-800">
<h1
class="mx-0 mt-0 mb-1 font-sans text-3xl font-extrabold tracking-normal leading-8 lg:text-5xl lg:tracking-tight md:mb-4 md:text-4xl">
<%s change.title %>
</h1>
<% (match change.tags with [] -> () | _ -> %>
<ul class="inline-block pl-0 mt-2 mb-0 text-zinc-800">
<% change.tags |> List.iter (fun tag -> %>
<li class="inline-block mt-2 mr-2 text-left">
<a href="<%s Url.changelog %>?t=<%s tag %>"
class="whitespace-nowrap rounded-full bg-default dark:bg-dark-default px-4 py-2.5 text-sm font-semibold text-default shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
<%s tag %>
</a>
</li>
<% ); %>
</ul>
<% ); %>
</section>

<section class="border-gray-300 border-solid pb-6 lg:pb-8">
<time datetime="2023-07-14"
class="block pb-5 mt-0 mb-6 font-sans text-sm text-gray-600 border-b-2 border-solid border-zinc-300">
<%s Utils.human_date change.date %>
</time>
<div class="prose prose-orange max-w-none">
<%s! change.body_html %>
<% (match change.changelog_html with | None -> () | Some changelog -> %>
<details>
<summary>See full changelog</summary>
<%s! changelog %>
</details>
<% ); %>
</div>
</section>
</div>
</div>
</div>
5 changes: 5 additions & 0 deletions src/ocamlorg_web/lib/handler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ let changelog req =
in
Dream.html (Ocamlorg_frontend.changelog ?current_tag ~tags changes)

let changelog_entry req =
let slug = Dream.param req "id" in
let</>? change = Data.Changelog.get_by_slug slug in
Dream.html (Ocamlorg_frontend.changelog_entry change)

let success_story req =
let slug = Dream.param req "id" in
let</>? success_story = Data.Success_story.get_by_slug slug in
Expand Down
1 change: 1 addition & 0 deletions src/ocamlorg_web/lib/router.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ let page_routes =
Dream.get Url.platform Handler.platform;
Dream.get Url.community Handler.community;
Dream.get Url.changelog Handler.changelog;
Dream.get (Url.changelog_entry ":id") Handler.changelog_entry;
Dream.get (Url.success_story ":id") Handler.success_story;
Dream.get Url.industrial_users Handler.industrial_users;
Dream.get Url.academic_users Handler.academic_users;
Expand Down
2 changes: 1 addition & 1 deletion tool/ood-gen/lib/changelog.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let decode (fname, (head, body)) =

let all () =
Utils.map_files decode "changelog/*/*.md"
|> List.sort (fun a b -> String.compare b.date a.date)
|> List.sort (fun a b -> String.compare b.slug a.slug)

let template () =
Format.asprintf
Expand Down

0 comments on commit 0fbf762

Please sign in to comment.