Sha256: 592208da1f6e489f1218bbfb7bf695ea556c660767fa95a8bd0e9c3b3c59d5fa

Contents?: true

Size: 1.18 KB

Versions: 5

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
      @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

5 entries across 5 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb