inittles committles

main
Dozens B. McCuzzins 2022-01-24 17:51:30 -07:00
commit 7ab4f235cf
4 changed files with 113 additions and 0 deletions

60
README.md 100644
View File

@ -0,0 +1,60 @@
# Gardener 🌱
This is a tool for making a weed.
weed
: short for "web feed"
: an rss-only blog
(All of the content is in the RSS feed. There is no web content.)
## About
This uses pandoc's `--template` flag to create an rss feed item.
See `feed.tmpl`.
## Motivation
RSS is dead, but we never stopped using it.
We are the necromancers who fill it with the foul mimicry of life.
## Requirements
- [pandoc](https://pandoc.org/)
- [casey/just](https://github.com/casey/just)
- [sharkdp/fd](https://github.com/sharkdp/fd)
## Getting Started
1. Edit the `vars` section at the top of the justfile
2. Edit the `author` tag in `feed.tmpl`. Or, as a learning exercise, change the contents of the tag to `$author$` and start including an "author" value in the front matter of all your markdown sources. See how that works?
3. Create a new markdown file in `/src`
4. Give it the following YAML metadata block
```
---
title: 'title of my post'
created_at: 'Mon, 24 Jan 2022 17:26:03 -0700'
---
```
Note that values need to be quoted.
Note further that the timestamp should in RFC 5532 format. (`date -R`)
5. Write the rest of your post
6. Run `just build` to assemble your xml
7. Edit the `up` recipe in the justfile so you can upload to your server.
8. If you're feeling swoopy, run `just all` to build and upload in one fell swoop.
## Acknowledgments
Thanks to the #basement crew for making such a lovely garden full of beautiful weeds <3

11
feed.tmpl 100644
View File

@ -0,0 +1,11 @@
<item>
<title>$if(title)$$title$$else$Title Unknown$endif$</title>
<author>TODO: FIXME</author>
<guid isPermaLink="false">$if(created_at)$$created_at$$else$Unknown Date$endif$</guid>
<pubDate>$if(created_at)$$created_at$$else$Unknown Date$endif$</pubDate>
<description>
<![CDATA[
$body$
]]>
</description>
</item>

37
justfile 100644
View File

@ -0,0 +1,37 @@
# vars
feed_title := "confessions of a gardener"
feed_desc := "all about my dirty life and times"
feed_href := "https://example.com/weed/feed.xml"
outfile := "feed.xml"
# show all available commands
default:
just --list
# build feed.xml
build:
#!/bin/sh
echo "Building xml file!!"
echo "<?xml version=\"1.0\" ?>" > {{outfile}}
echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">" >> {{outfile}}
echo " <channel>" >> {{outfile}}
echo " <atom:link href=\"{{feed_href}}\" rel=\"self\" type=\"application/rss+xml\" />" >> {{outfile}}
echo " <title>{{feed_title}}</title>" >> {{outfile}}
echo " <link>{{feed_href}}</link>" >> {{outfile}}
echo " <description>{{feed_desc}}</description>" >> {{outfile}}
fd . 'src/' -e md -x pandoc --template=feed.tmpl >> {{outfile}}
echo " </channel>" >> {{outfile}}
echo "</rss> " >> {{outfile}}
echo "Done building xml file \o/"
# upload feed.xml
up:
@echo "Uploading to server!!"
#@rsync -azP feed.xml server:www/weed/
@echo "Done uploading to server \o/"
# build and upload
all: build up
@echo "Roger dodger, it's all done: you have tended your garden 🌱"

5
src/00001.md 100644
View File

@ -0,0 +1,5 @@
---
title: 'the beginning of our adventure together'
created_at: 'Mon, 24 Jan 2022 17:34:36 -0700'
---
So the other day I was riding my bike, and....