Class: OoxmlParser::NumberingProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb

Overview

Class for parsing ‘numPr` tags

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(ilvl = 0, parent: nil) ⇒ NumberingProperties

Returns a new instance of NumberingProperties.



6
7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 6

def initialize(ilvl = 0, parent: nil)
  @ilvl = ilvl
  @parent = parent
end

Instance Attribute Details

#fontObject

Returns the value of attribute font.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def font
  @font
end

#ilvlObject

Returns the value of attribute ilvl.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def ilvl
  @ilvl
end

#numbering_propertiesObject

Returns the value of attribute numbering_properties.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def numbering_properties
  @numbering_properties
end

#sizeObject

Returns the value of attribute size.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def size
  @size
end

#start_atObject

Returns the value of attribute start_at.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def start_at
  @start_at
end

#symbolObject

Returns the value of attribute symbol.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def symbol
  @symbol
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 4

def type
  @type
end

Instance Method Details

#abstruct_numberingObject



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 11

def abstruct_numbering
  root_object.numbering.properties_by_num_id(@numbering_properties)
end

#numbering_level_currentObject



30
31
32
33
34
35
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 30

def numbering_level_current
  abstruct_numbering.level_list.each do |current_ilvl|
    return current_ilvl if current_ilvl.ilvl == @ilvl
  end
  nil
end

#parse(node) ⇒ NumberingProperties

Parse NumberingProperties

Parameters:

  • node (Nokogiri::XML:Node)

    with NumberingProperties

Returns:



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb', line 18

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'ilvl'
      @ilvl = node_child.attribute('val').value.to_i
    when 'numId'
      @numbering_properties = node_child.attribute('val').value.to_i
    end
  end
  self
end