example.eruby 306 B

123456789101112131415
  1. <?rb
  2. user = 'Erubis'
  3. list = ['<aaa>', 'b&b', '"ccc"']
  4. ?>
  5. <p>Hello @{user}@!</p>
  6. <table>
  7. <tbody>
  8. <?rb list.each_with_index do |item, i| ?>
  9. <tr bgcolor="@!{i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'}@">
  10. <td>@!{i + 1}@</td>
  11. <td>@{item}@</td>
  12. </tr>
  13. <?rb end ?>
  14. </tbody>
  15. </table>