Sha256: 1b102b5e047cf778d7560826a7a6b070f7ec8fdb4ff79f0ca5a8839ccd2c74ef

Contents?: true

Size: 1.18 KB

Versions: 30

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `numPr` tags
  class NumberingProperties < OOXMLDocumentObject
    attr_accessor :size, :font, :symbol, :start_at, :type, :ilvl, :numbering_properties

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

    # @return [AbstractNumbering] AbstractNumbering of current properties
    def abstruct_numbering
      root_object.numbering.properties_by_num_id(@numbering_properties)
    end

    # Parse NumberingProperties
    # @param [Nokogiri::XML:Node] node with NumberingProperties
    # @return [NumberingProperties] result of parsing
    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

    # @return [AbstractNumbering] level list of current numbering
    def numbering_level_current
      abstruct_numbering.level_list.each do |current_ilvl|
        return current_ilvl if current_ilvl.ilvl == @ilvl
      end
      nil
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.21.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb