# marker.js **Repository Path**: xiaodpro/marker.js ## Basic Information - **Project Name**: marker.js - **Description**: 一个简单小巧的js模板引擎 - **Primary Language**: JavaScript - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2015-03-11 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #marker.js 一个简单的js模板引擎实现,运行webkit环境下(IE部分函数不兼容),示例如下:
var template = '<table>'
                 \+ '<tr><td>${firstCellText}-<% echo(firstCellText);%></td>'
                 \+ '<%'
                 \+ '   var arr = [1, 2, 3, 4, 5, 6];'
                 \+ '   for(var i = 0; i < arr.length; i++){'
                 \+ '%>'
                 \+ '     <td>${arr[i]}</td>'
                 \+ '<%'
                 \+ '   }'
                 \+ '%>'
                 \+ '</tr>'
              \+ '</table>';
//方式一
var m = marker(template);
console.log(m.render({firstCellText: 'The first cell content.'});
//方式二
console.log(marker(template, {firstCellText: 'The first cell content.'}));