Initial commit

This commit is contained in:
Abigail Magalhães 2021-05-25 21:06:43 -03:00
commit 73beb6d0aa
16 changed files with 686 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
/.site
/.store
/.stack-work
/.vscode
/fonts
/css/fonts
/.mailmap

31
css/colors.scss Normal file
View File

@ -0,0 +1,31 @@
$black: #282c34;
$white: #abb2bf;
$light_red: #e06c75;
$dark_red: #be5046;
$green: #98c379;
$light_yellow: #e5c07b;
$dark_yellow: #d19a66;
$blue: #61afef;
$magenta: #c678dd;
$cyan: #56b6c2;
$gutter_grey: #4b5263;
$comment_grey: #5c6370;
$orange: #ffac5f;
$blonde: #f5ddbc;
$light-purple: #f2f1f8;
$purple: #7060eb;
$yugo: #ea8472;
$code-background: $black;
$code-language-background: lighten($black, 5%);
$code-language-color: $white;
$code-fg: $white;
$code-kw: $light_red;
$code-dt: $dark_yellow;
$code-ot: $code-fg;
$code-co: $comment_grey;
// comment

208
css/default.scss Normal file
View File

@ -0,0 +1,208 @@
$purple: #424969;
$orange: #ffac5f;
$blonde: #f5ddbc;
$light-purple: #faf0fa;
$card-bg: #dde;
$header: $orange;
$header-height: 50px;
$max-width: 80ch;
$pfp-size: 64px;
html, body {
min-height: 100%;
height: 100%;
margin: 0;
background-color: white;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}
body {
display: flex;
flex-direction: column;
counter-reset: theorem figure;
}
div#header {
background-color: $header;
height: $header-height;
display: flex;
flex-direction: row;
align-items: stretch;
justify-content: space-between;
flex-wrap: nowrap;
overflow-x: auto;
div#logo {
margin: auto;
line-height: $header-height;
padding-left: .5em;
padding-right: .5em;
font-size: 18pt;
a {
color: black;
text-decoration: none;
}
transition: background-color .2s ease-in-out;
}
div#logo:hover {
background-color: darken($header, 10%);
}
}
.column {
list-style: none;
display: flex;
flex-flow: column nowrap;
}
.columns {
display: flex;
flex-flow: row nowrap;
> * {
width: 50%;
padding: 0px;
}
}
div#content {
max-width: $max-width;
margin: 0px auto 0px auto;
flex: 1 0 auto;
font-size: 14pt;
line-height: 1.6;
p {
text-align: justify;
letter-spacing: 1.75;
code {
display: inline-block;
}
span.qed {
float: right;
}
span.theorem ::after {
counter-increment: theorem;
content: " " counter(theorem);
}
span.theorem, span.paragraph-marker {
font-style: italic;
}
}
h1 {
font-variant: small-caps;
max-width: 120ch;
}
* {
max-width: 100%;
}
.person {
margin: 5px 5px;
padding: 0.5em;
background-color: $card-bg;
border: 1px solid darken($card-bg, 10%);
border-radius: 5px;
.header {
display: flex;
img.pfp {
width: $pfp-size;
height: $pfp-size;
border-radius: 5px;
}
div.default-pfp {
background-color: black;
width: $pfp-size;
height: $pfp-size;
border-radius: 3px;
img {
filter: invert(1);
}
}
line-height: $pfp-size;
.name {
padding-left: 10px;
font-size: 18pt;
}
.pronouns {
font-size: 10pt;
}
}
}
}
details[open].person {
summary::before {
transform: rotate(90deg);
}
.guts {
height: unset;
}
summary ~ * {
animation: sweep .5s ease-in-out;
}
}
@keyframes sweep {
0% {
font-size: 0pt;
}
100% {
font-size: unset;
}
}
details.person {
> summary::before {
content: '';
margin-right: 1em;
transition: transform 0.5s;
}
}
.footnote-back {
margin-left: 0.5em;
}
@media only screen and (max-width: $max-width) {
div#content {
margin-left: 1em;
margin-right: 1em;
}
.columns {
flex-flow: column nowrap;
> * {
width: unset;
}
}
}

2
hie.yaml Normal file
View File

@ -0,0 +1,2 @@
cradle:
stack:

27
offtopia-org.cabal Normal file
View File

@ -0,0 +1,27 @@
name: offtopia-org
version: 0.1.0.0
build-type: Simple
cabal-version: >= 1.10
executable site
main-is: site.hs
build-depends: base
, hakyll
, pandoc
, skylighting
, process
, containers
, directory
, pandoc-types
, bytestring
, uri-encode
, deepseq
, text
, hsass
, aeson
, hakyll-sass
, unordered-containers
ghc-options: -threaded
default-language: Haskell2010
ghc-options: -optl-fuse-ld=lld

36
pages/index.html Normal file
View File

@ -0,0 +1,36 @@
---
title: offtopia.org
---
We do open source. Sometimes. I need this text to be at least 95 characters long so that the webpage flows right, it's really quite annoying.
<h1>What we do</h1>
<ul class="column">
$for(projects)$
<li>
$body$
</li>
$endfor$
</ul>
<h1>Who we are</h1>
<div class="columns">
<ul class="column">
$for(people-1)$
<li>
$body$
</li>
$endfor$
</ul>
<ul class="column">
$for(people-2)$
<li>
$body$
</li>
$endfor$
</ul>
</div>

16
pages/people/abby.md Normal file
View File

@ -0,0 +1,16 @@
---
name: Abbie
link: https://abby.how
pfp: https://plt.abby.how/means/c3Qs.png
pronouns: she/her
projects:
- name: Amulet
url: https://amulet.works
desc: |
Amulet is a functional programming language in the ML tradition.
---
Hi! I'm a type-theorist-in-training from the south of Brazil. I also made this website, which is why it looks _exactly_ like my blog: Powered by the same stuff, too!

9
pages/projects/ahti.md Normal file
View File

@ -0,0 +1,9 @@
---
name: ahti.space
link: https://ahti.space
participants:
- a
- b
- c
---

190
site.hs Normal file
View File

@ -0,0 +1,190 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.DeepSeq (rnf)
import Control.Concurrent
import Control.Exception
import Control.Monad
import qualified Data.ByteString.Lazy.Char8 as BS
import Data.ByteString.Lazy.Char8 (pack, unpack)
import qualified Data.Text.Encoding as T
import qualified Data.HashMap.Strict as HMap
import qualified Data.Map.Strict as Map
import qualified Data.Text as T
import Data.Functor
import Data.Monoid
import Data.Aeson
import Data.Maybe
import Data.List
import Data.Char
import Debug.Trace
import Hakyll.Core.Compiler.Internal
import Hakyll.Core.Compiler
import Hakyll.Web.Sass
import Hakyll
import qualified Network.URI.Encode as URI (encode)
import qualified Skylighting as Sky
import System.Environment
import System.Process
import System.Exit
import System.IO
import Text.Pandoc.Walk (query, walkM)
import Text.Pandoc.Highlighting
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Sass.Functions
readerOpts :: ReaderOptions
readerOpts = def { readerExtensions = pandocExtensions
, readerIndentedCodeClasses = ["amulet"] }
writerOptions :: Compiler WriterOptions
writerOptions = do
syntaxMap <- loadAllSnapshots "syntax/*.xml" "syntax"
<&> foldr (Sky.addSyntaxDefinition . itemBody) Sky.defaultSyntaxMap
pure $ defaultHakyllWriterOptions
{ writerExtensions = extensionsFromList
[ Ext_tex_math_dollars
, Ext_tex_math_double_backslash
, Ext_latex_macros
] <> writerExtensions defaultHakyllWriterOptions
, writerSyntaxMap = syntaxMap
, writerHighlightStyle = Just kate
}
rssfeed :: FeedConfiguration
rssfeed
= FeedConfiguration { feedTitle = "Abigail's Blag: Latest articles"
, feedDescription = ""
, feedAuthorName = "Abigail Magalhães"
, feedAuthorEmail = "magalhaes.alcantara@pucpr.edu.br"
, feedRoot = "https://abby.how"
}
conf :: Configuration
conf = def { destinationDirectory = ".site"
, storeDirectory = ".store"
, tmpDirectory = ".store/tmp"
, deployCommand = "./sync" }
main :: IO ()
main = hakyllWith conf $ do
let compiler = do
wops <- writerOptions
pandocCompilerWithTransformM readerOpts wops pure
match "static/*" $ do
route idRoute
compile copyFileCompiler
match "css/*.scss" $ do
route $ setExtension "css"
compile $ sassCompilerWith def { sassOutputStyle = SassStyleCompressed
, sassImporters = Nothing
}
match "pages/**/*" $ do
route $ setExtension "html"
compile $ do
id <- getUnderlying
meta <- getMetadata id
let category = takeWhile (/= '/') $ tail $ dropWhile (/= '/') (toFilePath id)
compiler
>>= loadAndApplyTemplate (fromFilePath ("templates/" ++ category ++ ".html")) (metaToContext meta)
>>= saveSnapshot "content"
match "pages/*.html" $ do
route $ gsubRoute "pages/" (const "")
compile $ do
ppl <- loadAll "pages/people/*"
let (ppl_a, ppl_b) = explode ppl
projects <- loadAll "pages/projects/*"
let indexCtx =
listField "people-1" postCtx (return ppl_a) <>
listField "people-2" postCtx (return ppl_b) <>
listField "projects" postCtx (return projects) <>
constField "title" "Home" <>
defaultContext
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
match "pages/*.md" $ do
route $ gsubRoute "pages/" (const "") <> setExtension "html"
compile $ compiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
postCtx :: Context String
postCtx = dateField "date" "%B %e, %Y"
<> defaultContext
pathFromTitle :: Metadata -> Routes
pathFromTitle meta =
let
declaredCategory =
case lookupString "category" meta of
Just s -> ((s ++ "/") ++)
Nothing -> ("posts/" <>)
!titleString =
case lookupString "title" meta of
Just s -> s
Nothing -> error "post has no title?"
title = filter (/= "") . map (filter isAlphaNum . map toLower) . words $ titleString
(category, title') =
if | "or" `elem` title -> (declaredCategory, takeWhile (/= "or") title)
| ["a", "quickie"] `isPrefixOf` title -> (("quick/" ++), drop 2 title)
| otherwise -> (declaredCategory, title)
in
case lookupString "path" meta of
Just p -> constRoute (category (p <> ".html"))
Nothing -> constRoute (category (intercalate "-" title' <> ".html"))
foldMapM :: (Monad w, Monoid m, Foldable f) => (a -> w m) -> f a -> w m
foldMapM k = foldr (\x y -> do { m <- k x; (m <>) <$> y }) (pure mempty)
explode :: [a] -> ([a], [a])
explode = go True where
go True (x:xs) =
let (as, bs) = go False xs
in (x:as, bs)
go False (x:xs) =
let (as, bs) = go True xs
in (as, x:bs)
go _ [] = ([], [])
metaToContext :: Object -> Context String
metaToContext obj = HMap.foldrWithKey go mempty obj <> defaultContext where
go :: T.Text -> Value -> Context String -> Context String
go key (String x) ctx = constField (T.unpack key) (T.unpack x) <> ctx
go key (Array xs) ctx = listField (T.unpack key) (Context jsonContext) (traverse makeItem (foldr (:) [] xs))
jsonContext key idk item = do
let x = itemBody item
objToField key x
objToField key x =
case x of
String x -> pure $ StringField (T.unpack x)
Object m -> objToField (tail (dropWhile (/= '.') key)) (fromJust (HMap.lookup (T.pack (takeWhile (/= '.') key)) m))
Array xs -> do
is <- traverse makeItem (foldr (:) [] xs)
pure $ ListField (Context jsonContext) is

6
stack.yaml Normal file
View File

@ -0,0 +1,6 @@
resolver: lts-16.20
extra-deps:
- hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939
- hsass-0.8.0@sha256:05fb3d435dbdf9f66a98db4e1ee57a313170a677e52ab3a5a05ced1fc42b0834,2899
- hlibsass-0.1.10.1@sha256:08db56c633e9a83a642d8ea57dffa93112b092d05bf8f3b07491cfee9ee0dfa5,2565

33
stack.yaml.lock Normal file
View File

@ -0,0 +1,33 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939
pantry-tree:
size: 217
sha256: c03e74e71d010f009b8d972efc31fbd6dd25183e6d9afbec55f4b7f0d4a74b47
original:
hackage: hakyll-sass-0.2.4@sha256:4d2fbd8b63f5ef15483fc6dda09e10eefd63b4f873ad38dec2a3607eb504a8ba,939
- completed:
hackage: hsass-0.8.0@sha256:05fb3d435dbdf9f66a98db4e1ee57a313170a677e52ab3a5a05ced1fc42b0834,2899
pantry-tree:
size: 1448
sha256: b25aeb947cb4e0b550f8a6f226d06503ef0edcb54712ad9cdd4fb2b05bf16c7c
original:
hackage: hsass-0.8.0@sha256:05fb3d435dbdf9f66a98db4e1ee57a313170a677e52ab3a5a05ced1fc42b0834,2899
- completed:
hackage: hlibsass-0.1.10.1@sha256:08db56c633e9a83a642d8ea57dffa93112b092d05bf8f3b07491cfee9ee0dfa5,2565
pantry-tree:
size: 11229
sha256: 39b62f1f3f30c5a9e12f9c6a040d6863edb5ce81951452e649152a18145ee1bc
original:
hackage: hlibsass-0.1.10.1@sha256:08db56c633e9a83a642d8ea57dffa93112b092d05bf8f3b07491cfee9ee0dfa5,2565
snapshots:
- completed:
size: 532177
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/20.yaml
sha256: 0e14ba5603f01e8496e8984fd84b545a012ca723f51a098c6c9d3694e404dc6d
original: lts-16.20

BIN
static/default-pfp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

3
sync Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
rsync .site/ "${SYNC_SERVER}:/var/www/offtopia.abby.how/" -vuar0

46
templates/default.html Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>$title$</title>
<link rel="stylesheet" type="text/css" href="/css/default.css" />
<!-- <link rel="apple-touch-icon" sizes="180x180" href="/static/icon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/icon/favicon-16x16.png"> -->
<meta property="og:type" content="website">
<meta property="og:title" content="offtopia.org">
<meta name="title" content="offtopia.org">
<noscript>
<style> .script { display: none } </style>
</noscript>
$if(fastbuild)$
<style>
.math {
color: red;
}
</style>
$endif$
</head>
<body>
<header>
<div id="header">
<div id="logo">
<a href="/">offtopia.org</a>
</div>
</div>
</header>
<div id="content">
<h1></h1>
$body$
</div>
</body>
</html>

52
templates/people.html Normal file
View File

@ -0,0 +1,52 @@
<details
class="person"
$if(background)$
style="background-color: $background$;"
$endif$
>
<summary class="header">
$if(pfp)$
<img class="pfp" alt="$name$'s profile picture" src="$pfp$" />
$else$
<div class="pfp default-pfp">
<img alt="$name$ does not have a profile picture" src="/static/default-pfp.png" />
</div>
$endif$
<div class="info">
<span class="name">
$if(link)$
<a href="$link$">$name$</a>
$else$
$name$
$endif$
</span>
<span class="pronouns">
$if(pronouns)$
$pronouns$
$else$
?/?
$endif$
</span>
</div>
</summary>
<div class="guts">
$body$
$if(projects)$
<h3>$name$'s projects</h3>
<ul>
$for(projects)$
<li>
<details class="project">
<summary>
<a href="$url$">$name$</a> <i>click to read more</i>
</summary>
$desc$
</details>
</li>
$endfor$
</ul>
$endif$
</div>
</details>

18
templates/projects.html Normal file
View File

@ -0,0 +1,18 @@
<h2>
$if(link)$
<a href="$link$">$name$</a>
$else$
$name$
$endif$
</h2>
$if(participants)$
<span>
People involved:
$for(participants)$
<span class="author">$name$</span>$sep$,
$endfor$
</span>
$endif$
$body$