File: plain.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 (39 lines) | stat: -rw-r--r-- 536 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

$title = 'amrita benchmark'

$data = File::open("bench.dat").collect do |line|
  line.chomp.split('|')
end


def doit
  print <<END
<html>
<head>
<title>#{$title}</title>
</head>
<body>
<h1>#{$title}</h1>
<table border="1">
  <tr><th>name</th><th>author</th><th>webpage</tr>
END

  $data.each do |items|
  print <<-END
  <tr>
    <td>#{items[0]}</td>
    <td>#{items[1]}</td>
    <td><a href="#{items[2]}">#{items[3]}</a></td>
  </tr>
  END
end

  print <<END
</table>
</body>
</html>
END
end

cnt = ARGV.shift.to_i
cnt.times { doit }