Skip to content

Commit

Permalink
[template] clean up debug code for #8
Browse files Browse the repository at this point in the history
  • Loading branch information
at15 committed Sep 12, 2016
1 parent 768f836 commit 7fd8cab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 47 deletions.
59 changes: 12 additions & 47 deletions cmd/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions example/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>
<!--I am a comment, keep me please-->
<title>{title}</title>
</head>
<body>
Expand Down

0 comments on commit 7fd8cab

Please sign in to comment.