all repos — hastysite @ 5d073c49e1b43530b829a7d203a72490213724df

A high-performance static site generator.

Minor fixes.
h3rald h3rald@h3rald.com
Sun, 16 Jul 2017 12:43:02 +0200
commit

5d073c49e1b43530b829a7d203a72490213724df

parent

3363b335b7971bc7a3ff27fd2fb4fb11cc9cfbe0

1 files changed, 4 insertions(+), 8 deletions(-)

jump to
M hastysite.nimhastysite.nim

@@ -47,13 +47,10 @@

const SCRIPT_BUILD = "./scripts/build.min".slurp const SCRIPT_CLEAN = "./scripts/clean.min".slurp -let PEG_CSS_VAR_DEF = peg""" - definition <- '--' {id} ':' {@} ';' - id <- [a-zA-Z0-9_-]+ - """ +let PEG_CSS_VAR_DEF = peg"""'--' {[a-zA-Z0-9_-]+} ':' {@} ';'""" let PEG_CSS_VAR_INSTANCE = peg""" - instance <- 'var(--' {id} ')' - id <- [a-zA-Z0-9_-]+ + instance <- 'var(--' {id} ')' + id <- [a-zA-Z0-9_-]+ """ var CSS_VARS = initTable[string, string]()

@@ -68,7 +65,6 @@ discard def.match(PEG_CSS_VAR_DEF, matches)

let id = matches[0].strip let value = matches[1].strip CSS_VARS[id] = value - result = result.replace(def, "") for instance in result.findAll(PEG_CSS_VAR_INSTANCE): var matches: array[0..1, string] discard instance.match(PEG_CSS_VAR_INSTANCE, matches)

@@ -76,7 +72,7 @@ let id = matches[0].strip

if CSS_VARS.hasKey(id): result = result.replace(instance, CSS_VARS[id]) else: - stderr.writeLine("CSS variables '$1' is not defined." % ["--" & id]) + stderr.writeLine("CSS variable '$1' is not defined." % ["--" & id]) proc preprocessContent(file, dir: string, obj: var JsonNode): string = let fileid = file.replace(dir, "")