Moved static hosting to Netlify.
This commit is contained in:
parent
4f93b3132a
commit
b58bb91ffb
1
website/.netlify
Normal file
1
website/.netlify
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"site_id":"40aedb36-8379-4429-94ff-e59e9d740396","path":"rendered"}
|
5
website/Makefile
Normal file
5
website/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
deploy: render
|
||||||
|
netlify deploy -s newlifeintroband -p rendered
|
||||||
|
|
||||||
|
render:
|
||||||
|
nim c -r make_site.nim
|
1
website/content/agendas/index.html
Symbolic link
1
website/content/agendas/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../s3-dir-listing.html
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
1
website/content/lead-sheets/index.html
Symbolic link
1
website/content/lead-sheets/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../s3-dir-listing.html
|
1
website/content/reference-tracks/clicks/index.html
Symbolic link
1
website/content/reference-tracks/clicks/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../s3-dir-listing.html
|
@ -0,0 +1 @@
|
|||||||
|
../../../s3-dir-listing.html
|
1
website/content/reference-tracks/freedome-eddie-james/index.html
Symbolic link
1
website/content/reference-tracks/freedome-eddie-james/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../s3-dir-listing.html
|
1
website/content/reference-tracks/index.html
Symbolic link
1
website/content/reference-tracks/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../s3-dir-listing.html
|
@ -0,0 +1 @@
|
|||||||
|
../../../s3-dir-listing.html
|
1
website/content/schedules/index.html
Symbolic link
1
website/content/schedules/index.html
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../s3-dir-listing.html
|
@ -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'
|
#
|
||||||
# directory with the same filename (extension changed to .html).
|
# 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).
|
||||||
|
#
|
||||||
|
# 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,34 +30,41 @@ 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
|
||||||
var renderedTemplate = htmlTemplate
|
if not existsDir("rendered/" & dir): createDir("rendered/" & dir)
|
||||||
var mdDoc: string
|
|
||||||
let outputFile = "rendered/" & file.replace(mdExtRe, "html")
|
|
||||||
let outputDir = "rendered/" & file[0..file.rfind('/')]
|
|
||||||
|
|
||||||
if not existsDir(outputDir): createDir(outputDir)
|
if filename.endsWith(".md"):
|
||||||
|
echo "> Rendering " & dir & filename
|
||||||
|
var renderedTemplate = htmlTemplate
|
||||||
|
var mdDoc: string
|
||||||
|
let outputFile = "rendered/" & dir & filename.replace(mdExtRe, "html")
|
||||||
|
|
||||||
# Split out front-matter
|
# Split out front-matter
|
||||||
let docSplit = file.readFile.split(re"\+\+\+", 2)
|
let docSplit = file.readFile.split(re"\+\+\+", 2)
|
||||||
|
|
||||||
# Parse the front-matter (if there is any)
|
# Parse the front-matter (if there is any)
|
||||||
if docSplit.len > 1:
|
if docSplit.len > 1:
|
||||||
let metadata = json.parseJson(docSplit[0])
|
let metadata = json.parseJson(docSplit[0])
|
||||||
mdDoc = docSplit[1]
|
mdDoc = docSplit[1]
|
||||||
for key, value in metadata:
|
for key, value in metadata:
|
||||||
let replKey = re("<%" & key & "%>")
|
let replKey = re("<%" & key & "%>")
|
||||||
renderedTemplate = htmlTemplate.replace(replKey, value.getStr)
|
renderedTemplate = htmlTemplate.replace(replKey, value.getStr)
|
||||||
else: mdDoc = docSplit[0]
|
else: mdDoc = docSplit[0]
|
||||||
|
|
||||||
# Compile the file into an HTML fragment
|
# Compile the file into an HTML fragment
|
||||||
writeFile(tempFile, mdDoc)
|
writeFile(tempFile, mdDoc)
|
||||||
let htmlDoc = execProcess("markdown " & tempFile)
|
let htmlDoc = execProcess("markdown " & tempFile)
|
||||||
renderedTemplate = renderedTemplate.replace(contentKey, htmlDoc)
|
renderedTemplate = renderedTemplate.replace(contentKey, htmlDoc)
|
||||||
|
|
||||||
writeFile(outputFile, renderedTemplate)
|
writeFile(outputFile, renderedTemplate)
|
||||||
|
|
||||||
|
else:
|
||||||
|
echo "> Copying " & dir & filename
|
||||||
|
copyFile(file, "rendered/" & dir & filename);
|
||||||
|
|
||||||
removeFile(tempFile)
|
removeFile(tempFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user