all repos — hastysite @ 3ddd11ac77ca65524207ee0d6717660982c99269

A high-performance static site generator.

Added operators to manage settings and metadata.
h3rald h3rald@h3rald.com
Tue, 01 Nov 2016 07:49:36 +0100
commit

3ddd11ac77ca65524207ee0d6717660982c99269

parent

38160727f110cd2cc861cd5b42670e9156275219

1 files changed, 24 insertions(+), 2 deletions(-)

jump to
M hastysite.nimhastysite.nim

@@ -32,9 +32,9 @@ checksums: string

modified: seq[string] HastySite* = object settings*: JsonNode + metadata*: JsonNode dirs*: HastyDirs files*: HastyFiles - metadata*: JsonNode NoMetadataException* = ref Exception DictionaryRequiredException* = ref Exception

@@ -46,10 +46,32 @@ i.define("hastysite")

.symbol("metadata") do (i: In): i.push i.fromJson(hs.metadata) + + .symbol("mget") do (i: In): + var s: MinValue + i.reqStringLike s + i.push i.fromJson(hs.metadata[s.getString]) + + .symbol("mset") do (i: In): + var s: MinValue + i.reqStringLike s + let v = i.pop + hs.metadata[s.getString] = %v .symbol("settings") do (i: In): i.push i.fromJson(hs.settings) + .symbol("sget") do (i: In): + var s: MinValue + i.reqStringLike s + i.push i.fromJson(hs.settings[s.getString]) + + .symbol("sset") do (i: In): + var s: MinValue + i.reqStringLike s + let v = i.pop + hs.settings[s.getString] = %v + .symbol("modified") do (i: In): var modified = newSeq[MinValue](0) for s in hs.files.modified:

@@ -77,7 +99,7 @@ let m = i.pop

i.reqStringLike k i.apply(i.scope.getSymbol("context")) i.reqDictionary q - i.push i.dset(q, k, m) + i.dset(q, k, m) .symbol("mustache") do (i: In): var t, c: MinValue