Sha256: 8ccde258e99d8cb5eb0ff9a591e10b3d9747337ff54a1d40373d7f979f239485

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require_relative 'abstract_numbering/multilevel_type'
require_relative 'abstract_numbering/numbering_level'
module OoxmlParser
  # This element specifies a set of properties which shall dictate the appearance and
  # behavior of a set of numbered
  # paragraphs in a WordprocessingML document.
  class AbstractNumbering < OOXMLDocumentObject
    # @return [Integer] abstruct numbering id
    attr_accessor :id
    # @return [MultilevelType] myltylevel type
    attr_accessor :multilevel_type
    # @return [Array, NumberingLevel] numbering level data list
    attr_accessor :level_list

    def initialize(parent: nil)
      @level_list = []
      @parent = parent
    end

    # Parse Abstract Numbering data
    # @param [Nokogiri::XML:Element] node with Abstract Numbering data
    # @return [AbstractNumbering] value of Abstract Numbering data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'abstractNumId'
          @id = value.value.to_f
        end
      end

      node.xpath('*').each do |numbering_child_node|
        case numbering_child_node.name
        when 'multiLevelType'
          @multilevel_type = MultilevelType.new(parent: self).parse(numbering_child_node)
        when 'lvl'
          @level_list << NumberingLevel.new(parent: self).parse(numbering_child_node)
        end
      end
      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.8.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.7.2 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.7.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.7.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.6.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.5.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.5.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb