Class: OoxmlParser::NumberingLevel

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb

Overview

This element specifies the appearance and behavior of a numbering level within a given abstract numbering

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ NumberingLevel

Returns a new instance of NumberingLevel.



28
29
30
31
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 28

def initialize(parent: nil)
  @suffix = Suffix.new(parent: self)
  super
end

Instance Attribute Details

#ilvlInteger

Returns level id.

Returns:

  • (Integer)

    level id



12
13
14
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 12

def ilvl
  @ilvl
end

#justificationLevelJustification

Returns justification of level.

Returns:



20
21
22
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 20

def justification
  @justification
end

#numbering_formatNumberingFormat

Returns numbering format data.

Returns:



16
17
18
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 16

def numbering_format
  @numbering_format
end

#paragraph_propertiesParagraphProperties

Returns properties of paragraph.

Returns:



22
23
24
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 22

def paragraph_properties
  @paragraph_properties
end

#run_propertiesRunProperties

Returns properties of run.

Returns:



24
25
26
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 24

def run_properties
  @run_properties
end

#startStart

Returns start data.

Returns:

  • (Start)

    start data



14
15
16
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 14

def start
  @start
end

#suffixSuffix

Returns value of Suffix.

Returns:

  • (Suffix)

    value of Suffix



26
27
28
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 26

def suffix
  @suffix
end

#textLevelText

Returns level text.

Returns:



18
19
20
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 18

def text
  @text
end

Instance Method Details

#parse(node) ⇒ NumberingLevel

Parse Numbering Level data

Parameters:

  • node (Nokogiri::XML:Element)

    with Numbering Level data

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering/numbering_level.rb', line 36

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'ilvl'
      @ilvl = value.value.to_f
    end
  end

  node.xpath('*').each do |num_level_child|
    case num_level_child.name
    when 'start'
      @start = ValuedChild.new(:integer, parent: self).parse(num_level_child)
    when 'numFmt'
      @numbering_format = NumberingFormat.new(parent: self).parse(num_level_child)
    when 'lvlText'
      @text = LevelText.new(parent: self).parse(num_level_child)
    when 'lvlJc'
      @justification = LevelJustification.new(parent: self).parse(num_level_child)
    when 'pPr'
      @paragraph_properties = ParagraphProperties.new(parent: self).parse(num_level_child)
    when 'rPr'
      @run_properties = RunProperties.new(parent: self).parse(num_level_child)
    when 'suff'
      @suffix = @suffix.parse(num_level_child)
    end
  end

  self
end