lib/render.js
function render(templatePath, outputPath, element, options) {
    var template = fs.readFileSync(templatePath, 'utf8'),
        rendered = "",
        renderedOutput = "";

    element  = element || null;
    options  = options || {};

    _.extend(options, {
        mdjson   : mdjson,
        filename : templatePath, // to avoid "include" error
        root     : mdjson.getRoot(),
        element  : element
    });

    // Append predefined filters
    if (!options.filters) {
        options.filters = {};
    }
    _.extend(options.filters, filters);

    rendered = ejs.render(template, options);
    renderedOutput = ejs.render(outputPath, options);
    fs.ensureFileSync(renderedOutput);
    fs.writeFileSync(renderedOutput, rendered);
}
function render(templatePath, outputPath, element, options) {
    var template = fs.readFileSync(templatePath, 'utf8'),
        rendered = "",
        renderedOutput = "";

    element  = element || null;
    options  = options || {};

    _.extend(options, {
        mdjson   : mdjson,
        filename : templatePath, // to avoid "include" error
        root     : mdjson.getRoot(),
        element  : element
    });

    // Append predefined filters
    if (!options.filters) {
        options.filters = {};
    }
    _.extend(options.filters, filters);

    rendered = ejs.render(template, options);
    renderedOutput = ejs.render(outputPath, options);
    fs.ensureFileSync(renderedOutput);
    fs.writeFileSync(renderedOutput, rendered);
}
function render ( templatePath , outputPath , element , options ) { var template = fs . readFileSync ( templatePath , 'utf8' ) , rendered = "" , renderedOutput = "" ; element = element || null ; options = options || { } ; _ . extend ( options , { mdjson : mdjson , filename : templatePath , // to avoid "include" error root : mdjson . getRoot ( ) , element : element } ) ; // Append predefined filters if ( ! options . filters ) { options . filters = { } ; } _ . extend ( options . filters , filters ) ; rendered = ejs . render ( template , options ) ; renderedOutput = ejs . render ( outputPath , options ) ; fs . ensureFileSync ( renderedOutput ) ; fs . writeFileSync ( renderedOutput , rendered ) ; }
Render a template file with options and save to an output file

@param{string} templatePath Path for a template file
@param{string} outputPath Path for an output file. You can use ejs expression (e.g. `out/<% element.name %>.java`)
@param{Element} element Element to be rendered
@param{Object} options Options used for ejs rendering
Render a template file with options and save to an output file