Change argument order to make function more pipeline-friendly.

This commit is contained in:
Dillon Kearns 2021-06-20 08:20:44 -07:00
parent 44d6811f71
commit 5b6ad1d615
3 changed files with 6 additions and 8 deletions

View File

@ -11,11 +11,11 @@ import Serialize as S
withFrontmatter :
(frontmatter -> List view -> value)
-> String
-> Decoder frontmatter
-> Markdown.Renderer.Renderer view
-> String
-> DataSource.DataSource value
withFrontmatter constructor filePath frontmatterDecoder renderer =
withFrontmatter constructor frontmatterDecoder renderer filePath =
DataSource.map2 constructor
(StaticFile.onlyFrontmatter
frontmatterDecoder

View File

@ -234,9 +234,9 @@ type alias Data =
data : RouteParams -> DataSource Data
data route =
MarkdownCodec.withFrontmatter Data
("content/blog/" ++ route.slug ++ ".md")
frontmatterDecoder
TailwindMarkdownRenderer.renderer
("content/blog/" ++ route.slug ++ ".md")
type alias ArticleMetadata =

View File

@ -283,11 +283,9 @@ pageBody routeParams =
in
Glob.expectUniqueMatch (findBySlug slug)
|> DataSource.andThen
(\filePath ->
MarkdownCodec.withFrontmatter (\description body -> { description = description, body = body })
filePath
(Decode.field "description" Decode.string)
TailwindMarkdownRenderer.renderer
(MarkdownCodec.withFrontmatter (\description body -> { description = description, body = body })
(Decode.field "description" Decode.string)
TailwindMarkdownRenderer.renderer
)