Class: RTF::ListTextNode

Inherits:
CommandNode show all
Defined in:
lib/rtf/node.rb

Overview

This class represents a list item, that can contain text or other nodes. Currently any type of node is accepted, but after more extensive testing this behaviour may change.

Instance Attribute Summary

Attributes inherited from CommandNode

#prefix, #split, #suffix, #wrap

Attributes inherited from ContainerNode

#children

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from CommandNode

#<<, #apply, #background, #bold, #colour, #font, #footnote, #foreground, #image, #italic, #line_break, #link, #list, #paragraph, #strike, #subscript, #superscript, #table, #to_rtf, #underline

Methods inherited from ContainerNode

#[], #each, #first, #last, #size, #store, #to_rtf

Methods inherited from Node

#is_root?, #next_node, #previous_node, #root

Constructor Details

#initialize(parent, level) ⇒ ListTextNode

Returns a new instance of ListTextNode.



679
680
681
682
683
684
685
686
687
688
# File 'lib/rtf/node.rb', line 679

def initialize(parent, level)
  @level  = level
  @parent = parent

  number = siblings_count + 1 if parent.kind == :decimal
  prefix = "{\\listtext#{@level.marker.text_format(number)}}"
  suffix = '\\'

  super(parent, prefix, suffix, false, false)
end