class Parchment::ODT::Document

Private Instance Methods

set_default_paragraph_style() click to toggle source
# File lib/parchment/formats/odt/document.rb, line 24
def set_default_paragraph_style
  style_nodes = @styles_xml.xpath('.//office:styles/style:default-style').select do |style|
    style.attributes['family'].value == 'paragraph'
  end
  @default_paragraph_style = Parchment::ODT::Style.new(style_nodes.first)
end
set_paragraphs() click to toggle source

These methods parse and add the Document’s children and defaults.

# File lib/parchment/formats/odt/document.rb, line 13
def set_paragraphs
  set_default_paragraph_style
  paragraph_nodes = @content_xml.xpath('.//office:body/office:text/text:p')
  @paragraphs = paragraph_nodes.map { |node| Parchment::ODT::Paragraph.new(node, self) }
end
set_styles() click to toggle source
# File lib/parchment/formats/odt/document.rb, line 19
def set_styles
  style_nodes = @content_xml.xpath('.//office:automatic-styles/style:style')
  @styles = style_nodes.map { |node| Parchment::ODT::Style.new(node) }
end