Class: RTF::ListNode
- Inherits:
-
CommandNode
- Object
- Node
- ContainerNode
- CommandNode
- RTF::ListNode
- Defined in:
- lib/rtf/node.rb
Overview
This class represents an ordered/unordered list within an RTF document.
Currently list nodes can contain any type of node, but this behaviour will change in future releases. The class overrides the list
method to return a ListLevelNode
.
Instance Attribute Summary
Attributes inherited from CommandNode
#prefix, #split, #suffix, #wrap
Attributes inherited from ContainerNode
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(parent) ⇒ ListNode
constructor
A new instance of ListNode.
-
#list(kind) ⇒ Object
This method creates a new
ListLevelNode
of the given kind and stores it in the document tree.
Methods inherited from CommandNode
#<<, #apply, #background, #bold, #colour, #font, #footnote, #foreground, #image, #italic, #line_break, #link, #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) ⇒ ListNode
Returns a new instance of ListNode.
610 611 612 613 614 615 616 617 618 619 620 |
# File 'lib/rtf/node.rb', line 610 def initialize(parent) prefix = "\\" suffix = '\pard' suffix << ListLevel::ResetTabs.map {|tw| "\\tx#{tw}"}.join suffix << '\ql\qlnatural\pardirnatural\cf0 \\' super(parent, prefix, suffix, true, false) @template = root.lists.new_template end |
Instance Method Details
#list(kind) ⇒ Object
This method creates a new ListLevelNode
of the given kind and stores it in the document tree.
Parameters
- kind
-
The kind of this list level, may be either :bullets or :decimal
627 628 629 |
# File 'lib/rtf/node.rb', line 627 def list(kind) self.store ListLevelNode.new(self, @template, kind) end |