Compare commits

...

3 Commits

Author SHA1 Message Date
Mats Rauhala a49af625bf Projects page 2021-01-25 21:11:14 +02:00
Mats Rauhala 7056ca822c Set up posts again 2021-01-25 20:35:41 +02:00
Mats Rauhala 7e290bee2f Ignore temp files 2021-01-25 19:35:21 +02:00
11 changed files with 118 additions and 14 deletions

View File

@ -109,6 +109,12 @@ article .header {
}
}
.projectlist {
display: flex;
align-items: center;
justify-content: space-between;
}
@media (min-width: 640px) {
body {
width: 60rem;

View File

@ -0,0 +1,23 @@
---
title: phrase
github: https://github.com/MasseR/phrase
issues: https://github.com/MasseR/phrase/issues
badge: https://github.com/MasseR/phrase/workflows/Run nix build/badge.svg
---
This project is a command line tool for generating password phrases using the
[diceware method](https://diceware.dmuth.org/). The passwords are stored in a
folder structure that is compatible with the
[pass](https://www.passwordstore.org/) password store manager.
```
$ phrase asd
inlet area crux
$ pass show asd
inlet area crux
$ file ~/.password-store/asd.gpg
```

View File

@ -16,6 +16,9 @@
<nav>
<!-- Git logo from https://git-scm.com/downloads/logos -->
<!-- Logo by Jason Long -->
<a href="/">Home</a>
<a href="/posts.html">Posts</a>
<a href="/projects.html">Projects</a>
<a href="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
<a href="/contact.html">Contact</a>
</nav>

View File

@ -1,3 +0,0 @@
A list of small and big guides.
$partial("templates/post-list.html")$

View File

@ -1,7 +1,7 @@
<ul>
$for(posts)$
$for(items)$
<li>
<a href="$url$">$title$</a> - $modified$
<a href="$url$">$title$</a> - $date$
</li>
$endfor$
</ul>

View File

@ -1,9 +1,6 @@
<article>
<section class="header">
Posted on $date$, modified on $modified$
$if(author)$
by $author$
$endif$
Posted on $date$
</section>
<section>
$body$

View File

@ -0,0 +1,8 @@
<ul>
$for(items)$
<li>
<div class="projectlist"><a href="$url$">$title$</a>$if(badge)$<img src="$badge$" />$endif$</div>
</li>
$endfor$
</ul>

View File

@ -0,0 +1,6 @@
<article>
<section>
$body$
</section>
</article>

View File

@ -1,14 +1,18 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
import Hakyll
import Data.List
(isSuffixOf)
(isPrefixOf, isSuffixOf)
import System.FilePath
(takeFileName)
--------------------------------------------------------------------------------
main :: IO ()
main = hakyllWith defaultConfiguration $ do
main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
match "well-known/*" $ do
route (customRoute (prepend '.'. toFilePath))
compile copyFileCompiler
@ -29,16 +33,75 @@ main = hakyllWith defaultConfiguration $ do
route idRoute
compile compressCssCompiler
match "posts/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postContext
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "projects/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/project.html" postContext
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
archive $ Archive { output = "posts.html"
, input = "posts/*"
, title = "Posts"
, template = "templates/post-list.html"
, context = postContext
}
archive $ Archive { output = "projects.html"
, input = "projects/*"
, title = "Projects"
, template = "templates/project-list.html"
, context = postContext
}
match "templates/*" $ compile templateBodyCompiler
where
postContext :: Context String
postContext = dateField "date" "%B %e, %Y" <> defaultContext
ignore :: FilePath -> Bool
ignore path = any ($ takeFileName path)
[ ("." `isPrefixOf`)
, ("#" `isPrefixOf`)
, ("~" `isSuffixOf`)
, (".swp" `isSuffixOf`)
]
data Archive
= Archive { output :: Identifier
, input :: Pattern
, title :: String
, template :: Identifier
, context :: Context String
}
archive :: Archive -> Rules ()
archive Archive{..} = create [output] $ do
route idRoute
compile $ do
let itemsContext =
listField "items" context items
<> constField "title" title
<> defaultContext
items = recentFirst =<< loadAll input
makeItem ""
>>= loadAndApplyTemplate template itemsContext
>>= loadAndApplyTemplate "templates/default.html" itemsContext
>>= relativizeUrls
prepend :: a -> [a] -> [a]
prepend = (:)

View File

@ -1,10 +1,10 @@
{ mkDerivation, base, hakyll, stdenv, time }:
{ mkDerivation, base, filepath, hakyll, stdenv, time }:
mkDerivation {
pname = "site";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base hakyll time ];
executableHaskellDepends = [ base filepath hakyll time ];
license = stdenv.lib.licenses.bsd3;
}

View File

@ -13,5 +13,6 @@ executable site
build-depends: base == 4.*
, hakyll >= 4.10
, time
, filepath
ghc-options: -threaded
default-language: Haskell2010