var fs = require('fs');
var path = require('path');


module.exports = function(o) {
    if(!o.templates) return console.error('Missing template directory');
    if(!o.input) return console.error('Missing input');
    if(!o.output) return console.error('Missing output');

    var cwd = process.cwd();
    var albumTemplate = path.join(o.templates, 'album.html');
    var photoTemplate = path.join(o.templates, 'photo.html');
    var config = o.config? require(path.join(cwd, o.config)): {};

    if(!fs.existsSync(albumTemplate)) return console.error('Template directory is missing album.html');
    if(!fs.existsSync(photoTemplate)) return console.error('Template directory is missing photo.html');

    console.log('should convert now');
};

@@ -45,16 +45,131 @@
 path');%0A
+var extend = require('util')._extend;%0A%0Avar handlebars = require('handlebars');%0Avar walker = require('filewalker');%0A
 %0A%0Amodule
@@ -423,24 +423,20 @@
 ar album
-Template
+Path
  = path.
@@ -481,24 +481,20 @@
 ar photo
-Template
+Path
  = path.
@@ -620,24 +620,20 @@
 nc(album
-Template
+Path
 )) retur
@@ -720,24 +720,20 @@
 nc(photo
-Template
+Path
 )) retur
@@ -802,40 +802,962 @@
     
-console.log('should convert now'
+var albumTemplate = handlebars.compile(fs.readFileSync(albumPath, 'utf-8'));%0A    var photoTemplate = handlebars.compile(fs.readFileSync(photoPath, 'utf-8'));%0A%0A    if(!fs.existsSync(o.output)) fs.mkdirSync(o.output);%0A%0A    walker(o.input).on('file', function(p) %7B%0A        if(p%5B0%5D == '.') return;%0A        if(path.basename(p)%5B0%5D == '.') return;%0A%0A        var ip = '/' + path.join(o.output, 'images', p);%0A        var pp = path.join(o.output, p).replace(path.extname(p), '.html');%0A%0A        var data = photoTemplate(extend(config, %7B%0A            photo: %7B%0A                src: ip,%0A                width: 100, // TODO%0A                height: 100 // TODO%0A            %7D%0A        %7D));%0A%0A        var dirname = path.dirname(pp);%0A        if(!fs.existsSync(dirname)) fs.mkdirSync(dirname);%0A%0A        fs.writeFile(pp, data, function(err) %7B%0A            if(err) return console.error(err);%0A        %7D);%0A    %7D).on('done', function() %7B%0A        // TODO: write albums now%0A    %7D).walk(
 );%0A%7D

Output individual photo pages