class Asciidoctor::Table::Cell
Public: Methods for managing the a cell in an AsciiDoc table.
def content
def content style = attr('style') if style == :asciidoc @inner_document.render else text.split(BLANK_LINE_PATTERN).map {|p| !style || style == :header ? p : Inline.new(parent, :quoted, p, :type => attr('style')).render } end end
def initialize(column, text, attributes = {})
def initialize(column, text, attributes = {}) super(column, :cell) @text = text @colspan = nil @rowspan = nil # TODO feels hacky if !column.nil? update_attributes(column.attributes) end if !attributes.nil? if attributes.has_key? 'colspan' @colspan = attributes['colspan'] attributes.delete('colspan') end if attributes.has_key? 'rowspan' @rowspan = attributes['rowspan'] attributes.delete('rowspan') end update_attributes(attributes) end # only allow AsciiDoc cells in non-header rows if @attributes['style'] == :asciidoc && !column.table.header_row? # FIXME hide doctitle from nested document; temporary workaround to fix # nested document seeing doctitle and assuming it has its own document title parent_doctitle = @document.attributes.delete('doctitle') @inner_document = Document.new(@text, :header_footer => false, :parent => @document) @document.attributes['doctitle'] = parent_doctitle unless parent_doctitle.nil? end end
def text
def text apply_normal_subs(@text).strip end
def to_s
def to_s "#{super.to_s} - [text: #@text, colspan: #{@colspan || 1}, rowspan: #{@rowspan || 1}, attributes: #@attributes]" end