Moved static hosting to Netlify.

This commit is contained in:
Jonathan Bernard 2017-02-15 15:25:42 -06:00
parent 4f93b3132a
commit b58bb91ffb
20 changed files with 58 additions and 29 deletions

1
website/.netlify Normal file
View File

@ -0,0 +1 @@
{"site_id":"40aedb36-8379-4429-94ff-e59e9d740396","path":"rendered"}

5
website/Makefile Normal file
View File

@ -0,0 +1,5 @@
deploy: render
netlify deploy -s newlifeintroband -p rendered
render:
nim c -r make_site.nim

View File

@ -0,0 +1 @@
../../s3-dir-listing.html

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1 @@
../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../../s3-dir-listing.html

View File

@ -0,0 +1 @@
../../s3-dir-listing.html

View File

@ -2,12 +2,20 @@
# author: Jonathan Bernard <jonathan@jdbernard.com> # author: Jonathan Bernard <jonathan@jdbernard.com>
# #
# Stupid-simple static site generator. Operates on the current working # Stupid-simple static site generator. Operates on the current working
# directory. Outputs rendered HTML to a directory named 'rendered'. Reads in an # directory. Outputs rendered HTML to a directory named 'rendered'.
# HTML template from a file 'template.html'. Walks the current working directory #
# looking for files with the '.rst' extension, splits out optional front-matter # 1. Reads in an HTML template from a file 'template.html'.
# (JSON), compiles the rest into HTML fragments, stuffs the fragments into the # 3. Walks the 'content' directory looking for files.
# template and write an HTML file at the same relative path in the 'rendered' #
# a. For all files with the '.md' extension:
# i. splits out optional front-matter (JSON),
# ii. compiles the rest into HTML fragments,
# iii. stuffs the fragments into the template, and
# iv. writes an HTML file at the same relative path in the 'rendered'
# directory with the same filename (extension changed to .html). # directory with the same filename (extension changed to .html).
#
# b. For all other files, copies them verbatim into the same relative path
# in the 'rendered' directory.
import json, nre, os, osproc import json, nre, os, osproc
from strutils import endsWith, rfind from strutils import endsWith, rfind
@ -22,16 +30,19 @@ let tempFile = "temp.make_site.md"
if not dirExists("rendered"): createDir("rendered") if not dirExists("rendered"): createDir("rendered")
# Walk the directory looking for .md files. # Walk the directory looking for .md files.
for file in walkDirRec("."): for file in walkDirRec("content", {pcFile, pcDir, pcLinkToFile}):
if not file.endsWith(".md"): continue #echo "Considering " & file
let dir = file[8..file.rfind('/')]
let filename = file[(file.rfind('/') + 1)..^1]
echo "> Rendering " & file # Create output subdir if necessary
if not existsDir("rendered/" & dir): createDir("rendered/" & dir)
if filename.endsWith(".md"):
echo "> Rendering " & dir & filename
var renderedTemplate = htmlTemplate var renderedTemplate = htmlTemplate
var mdDoc: string var mdDoc: string
let outputFile = "rendered/" & file.replace(mdExtRe, "html") let outputFile = "rendered/" & dir & filename.replace(mdExtRe, "html")
let outputDir = "rendered/" & file[0..file.rfind('/')]
if not existsDir(outputDir): createDir(outputDir)
# Split out front-matter # Split out front-matter
let docSplit = file.readFile.split(re"\+\+\+", 2) let docSplit = file.readFile.split(re"\+\+\+", 2)
@ -52,4 +63,8 @@ for file in walkDirRec("."):
writeFile(outputFile, renderedTemplate) writeFile(outputFile, renderedTemplate)
else:
echo "> Copying " & dir & filename
copyFile(file, "rendered/" & dir & filename);
removeFile(tempFile) removeFile(tempFile)