Class: Rubyword::Element::List
- Defined in:
- lib/rubyword/element/list.rb
Instance Attribute Summary collapse
-
#lists ⇒ Object
Returns the value of attribute lists.
Attributes inherited from Base
Instance Method Summary collapse
-
#save(text, level, style) ⇒ Object
write document and numbering.
- #write(section = nil, xml = nil) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rubyword::Element::Base
Instance Attribute Details
#lists ⇒ Object
Returns the value of attribute lists.
5 6 7 |
# File 'lib/rubyword/element/list.rb', line 5 def lists @lists end |
Instance Method Details
#save(text, level, style) ⇒ Object
write document and numbering
8 9 10 11 12 13 14 15 16 |
# File 'lib/rubyword/element/list.rb', line 8 def save(text, level, style) @lists ||= Queue.new text = filter_text(text) @lists << { level: level.to_i - 1, text: text, style: style } end |
#write(section = nil, xml = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rubyword/element/list.rb', line 18 def write(section=nil, xml=nil) @xml = xml list = self.lists.pop @xml.send('w:p') { @xml.send('w:pPr') { @xml.send('w:numPr') { @xml.send('w:ilvl', 'w:val' => list[:level]) @xml.send('w:numId', 'w:val' => 3) } } @xml.send('w:r') { Writer::Style::Word.new(@section, @xml, @rubyword).write(list[:style]) @xml.send('w:t', {'xml:space' => 'preserve'}, list[:text]) } } end |