File: example_js.result

package info (click to toggle)
erubis 2.6.2-3.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,064 kB
  • ctags: 1,320
  • sloc: ruby: 6,193; makefile: 108; ansic: 97; php: 17
file content (22 lines) | stat: -rw-r--r-- 598 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ erubis -l js example.ejs
var _buf = [];
   var user = 'Erubis';
   var list = ['<aaa>', 'b&b', '"ccc"'];
 
_buf.push("<html>\n\
 <body>\n\
  <p>Hello "); _buf.push(user); _buf.push("!</p>\n\
  <table>\n\
   <tbody>\n");
     var i; 
     for (i = 0; i < list.length; i++) { 
_buf.push("    <tr bgcolor=\""); _buf.push(i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'); _buf.push("\">\n\
     <td>"); _buf.push(i + 1); _buf.push("</td>\n\
     <td>"); _buf.push(list[i]); _buf.push("</td>\n\
    </tr>\n");
     } 
_buf.push("   </tbody>\n\
  </table>\n\
 </body>\n\
</html>\n");
document.write(_buf.join(""));