diff --git a/cmd/render.js b/cmd/render.js index 01a2b87..4ea204f 100644 --- a/cmd/render.js +++ b/cmd/render.js @@ -11,53 +11,18 @@ let renderCmd = new Command(); renderCmd.name = 'render'; renderCmd.description = 'render template to html with data from config file and markdown'; renderCmd.setFunc((app, args, flags) => { - // if (args.length === 0) { - // logger.debug('render using config'); - // app.loadConfigOrExit(); - // logger.error('not implemented'); - // app.exit(1); - // } - // logger.info('try to render file', {file: args[0]}); - // FIXME: the then and catch are not triggered - // render.renderByFile(args[0], {title: 'abc'}).then((out)=> { - // console.log('resolved!'); - // logger.info(out); - // }).catch((e)=> { - // logger.error(e); - // }); - - // FIXME: still not work - // render.renderByFile(args[0], {title: 'abc'}) - // .then((out)=> { - // console.log('I got out!', out); - // }) - // .catch((e)=> { - // console.error(e); - // }); - - // console.log('lalalal'); - // NOTE: this is working when run the command alone - // render.renderBySource('I am {title}', {title: 'abc'}) - // .then((out)=> { - // console.log(out); - // },(e)=>{ - // console.log(e); - // }) - - console.log('oh yeah'); - - render.renderByFile('example/tmpl/index.html', {title: 'abc'}) - .then((out)=> { - console.log('I got out!', out); - }) - .catch((e)=> { - console.error(e); - }); - - console.log('oh ha'); - setTimeout(()=>{ - console.log('what?'); - },200); + if (args.length === 0) { + logger.debug('render using config'); + app.loadConfigOrExit(); + logger.error('not implemented'); + app.exit(1); + } + logger.info('try to render file', {file: args[0]}); + render.renderByFile(args[0], {title: 'abc'}).then((out)=> { + logger.info(out); + }).catch((e)=> { + logger.error(e); + }); }); module.exports = renderCmd; \ No newline at end of file diff --git a/example/tmpl/index.html b/example/tmpl/index.html index 42eb832..f1f8017 100644 --- a/example/tmpl/index.html +++ b/example/tmpl/index.html @@ -1,5 +1,6 @@
+