Class: Sablon::HTMLConverter::List

Inherits:
Collection show all
Defined in:
lib/sablon/html/ast.rb

Overview

Manages the child nodes of a list type tag

Constant Summary

Constants inherited from Node

Node::PROPERTIES

Instance Attribute Summary

Attributes inherited from Collection

#nodes

Instance Method Summary collapse

Methods inherited from Collection

#<<, #accept, #to_docx

Methods inherited from Node

#accept, convert_style_property, node_name, process_properties, style_conversion, #to_docx

Constructor Details

#initialize(env, node, properties) ⇒ List

Returns a new instance of List.



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/sablon/html/ast.rb', line 207

def initialize(env, node, properties)
  # intialize values
  @list_tag = node.name
  #
  @definition = nil
  if node.ancestors(".//#{@list_tag}").length.zero?
    # Only register a definition upon the first list tag encountered
    @definition = env.document.add_list_definition(properties['pStyle'])
  end

  # update attributes of all child nodes
  transfer_node_attributes(node.children, node.attributes)

  # Move any list tags that are a child of a list item up one level
  process_child_nodes(node)

  # convert children from HTML to AST nodes
  super(ASTBuilder.html_to_ast(env, node.children, properties))
end

Instance Method Details

#inspectObject



227
228
229
# File 'lib/sablon/html/ast.rb', line 227

def inspect
  "<List: #{super}>"
end