~h3rald/hastysite

a16434197dfb0c6a05070ad6ed3f4c2be68e3a74 — h3rald 1 year, 3 months ago 90a6e39
Started to upgrade HastyScribe to v2, migrating to nim-mustache.
A hastyscribepkg/vendor/markdown/linux/libmarkdown.a => hastyscribepkg/vendor/markdown/linux/libmarkdown.a +0 -0
A hastyscribepkg/vendor/markdown/macosx/libmarkdown.a => hastyscribepkg/vendor/markdown/macosx/libmarkdown.a +0 -0
A hastyscribepkg/vendor/markdown/windows/libmarkdown.a => hastyscribepkg/vendor/markdown/windows/libmarkdown.a +0 -0
M hastysite.nim => hastysite.nim +18 -14
@@ 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 @@ proc hastysite_module*(i: In, hs1: HastySite) =
    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.nimble => hastysite.nimble +1 -7
@@ 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.nim => hastysitepkg/config.nim +1 -1
@@ 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 => nifty.json +0 -54
@@ 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
    }
  }
}