Changes to support min v0.8.0.
h3rald h3rald@h3rald.com
Sat, 08 Jul 2017 14:22:50 +0000
1 files changed,
12 insertions(+),
14 deletions(-)
jump to
M
hastysite.nim
→
hastysite.nim
@@ -226,8 +226,8 @@ def.symbol("output") do (i: In):
i.push hs.dirs.output.newVal def.symbol("input-fread") do (i: In): - var d: MinValue - i.reqDictionary d + var vals = i.expect(["dict"]) + var d = vals[0] let t = d.dget("type".newVal).getString let path = d.dget("path".newVal).getString var contents = ""@@ -238,8 +238,8 @@ contents = readFile(hs.dirs.assets/path)
i.push contents.newVal def.symbol("output-fwrite") do (i: In): - var d: MinValue - i.reqDictionary d + var vals = i.expect(["dict"]) + var d = vals[0] let id = d.dget("id".newVal).getString let ext = d.dget("ext".newVal).getString var contents = ""@@ -252,8 +252,8 @@ outfile.parentDir.createDir
writeFile(outfile, contents) def.symbol("copy2output") do (i: In): - var d: MinValue - i.reqDictionary d + var vals = i.expect(["dict"]) + var d = vals[0] let t = d.dget("type".newVal).getString let path = d.dget("path".newVal).getString var infile, outfile: string@@ -268,20 +268,18 @@ outfile.parentDir.createDir
copyFileWithPermissions(infile, outfile) def.symbol("mustache") do (i: In): - var t, c: MinValue - i.reqQuotationAndString c, t - if not c.isDictionary: - raise DictionaryRequiredException(msg: "No dictionary provided as template context.") + var vals = i.expect(["dict", "str"]) + let c = vals[0] + let t = vals[1] let ctx = newContext(%c) let tplname = t.getString & ".mustache" let tpl = readFile(hs.dirs.templates/tplname) i.push tpl.render(ctx, hs.dirs.templates).newval def.symbol("markdown") do (i: In): - var t, c: MinValue - i.reqQuotationAndString c, t - if not c.isDictionary: - raise DictionaryRequiredException(msg: "No dictionary provided for markdown processor fields.") + var vals = i.expect(["dict", "str"]) + let c = vals[0] + let t = vals[1] let options = HastyOptions(toc: false, output: nil, css: nil, watermark: nil, fragment: true) var fields = initTable[string, proc():string]() for item in c.qVal: