Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f8a212a

Browse files
authoredMay 6, 2021
Tiny cleanup (#335)
1 parent fbae792 commit f8a212a

File tree

8 files changed

+8
-10
lines changed

8 files changed

+8
-10
lines changed
 

‎src/Blog.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ function getStaticProps(_ctx) {
324324
var malformed = acc[1];
325325
var posts = acc[0];
326326
var id = postData.slug;
327-
var decoded = BlogFrontmatter.decode(BlogFrontmatter.authors, postData.frontmatter);
327+
var decoded = BlogFrontmatter.decode(postData.frontmatter);
328328
if (decoded.TAG === /* Ok */0) {
329329
var frontmatter = decoded._0;
330330
if (postData.archived) {

‎src/Blog.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,13 @@ let default = (props: props): React.element => {
371371
}
372372

373373
let getStaticProps: Next.GetStaticProps.t<props, params> = _ctx => {
374-
let authors = BlogFrontmatter.authors
375374
let (posts, malformed, archived) = BlogApi.getAllPosts()->Belt.Array.reduce(
376375
([], [], []),
377376
(acc, postData) => {
378377
let (posts, malformed, archived) = acc
379378
let id = postData.slug
380379

381-
let decoded = BlogFrontmatter.decode(~authors, postData.frontmatter)
380+
let decoded = BlogFrontmatter.decode(postData.frontmatter)
382381

383382
switch decoded {
384383
| Error(message) =>

‎src/BlogArticle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function $$default(props) {
113113
var module_ = require("../_blogposts/" + (fullslug + ".mdx"));
114114
var archived = fullslug.startsWith("archive/");
115115
var component = module_.default;
116-
var fm = BlogFrontmatter.decode(BlogFrontmatter.authors, frontmatter(component));
116+
var fm = BlogFrontmatter.decode(frontmatter(component));
117117
var children = React.createElement(component, {});
118118
var archivedNote = archived ? React.createElement("div", {
119119
className: "mb-10"

‎src/BlogArticle.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ let default = (props: props) => {
132132

133133
let component = module_.default
134134

135-
let fm = component->BlogComponent.frontmatter->BlogFrontmatter.decode(~authors=BlogFrontmatter.authors)
135+
let fm = component->BlogComponent.frontmatter->BlogFrontmatter.decode
136136

137137
let children = React.createElement(component, Js.Obj.empty())
138138

‎src/common/BlogApi.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function getLatest(maxOpt, baseUrlOpt, param) {
7171
var max = maxOpt !== undefined ? maxOpt : 10;
7272
var baseUrl = baseUrlOpt !== undefined ? baseUrlOpt : "https://rescript-lang.org";
7373
return Belt_Array.reduce(getAllPosts(undefined), [], (function (acc, next) {
74-
var fm = BlogFrontmatter.decode(BlogFrontmatter.authors, next.frontmatter);
74+
var fm = BlogFrontmatter.decode(next.frontmatter);
7575
if (fm.TAG !== /* Ok */0) {
7676
return acc;
7777
}

‎src/common/BlogApi.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ module RssFeed = {
137137

138138
// Retrieves the most recent [max] blog post feed items
139139
let getLatest = (~max=10, ~baseUrl="https://rescript-lang.org", ()): array<item> => {
140-
let authors = BlogFrontmatter.authors
141140
let items =
142141
getAllPosts()
143142
->Belt.Array.reduce([], (acc, next) =>
144-
switch BlogFrontmatter.decode(~authors, next.frontmatter) {
143+
switch BlogFrontmatter.decode(next.frontmatter) {
145144
| Ok(fm) =>
146145
let description = Js.Null.toOption(fm.description)->Belt.Option.getWithDefault("")
147146
let item = {

‎src/common/BlogFrontmatter.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function authorDecoder(fieldName, authors, json) {
132132
return Json_decode.either(single, multiple)(json);
133133
}
134134

135-
function decode(authors, json) {
135+
function decode(json) {
136136
var fm;
137137
try {
138138
fm = {

‎src/common/BlogFrontmatter.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ let authorDecoder = (~fieldName: string, ~authors, json) => {
120120
either(single, multiple, json)
121121
}
122122

123-
let decode = (~authors, json: Js.Json.t): result<t, string> => {
123+
let decode = (json: Js.Json.t): result<t, string> => {
124124
open Json.Decode
125125
switch {
126126
author: json->field("author", string, _)->decodeAuthor(~fieldName="author", ~authors),

0 commit comments

Comments
 (0)
Please sign in to comment.