var fs = require('fs');
var path = require('path');
var when = require('when');
var nodefn = require('when/node');
var microformat = require('./microformat');
var site = require('./site');
var util = require('./util');

function regexFilter(pat, files) {
    var re = new RegExp(pat);
    return files.filter(re.exec.bind(re));
}

// import posts
util.walkDir('..\\notenoughneon.com\\2015').
    then(regexFilter.bind(null, '\.html$')).
    then(function(files) {
        return when.map(files, function (file) {
            nodefn.call(fs.readFile, file).
                then(function(html) {
                    return microformat.getHEntryWithCard(html, '');
                }).
                then(site.store);
        });
    }).
    then(site.generateIndex).
    catch(function(e) {
        console.log(e.stack);
    });

// copy photos

util.walkDir('..\\notenoughneon.com\\2015').
    then(regexFilter.bind(null, '\.(jpg|png)$')).
    then(function(files) {
        return files.map(function(file){
            var dst = file.split(path.sep).slice(2).join('/');
            site.publisher.put(dst, fs.createReadStream(file));
        });
    }).
    catch(function(e) {
        console.log(e.stack);
    });

@@ -25,1133 +25,266 @@
 var 
-path = require('path');%0Avar when = require('when');%0Avar nodefn = require('when/node');%0Avar microformat = require('./microformat');%0Avar site = require('./site');%0Avar util = require('./util');%0A%0Afunction regexFilter(pat, files) %7B%0A    var re = new RegExp(pat);%0A    return files.filter(re.exec.bind(re));%0A%7D%0A%0A// import posts%0Autil.walkDir('..%5C%5Cnotenoughneon.com%5C%5C2015').%0A    then(regexFilter.bind(null, '%5C.html$')).%0A    then(functi
+util = require('./util');%0Avar site = require('./site').init(JSON.parse(fs.readFileSync('c
 on
-(
 fi
-les) %7B%0A        return when.map(files, function (file) %7B%0A            nodefn.call(fs.readFile, file).%0A                then(function(html) %7B%0A                    return microformat.getHEntryWithCard(html, '');%0A                %7D).%0A                then(site.store);%0A        %7D);%0A    %7D).%0A    then(site.generateIndex).%0A    catch(function(e) %7B%0A        console.log(e.stack);%0A    %7D);%0A%0A// copy photos%0A%0Autil.walkDir('..%5C%5Cnotenoughneon.com%5C%5C2015').%0A    then(regexFilter.bind(null, '%5C.(jpg%7Cpng)$')).%0A    then(function(files) %7B%0A        return files.map(function(file)%7B%0A            var dst = file.split(path.sep).slice(2).join('/');%0A            site.publisher.put(dst, fs.createReadStream(file));%0A        %7D);%0A    %7D
+g.json')));%0A%0Avar publisher = require('./filepublisher').init(%7Broot: '../oldsite', postRegex: '%5E20%5B0-9%5D%5B0-9%5D/.*%5C.html$'%7D);%0A%0Asite.import(publisher).%0A    then(util.dump
 ).%0A 
@@ -300,16 +300,17 @@
 function
+ 
 (e) %7B%0A  
@@ -344,9 +344,8 @@
 %0A    %7D);
-%0A

update import script