Added initial rules.
h3rald h3rald@h3rald.com
Fri, 03 Nov 2017 18:34:44 +0100
5 files changed,
76 insertions(+),
4 deletions(-)
A
site/contents/home.md
@@ -0,0 +1,6 @@
+----- +content-type: "page" +title: "HastySite — A simple but highly-configurable static site generator" +----- + +Content will be added *here*...
M
site/rules.min
→
site/rules.min
@@ -0,0 +1,67 @@
+'hastysite import + +;Routing +( + (dict) expect -> =meta + meta /id :id + meta /ext :ext + ( + ((id "home" ==) ( + meta ( + ("index" %id) + (".html" %ext) + ) tap + )) + ((ext ".md" ==) ( + meta ( + (".html" %ext) + ("$1/index" (id) => % %id) + ) tap + )) + ) case +) :set-destination + +;Process Markdown content +( + (dict) expect -> =meta + "" :page + "" :contents + meta /content-type :tpl + meta ( + (input-fread @contents meta) + (settings /title %site-title) + (settings /description %site-description) + (=temp contents temp markdown @contents temp) + (contents %contents) + (=temp tpl temp mustache @page temp) + (page %contents) + ) tap +) :process-content + +;Process CSS asset +( + (dict) expect -> =meta + "" :contents + meta ( + (input-fread @contents meta) + (=temp contents preprocess-css @contents temp) + (contents %contents) + ) tap + output-fwrite +) :process-css-asset + +;Main +contents ( + (dict) expect -> + process-content set-destination output-fwrite +) foreach + +assets ( + (dict) expect -> + dup + ( + ((/ext ".css" match) (process-css-asset)) + ((/id "^\." match) ()) ;Ignore hidden files + ((true) (output-cp)) + ) case +) foreach
M
site/scripts/build.min
→
site/scripts/build.min
@@ -1,7 +1,6 @@
;Builds a site by processing contents and assets. 'hastysite import -clean-temp "Preprocessing..." notice preprocess "Processing rules.." notice
M
site/settings.json
→
site/settings.json
@@ -6,6 +6,6 @@ "temp": "temp",
"output": "output", "scripts": "scripts", "title": "HastySite", - "descriotion": "A simple but powerful static site generator", + "description": "A simple but powerful static site generator", "rules": "rules.min" }
M
site/templates/_head.mustache
→
site/templates/_head.mustache
@@ -1,8 +1,8 @@
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content="{{description}}"> - <title>{{site}} - {{title}}</title> + <meta name="description" content="{{site-description}}"> + <title>{{site-title}} - {{title}}</title> <link rel="stylesheet" href="/styles/hastyscribe.css"> <link rel="stylesheet" href="/styles/luxbar.css"> </head>