Skip to content

Instantly share code, notes, and snippets.

@acdimalev
Created March 22, 2013 18:12
Show Gist options
  • Save acdimalev/5223493 to your computer and use it in GitHub Desktop.
Save acdimalev/5223493 to your computer and use it in GitHub Desktop.
make website
CONTENT = $(addsuffix .html,$(addprefix http/,$(notdir $(wildcard content/*))))
all: $(CONTENT) http/index.html
clean:
rm -r http
mkdir http
http/%.html: content/% script.content.html.sh template.content.html
mkdir -p $(dir $@)
sh script.content.html.sh $< < template.content.html > $@
http/index.html: content/* script.index.html.sh template.index.html
sh script.index.html.sh < template.index.html > http/index.html
export content="$(markdown $1)"
python script.format.py
from string import Template
from sys import stdin
from os import environ
import re
d = dict()
for key in environ:
if (not re.match("[a-z]", key)): continue
d[key] = environ[key]
print Template(stdin.read()).substitute(d),
content=''
for item in $(ls content | sort -rn | head -n8); do
content="$content<div><a href=\"$item.html\">$item</a></div>"
done
export content
python script.format.py
<!DOCTYPE html>
<html>
<head><title>scribblebound.com</title></head>
<body>$content</body>
</html>
<!DOCTYPE html>
<html>
<head><title>scribblebound.com</title></head>
<body>$content</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment