close

  
<p> 

var tfile = acre.environ.params['tfile'];
var template = acre.environ.params['template'];

// TODO support multiple args.
var arg = acre.environ.params['arg'];
var callback = acre.environ.params['callback']

acre.start_response(200, {'content-type':'text/html'});
var temps = acre.require('freebase:'+tfile);
var t = temps[template](arg);

var res = mjt.flatten_markup(t);
if (callback) {
  acre.start_response(200, {'content-type':'text/plain'});
  acre.write(callback, '(', JSON.stringify(res), ');');
} else {
  acre.start_response(200, {'content-type':'text/html'});
  acre.write(res);
}
 </p>

Comments

Hide