Class: OoxmlParser::NumberingLevel

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/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

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ NumberingLevel

Returns a new instance of NumberingLevel.



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

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

Instance Attribute Details

#ilvlInteger

Returns level id.

Returns:

  • (Integer)

    level id



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

def ilvl
  @ilvl
end

#justificationLevelJustification

Returns justification of level.

Returns:



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

def justification
  @justification
end

#numbering_formatNumberingFormat

Returns numbering format data.

Returns:



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

def numbering_format
  @numbering_format
end

#paragraph_propertiesParagraphProperties

Returns properties of paragraph.

Returns:



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

def paragraph_properties
  @paragraph_properties
end

#run_propertiesRunProperties

Returns properties of run.

Returns:



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

def run_properties
  @run_properties
end

#startStart

Returns start data.

Returns:



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

def start
  @start
end

#suffixSuffix

Returns value of Suffix.

Returns:

  • (Suffix)

    value of Suffix



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

def suffix
  @suffix
end

#textLevelText

Returns level text.

Returns:



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

def text
  @text
end

Instance Method Details

#parse(node) ⇒ NumberingLevel

Parse Numbering Level data

Parameters:

  • node (Nokogiri::XML:Element)

    with Numbering Level data

Returns:



35
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
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb', line 35

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 = Start.new(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