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.14.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.11.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.10.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.9.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb
ooxml_parser-0.9.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb