Created
November 16, 2011 03:43
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat <<EOF > sample.txt | |
> title: Sample! | |
> | |
> = {{ title }} = | |
> EOF | |
$ yaml-assemble sample.txt | mustache | creole2html | |
<h1>Sample!</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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