Skip to content

Instantly share code, notes, and snippets.

@jtacoma
Created November 16, 2011 03:43
Show Gist options
  • Save jtacoma/1369175 to your computer and use it in GitHub Desktop.
Save jtacoma/1369175 to your computer and use it in GitHub Desktop.
Some static site generation ideas based on jekyll, blosxom, and something from 1997 I forget the name of, that did all kinds of crazy stuff.
$ cat <<EOF > sample.txt
> title: Sample!
>
> = {{ title }} =
> EOF
$ yaml-assemble sample.txt | mustache | creole2html
<h1>Sample!</h1>
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage: yaml-assemble <input-file-name>"
exit -1
fi
echo ---
(
cat front.yaml ;
sed -e '/^$/,$d' "$1" ;
) | yaml-merge
echo ---
sed -e '0,/^$/d' "$1"
#!/usr/bin/env python3
import fileinput
import yaml
data = ''
for line in fileinput.input():
data += line;
print(yaml.dump(yaml.load(data), default_flow_style=False).strip())
#!/usr/bin/env python3
import sys
import yaml
key = sys.argv[1]
value = sys.argv[2]
if value == '-':
value = sys.stdin.read()
data = {}
data[key] = value.strip()
print(yaml.dump(data, default_flow_style=False).strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment