require 'mmm' import render from require 'mmm.mmmfs' -- usage: -- moon render.moon { root } = arg assert root, "please specify the relative root path as an argument" require 'lfs' cwd = lfs.currentdir! path = '' while root\find '^%.%./' root = root\match '^%.%./(.*)' cwd, trimmed = cwd\match '(.*)(/[^/]+)$' path = trimmed .. path root = dofile '$bundle.lua' assert root, "couldn't load $bundle.lua" root\mount path, true content, rehydrate = render root, path assert content, "no content" with io.open 'index.html', 'w' \write " MMM: lunar low-gravity scripting playground #{content} #{rehydrate} " \close!