all repos — hastysite @ a16434197dfb0c6a05070ad6ed3f4c2be68e3a74

A high-performance static site generator.

Started to upgrade HastyScribe to v2, migrating to nim-mustache.
h3rald h3rald@h3rald.com
Fri, 01 Sep 2023 12:09:06 +0000
commit

a16434197dfb0c6a05070ad6ed3f4c2be68e3a74

parent

90a6e392411ff3d1608ba4ddd50d235196afc7f3

M hastysite.nimhastysite.nim

@@ -1,23 +1,23 @@

import - json, - strutils, - os, - sequtils, - tables, - critbits, - streams, - parsecfg, + std/json, + std/strutils, + std/os, + std/sequtils, + std/tables, + std/critbits, + std/streams, + std/parsecfg, checksums/sha1, - logging, - pegs + std/logging, + std/pegs when defined(linux): {.passL:"-static".} import min, - packages/hastyscribe/src/hastyscribe, - packages/moustachu/src/moustachu + hastyscribe, + mustache import hastysitepkg/config

@@ -420,10 +420,14 @@ def.symbol("mustache") do (i: In):

var vals = i.expect(["dict", "str"]) let c = vals[0] let t = vals[1] - let ctx = newContext(i%c) + let json = i%c + let ctx = newContext() + for key, val in json: + ctx[key] = val.getStr + ctx["searchDirs"] = @[hs.dirs.templates] let tplname = t.getString & ".mustache" let tpl = readFile(hs.dirs.templates/tplname) - i.push tpl.render(ctx, hs.dirs.templates).newval + i.push tpl.render(ctx).newval def.symbol("markdown") do (i: In) {.gcsafe.}: var vals = i.expect(["dict", "str"])
M hastysite.nimblehastysite.nimble

@@ -9,13 +9,7 @@ bin = @["hastysite"]

installDirs = @["minpkg", "hastysitepkg"] # Deps -requires: "nim >= 2.0.0, min >= 0.39.2, checksums" - -before install: - exec "nimble install -y nifty" - exec "nifty remove -f" - exec "nifty install" - exec "nifty build discount" +requires: "nim >= 2.0.0, min >= 0.39.2, checksums, hastyscribe >= 2.0.0, mustache" # Tasks const
M hastysitepkg/config.nimhastysitepkg/config.nim

@@ -1,5 +1,5 @@

const pkgName* = "HastySite" - pkgVersion* = "1.3.8" + pkgVersion* = "1.4.0" pkgDescription* = "A small but powerful static site generator" pkgAuthor* = "Fabio Cevasco"
D nifty.json

@@ -1,54 +0,0 @@

-{ - "storage": "packages", - "commands": { - "install": { - "git+src": { - "cmd": "git clone {{src}} --depth 1" - }, - "git+src+tag": { - "cmd": "git clone --branch {{tag}} {{src}} --depth 1" - }, - "curl+src+name": { - "cmd": "curl {{src}} -o {{name}}" - }, - "_syntax": "install [<package>]", - "_description": "Installs the specified package (or all mapped packages) to the storage directory." - }, - "build": { - "name+configure.sh": { - "pwd": "{{name}}", - "cmd": "sh configure.sh --github-checkbox=input && make" - } - }, - "upgrade": { - "_syntax": "upgrade [<package>]", - "_description": "Upgrades the specified previously-installed package (or all packages).", - "git+name": { - "cmd": "git pull", - "pwd": "{{name}}" - }, - "curl+src+name": { - "cmd": "curl {{src}} -o {{name}}" - } - } - }, - "packages": { - "discount": { - "configure.sh": true, - "name": "discount", - "src": "https://github.com/Orc/discount.git", - "tag": "v2.2.7", - "git": true - }, - "hastyscribe": { - "name": "hastyscribe", - "git": true, - "src": "https://github.com/h3rald/hastyscribe.git" - }, - "moustachu": { - "name": "moustachu", - "src": "https://github.com/fenekku/moustachu", - "git": true - } - } -}