Sha256: 109f669e489f8cb053377c280a3fb7794bd9ff9aa7ccf13e01682a5a2aa1369f

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.4.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.3.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb
ooxml_parser-0.2.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb