Class: Uniword::Wordprocessingml::Endnotes

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/wordprocessingml/endnotes.rb

Overview

Endnotes collection

Generated from OOXML schema: wordprocessingml.yml Element: <w:endnotes>

Instance Method Summary collapse

Instance Method Details

#sync_element_orderObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/uniword/wordprocessingml/endnotes.rb', line 23

def sync_element_order
  return if element_order.nil? || element_order.empty?

  counts = element_order.each_with_object(Hash.new(0)) do |e, h|
    h[e.name] += 1
  end

  missing = endnote_entries.size - counts["endnote"]
  missing.times do
    element_order << Lutaml::Xml::Element.new("Element", "endnote")
  end
end

#to_xml(options = {}) ⇒ Object



36
37
38
39
# File 'lib/uniword/wordprocessingml/endnotes.rb', line 36

def to_xml(options = {})
  sync_element_order
  super
end