Compare commits

...

3 Commits

Author SHA1 Message Date
a49af625bf Projects page 2021-01-25 21:11:14 +02:00
7056ca822c Set up posts again 2021-01-25 20:35:41 +02:00
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) { @media (min-width: 640px) {
body { body {
width: 60rem; 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> <nav>
<!-- Git logo from https://git-scm.com/downloads/logos --> <!-- Git logo from https://git-scm.com/downloads/logos -->
<!-- Logo by Jason Long --> <!-- 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="https://git.rauhala.info"><img src="/images/git_16.png" alt="git" /></a>
<a href="/contact.html">Contact</a> <a href="/contact.html">Contact</a>
</nav> </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> <ul>
$for(posts)$ $for(items)$
<li> <li>
<a href="$url$">$title$</a> - $modified$ <a href="$url$">$title$</a> - $date$
</li> </li>
$endfor$ $endfor$
</ul> </ul>

View File

@ -1,9 +1,6 @@
<article> <article>
<section class="header"> <section class="header">
Posted on $date$, modified on $modified$ Posted on $date$
$if(author)$
by $author$
$endif$
</section> </section>
<section> <section>
$body$ $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 OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
import Hakyll import Hakyll
import Data.List import Data.List
(isSuffixOf) (isPrefixOf, isSuffixOf)
import System.FilePath
(takeFileName)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
main :: IO () main :: IO ()
main = hakyllWith defaultConfiguration $ do main = hakyllWith defaultConfiguration{ignoreFile = ignore} $ do
match "well-known/*" $ do match "well-known/*" $ do
route (customRoute (prepend '.'. toFilePath)) route (customRoute (prepend '.'. toFilePath))
compile copyFileCompiler compile copyFileCompiler
@ -29,16 +33,75 @@ main = hakyllWith defaultConfiguration $ do
route idRoute route idRoute
compile compressCssCompiler 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 match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html" route $ setExtension "html"
compile $ pandocCompiler compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext >>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls >>= 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 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 :: a -> [a] -> [a]
prepend = (:) prepend = (:)

View File

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

View File

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