class Asciidoctor::Table::Cell
Public: Methods for managing the a cell in an AsciiDoc table.
def content
def content if @style == :asciidoc @inner_document.convert else text.split(BlankLineRx).map do |p| !@style || @style == :header ? p : Inline.new(parent, :quoted, p, :type => @style).convert end end end
def initialize column, text, attributes = {}, cursor = nil
def initialize column, text, attributes = {}, cursor = nil super column, :cell @text = text @style = nil @colspan = nil @rowspan = nil # TODO feels hacky if column @style = column.attributes['style'] update_attributes(column.attributes) end if attributes @colspan = attributes.delete('colspan') @rowspan = attributes.delete('rowspan') # TODO eventualy remove the style attribute from the attributes hash #@style = attributes.delete('style') if attributes.has_key? 'style' @style = attributes['style'] if attributes.has_key? 'style' update_attributes(attributes) end # only allow AsciiDoc cells in non-header rows if @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') # NOTE we need to process the first line of content as it may not have been processed # the included content cannot expect to match conditional terminators in the remaining # lines of table cell content, it must be self-contained logic inner_document_lines = @text.split(EOL) unless inner_document_lines.empty? || !inner_document_lines[0].include?('::') unprocessed_lines = inner_document_lines[0] processed_lines = PreprocessorReader.new(@document, unprocessed_lines).readlines if processed_lines != unprocessed_lines inner_document_lines.shift inner_document_lines.unshift(*processed_lines) end end @inner_document = Document.new(inner_document_lines, :header_footer => false, :parent => @document, :cursor => cursor) @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