Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix introduction post #1

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Deploy
on:
pull_request:
push:
branches:
- master
Expand Down Expand Up @@ -35,13 +36,15 @@ jobs:
run: cabal run blog

- name: Upload artifact
if: github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: ./build

deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'

permissions:
pages: write
Expand Down
5 changes: 1 addition & 4 deletions articles/2020/open-source-journey.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ title: My Open Source Journey
author: Jan van Brügge
date: 2020-10-28
tags: [open-source]
published_on: the [Futurice Blog](https://futurice.com/blog/my-open-source-journey)
description: It's October again, Hacktoberfest time. Also time for me to reminisce about my personal learning journey that was so heavily influenced by open source.
---

*This post was first published on the [Futurice Blog](https://futurice.com/blog/my-open-source-journey).*

It's October again, Hacktoberfest time. Also time for me to reminisce about my personal learning journey that was so heavily influenced by open source.

## The Beginning

My interest in computers and coding started rather early, so when I was 14 years old, I went to the local library, got myself a book about programming ("From Zero to Hero: Java") and started on this wonderful path that is now not only my job, but also my passion.
Expand Down
2 changes: 0 additions & 2 deletions articles/2020/redesigning-a-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ tags: [typescript, open-source]
description: For the last few years, the core team of Cycle.js ([André](https://twitter.com/andrestaltz) and me) has been redesigning the architecture and the developer experience of the framework. This February we finally found a solution to our problems that still stays true to the core ideas of the framework.
---

For the last few years, the core team of Cycle.js ([André](https://twitter.com/andrestaltz) and me) has been redesigning the architecture and the developer experience of the framework. This February we finally found a solution to our problems that still stays true to the core ideas of the framework.

This blog post marks the first in a series that will cover the new design and its development. In this installment, I want to bring everyone onto the same page. _What_ where the problems I described earlier and _how_ does the new design solve them. In the later articles I will cover the new `run` function (the core of the framework) and the new HTTP driver and especially the issues I encountered while implementing those. _\*cough\*_ race conditions _\*cough\*_.

## The status quo
Expand Down
1 change: 1 addition & 0 deletions blog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ executable blog
build-depends: base ^>=4.18.0.0
, containers
, aeson
, pandoc
, slick
, shake
, text
39 changes: 27 additions & 12 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,47 @@

module Main where

import Development.Shake (ShakeOptions(..), shakeOptions, Verbosity (..), Action, forP, getDirectoryFiles, readFile', writeFile', copyFileChanged)
import Development.Shake.Forward (forwardOptions, shakeArgsForward, cacheAction)
import GHC.Generics (Generic)
import Development.Shake.Classes (Binary)
import Control.Monad (foldM)
import Control.Monad.IO.Class (liftIO)
import Data.Aeson (FromJSON, ToJSON)
import Data.Aeson.Types qualified as A
import Data.Text qualified as T
import Slick (markdownToHTML, compileTemplate', substitute)
import Slick.Utils (convert)
import Data.Aeson.Key (fromText)
import Data.Aeson.KeyMap qualified as KM
import Development.Shake.FilePath (dropDirectory1, (</>), dropExtension)
import Data.Aeson.Types qualified as A
import Data.Functor (void)
import Data.Maybe (fromMaybe)
import Control.Monad (foldM)
import Data.Aeson.Key (fromText)
import Data.List (sortOn)
import Data.Maybe (fromMaybe)
import Data.Ord (Down(..))
import Data.Set qualified as Set
import Data.Text qualified as T
import Development.Shake (ShakeOptions(..), shakeOptions, Verbosity (..), Action, forP, getDirectoryFiles, readFile', writeFile', copyFileChanged)
import Development.Shake.Classes (Binary)
import Development.Shake.FilePath (dropDirectory1, (</>), dropExtension)
import Development.Shake.Forward (forwardOptions, shakeArgsForward, cacheAction)
import GHC.Generics (Generic)
import Slick (compileTemplate', substitute)
import Slick.Pandoc (loadUsingMeta, defaultHtml5Options, defaultMarkdownOptions)
import Slick.Utils (convert)
import Text.Pandoc.Options (writerTableOfContents, writerTemplate)
import Text.Pandoc.Readers (readMarkdown)
import Text.Pandoc.Templates (compileTemplate)
import Text.Pandoc.Writers (writeHtml5String)

outputFolder :: FilePath
outputFolder = "build/"

markdownToHTML :: T.Text -> Action A.Value
markdownToHTML txt = do
Right x <- liftIO $ compileTemplate "" "<h2>Table of Contents</h2>\n$toc$\n$body$"
loadUsingMeta (readMarkdown defaultMarkdownOptions)
(writeHtml5String (defaultHtml5Options { writerTableOfContents = True, writerTemplate = Just x }))
(writeHtml5String defaultHtml5Options)
txt

data Post = MkPost
{ title :: String
, author :: String
, description :: String
, published_on :: Maybe String
, content :: String
, url :: String
, date :: String
Expand Down
6 changes: 6 additions & 0 deletions templates/post.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<article>
{{> templates/postHeader.html}}
{{#published_on}}
<p><em>This post was first published on {{{.}}}.</em></p>
{{/published_on}}
<p>
{{{description}}}
</p>
{{{content}}}
</article>
2 changes: 1 addition & 1 deletion templates/postList.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<article>
{{> templates/postHeader.html}}
{{{description}}}
<a href="{{prefix}}/{{url}}">Read more</a>
<br><a href="{{prefix}}/{{url}}">Read more</a>
</article>
{{/posts}}
1 change: 1 addition & 0 deletions templates/shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<span>© 2020-2024, Jan van Brügge. Opinions are my own.</span>
<span>All articles licensed under <a href="{{prefix}}/LICENSE">CC BY-SA 4.0</a></span>
<span>Feeds are available via <a href="{{prefix}}/atom.xml" rel="nofollow">Atom</a></span>
<span>Site generated with <a href="https://www.haskell.org/">Haskell</a> and <a href="https://github.com/ChrisPenner/slick">Slick</a>. See the source on <a href="https://github.com/jvanbruegge/blog">GitHub</a>.</span>
</footer>
</body>
</html>
Loading