Class: ODFWriter::Text

Inherits:
Field
  • Object
show all
Defined in:
lib/odf_writer/text.rb

Overview

Text: replace text items

Constant Summary collapse

DELIMITERS =

constants

%w({ })

Instance Attribute Summary

Attributes inherited from Field

#name

Instance Method Summary collapse

Methods inherited from Field

#field, #initialize, #value

Constructor Details

This class inherits a constructor from ODFWriter::Field

Instance Method Details

#replace!(content, item = nil) ⇒ Object

replace!



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/odf_writer/text.rb', line 43

def replace!(content, item = nil)

  return unless node = find_text_node(content)
  
  text = value(item)
  
  @parser = Parser::Default.new(text, node, 
    :doc                 => content,
    :remove_classes      => @remove_classes,
    :remove_class_prefix => @remove_class_prefix,
    :remove_class_suffix => @remove_class_suffix
  )
  
  @parser.paragraphs.each do |p|
    node.before(p)
  end
  
  node.remove
  
end