lib/rabbit/element/table.rb in rabbit-0.6.4 vs lib/rabbit/element/table.rb in rabbit-0.9.0
- old
+ new
@@ -1,12 +1,14 @@
require 'rabbit/element/text-element'
require 'rabbit/element/container-element'
+require 'rabbit/element/block-element'
module Rabbit
module Element
class Table
include ContainerElement
+ include BlockElement
attr_reader :caption
def initialize(prop={})
super()
%w(caption).each do |name|
@@ -45,10 +47,11 @@
end
end
class TableHead
include ContainerElement
+ include BlockElement
def text
"#{super}\n"
end
@@ -57,18 +60,20 @@
end
end
class TableBody
include ContainerElement
+ include BlockElement
def to_html(generator)
"<tbody>\n#{super}\n</tbody>"
end
end
class TableRow
include ContainerElement
+ include BlockElement
def text
super.gsub(/\n/, ", ")
end
@@ -80,18 +85,18 @@
"<tr>\n#{super}\n</tr>"
end
end
class TableHeader
- include TextElement
+ include TextContainerElement
def to_html(generator)
"<th>#{super}</th>"
end
end
class TableCell
- include TextElement
+ include TextContainerElement
def to_html(generator)
"<td>#{super}</td>"
end
end