initial commit

i guess it's a pandoc blog now!
main
Christopher P. Brown 2022-03-01 16:07:01 -07:00
commit 938049d1cc
21 changed files with 313 additions and 0 deletions

0
.gitignore vendored 100644
View File

29
Makefile 100644
View File

@ -0,0 +1,29 @@
SRCS := $(shell find content pages -name '*.md')
HTML := $(SRCS:content/%.md=%.html)
HTML := $(HTML:pages/%.md=%.html)
vpath %.md content pages
vpath %.html dist
%.html: %.md
pandoc -t html \
--standalone \
-B templates/nav.html \
--css assets/styles/main.css \
--toc \
-o dist/$@ $<
index.md:
./bin/build-index.sh
rssfeed:
./bin/build-feed.sh
build: $(HTML) index.md rssfeed
cp -R assets dist
pandoc -t html \
--standalone \
-H templates/header.html \
-B templates/nav.html \
-o dist/index.html \
--css assets/styles/main.css \
index.md app.yaml

19
README.md 100644
View File

@ -0,0 +1,19 @@
# Pandoc Blog
this is a static website that uses pandoc and pandoc templates to build a blog
## Getting Started
- add content to `/content`. The filename must be in `yyyy-mm-dd-file-name.md` format. This is how the blog posts are ordered, because the tool is not very smart.
- other "pages" go in `/pages`
That's kind of it..
You'll need to edit a bunch of values in index.yml and build-feed.sh where it's hard coded.
images and styles go in `/assets`.
## Resources
- <https://pandoc.org/MANUAL.html#variables>
- <https://pandoc.org/MANUAL.html#templates>

5
app.yaml 100644
View File

@ -0,0 +1,5 @@
---
title: welcome to my blog
subtitle: it is where i write stuff
author: dozens
---

View File

@ -0,0 +1,141 @@
* {
box-sizing: border-box;
}
html {
line-height: 1.5;
font-family: Georgia, serif;
font-size: 22px;
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 60ch;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 1em;
}
}
@media print {
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, 'Lucida Console', Consolas, monospace;
font-size: 85%;
margin: 0;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}

19
bin/build-feed.sh 100755
View File

@ -0,0 +1,19 @@
#!/bin/zsh
title=blog
description="yrafn afuynta arr a ar"
baseurl="http://tilde.town/~dozens/gamelog"
link="$baseurl/index.html"
href="$baseurl/feed.xml"
outfile="dist/feed.xml"
echo "<rss version=\"2.0\"><channel><title>$title</title>" > $outfile
echo "<link>$link</link><description>$description</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"$href\"/>" >> $outfile
for file in $(ls -1 content/*.md | sort -r)
do
dest="${$(basename $file)/md/html}"
pandoc --template=templates/rss-feed-item.template --variable=url:"$baseurl/$dest" $file >> $outfile
done
echo '</channel></rss>' >> $outfile

View File

@ -0,0 +1,8 @@
#!/bin/zsh
cat templates/index-before.html > index.md
for file in $(ls -1 content/*.md | sort -r)
do
dest="${$(basename $file)/md/html}"
pandoc --template=templates/blog-list-item.template --variable=url:$dest $file >> index.md
done

View File

@ -0,0 +1,9 @@
---
title: hello world!
subtitle: a whole new blog
date: 2022-01-01
toc-title: Contents
---
Hola, Wikipedia!
I started a new blog! Isn't that just really special?

View File

@ -0,0 +1,31 @@
---
title: giraffes
subtitle: a long necked hoax?
date: 2022-02-01
updated: 2022-02-20
toc-title: Contents
---
## Intro
**Edit**: It has been brought to my attention that giraffes are actually real. I am willing to admit my mistakes, and stand corrected. You have to admit that they are *unlikely* though.
---
I mean, have you ever even seen a giraffe?
they look like aliens.
## Too tall
long legs
## Too long
all that neck, and still only 7 neckbones. same as a field mouse, same as any other mammal. what you trying to prove?
## Black tongue
maybe try washing that thing
## horns?
what you even got horns for dude?

0
dist/.gitkeep vendored 100644
View File

3
index.md 100644
View File

@ -0,0 +1,3 @@
<p>These are all of my blog posts:</p>
- [giraffes](2022-02-01-giraffes.html): long neck hoax? --- 2022-02-20
- [hello world!](2022-01-01-hello-world.html): a whole new blog --- 2022-01-01

20
justfile 100644
View File

@ -0,0 +1,20 @@
# show all recipes
default:
just --list
# build
build:
make build
# watch for changes
watch:
ls content/*.md | entr make build
# upload
up:
echo "TODO"
# clean dist
clean:
rm -rf dist/*
touch dist/.gitkeep

5
pages/about.md 100644
View File

@ -0,0 +1,5 @@
---
title: about
subtitle: what is all this anyway
---
honestly it's whatever you want it to be, dreamchild

6
pages/contact.md 100644
View File

@ -0,0 +1,6 @@
---
title: contact
subtitle: stay in touch!
---
- dozens@tilde.team
- @dozens@tiny.tilde.website

View File

@ -0,0 +1 @@
- [$title$]($url$): $subtitle$ --- $if(updated)$$updated$$else$$date$$endif$

View File

View File

View File

@ -0,0 +1 @@
<link rel="alternate" type="application/rss+xml" href="feed.xml" title="my awesome blog name">

View File

@ -0,0 +1 @@
<p>These are all of my blog posts:</p>

View File

@ -0,0 +1,7 @@
<nav>
<p>
<a href="index.html">home</a>
| <a href="about.html">about</a>
| <a href="contact.html">contact</a>
</p>
</nav>

View File

@ -0,0 +1,8 @@
<item>
<title>$title$</title>
<link>$url$</link>
<pubDate>$date$</pubDate>
<description>
$body$
</description>
</item>