Class: Sablon::HTMLConverter::TableCell

Inherits:
Node
  • Object
show all
Defined in:
lib/sablon/html/ast.rb

Overview

Converts html table cells into wordML table cells

Constant Summary collapse

PROPERTIES =
%w[gridSpan hideMark noWrap shd tcBorders tcFitText
tcMar tcW vAlign vMerge].freeze
CHILD_TAGS =

Permitted child tags defined by the OpenXML spec

%w[w:altChunk w:bookmarkEnd w:bookmarkStart w:commentRangeEnd
w:commentRangeStart w:customXml w:customXmlDelRangeEnd
w:customXmlDelRangeStart w:customXmlInsRangeEnd
w:customXmlInsRangeStart w:customXmlMoveFromRangeEnd
w:customXmlMoveFromRangeStart w:customXmlMoveToRangeEnd
w:customXmlMoveToRangeStart w:del w:ins w:moveFrom
w:moveFromRangeEnd w:moveFromRangeStart w:moveTo
w:moveToRangeEnd w:moveToRangeStart m:oMath m:oMathPara
w:p w:permEnd w:permStart w:proofErr w:sdt w:tbl w:tcPr]

Instance Method Summary collapse

Methods inherited from Node

convert_style_property, node_name, process_properties, style_conversion

Constructor Details

#initialize(env, node, properties) ⇒ TableCell

Returns a new instance of TableCell.



403
404
405
406
407
408
409
410
411
412
413
# File 'lib/sablon/html/ast.rb', line 403

def initialize(env, node, properties)
  super
  properties = self.class.process_properties(properties)
  @properties = NodeProperties.table_cell(properties)
  #
  # Nodes are processed first "as is" and then based on the XML
  # generated wrapped by paragraphs.
  trans_props = transferred_properties
  @children = ASTBuilder.html_to_ast(env, node.children, trans_props)
  @children = wrap_with_paragraphs(env, @children)
end

Instance Method Details

#accept(visitor) ⇒ Object



419
420
421
422
# File 'lib/sablon/html/ast.rb', line 419

def accept(visitor)
  super
  @children.accept(visitor)
end

#inspectObject



424
425
426
# File 'lib/sablon/html/ast.rb', line 424

def inspect
  "<TableCell{#{@properties.inspect}}: #{@children.inspect}>"
end

#to_docxObject



415
416
417
# File 'lib/sablon/html/ast.rb', line 415

def to_docx
  super('w:tc')
end