File: table.rb

package info (click to toggle)
amrita 1.0.2-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,880 kB
  • ctags: 1,363
  • sloc: ruby: 9,159; xml: 978; makefile: 116
file content (22 lines) | stat: -rw-r--r-- 434 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require "amrita/template"
include Amrita

tmpl = TemplateText.new <<END
<table border="1">
  <tr><th>name</th><th>author</th></tr>
  <tr id=table1>
    <td id="name"><td id="author">
  </tr>
</table>
END

data = {
   :table1=>[ 
      { :name=>"Ruby", :author=>"matz" },
      { :name=>"perl", :author=>"Larry Wall" },
      { :name=>"python", :author=>"Guido van Rossum" },
   ] 
}
tmpl.prettyprint = true
tmpl.expand(STDOUT, data)