File partials

extract inline resources into external partials

Also, fix ERB template interpolation.