Class: ODFWriter::ListStyle

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

Overview

ListStyle: add style for ul, ol up to 6 levels deep

Instance Method Summary collapse

Constructor Details

#initialize(*list_styles) ⇒ ListStyle

initialize



36
37
38
39
# File 'lib/odf_writer/list_style.rb', line 36

def initialize( *list_styles )
  @list_styles = *list_styles
  @font  = {}
end

Instance Method Details

#add_list_style(doc) ⇒ Object

add_list_style



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

def add_list_style( doc )

  ns                                   = doc.collect_namespaces
  automatic_styles                     = doc.at("//office:automatic-styles", ns)
  font_declarations                    = doc.at("//office:font-face-decls", ns)
  
  
  
  @list_styles.each do |list_style|
  
    automatic_styles                   << create_list( doc, list_style ) if automatic_styles.present?
    
    if @font.present?
      font_declarations                << create_font( doc, @font )      if font_declarations.present?
    end
  end
end