PURE with JAXER Revision 6eab4b83588e (Tue Dec 16 2008 at 17:09) - Diff Link to this snippet: https://friendpaste.com/7hSPSeZuHpA4AafLgSlD3C Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style> #templates .template { display:none; } .odd { background:#bbb} </style> <script type="text/javascript" src="../js/jqueryMin.js" runat='server'></script> <script type="text/javascript" src="../js/pure.js" runat='server'></script> <script type="text/javascript" runat='server'> function transform() { Jaxer.Log.info('transforming...'); var html = document.getElementById('template1'); var props = []; for (prop in Jaxer.Config) { props.push([prop,Jaxer.Config[prop]]); } var context = { 'list' : props}; var directive = { "tfoot td.total" : 'list.length' , "tbody tr": "rows <- list" , "tbody td.property": "rows[0]" , "tbody td.value": "rows[1]" , 'tbody tr[class]' : (function(context, items, pos) { return ( pos % 2 == 0 ) ? 'even' : 'odd'; }) }; html = $p.map(directive, html); var target = document.getElementById('renderedContent'); $p.render(html, context, target); } </script> </head> <body onserverload='transform();'> <div id='templates'> <table id='template1' class='template'> <thead> <tr><th>Property</th><th>Value</th></tr> </thead> <tbody> <tr><td class='property'></td><td class='value'></td></tr> </tbody> <tfoot> <tr><td>Count</td><td class='total'></td></tr> </tfoot> </table> </div> <div id='renderedContent'> </div> </body></html>