Class: Uniword::Docx::PartLoader::HeaderFooterLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/docx/part_loader/header_footer_loader.rb

Overview

Loads header and footer parts (word/headerN.xml, word/footerN.xml) into HeaderFooterPart objects on the document's unified header/footer store. Registered under the :header_footer loader key for both the :header and :footer definitions; the definition selects kind, path pattern, relationship type, and content model.

Each part keeps its loaded relationship id, target, and rel_type verbatim, plus the sectPr reference type ("default"/"first"/"even") collected from every section properties element, so the save path can leave loaded relationships untouched.

Instance Method Summary collapse

Instance Method Details

#load(context, definition) ⇒ void

This method returns an undefined value.

Parameters:



22
23
24
25
26
27
28
29
30
# File 'lib/uniword/docx/part_loader/header_footer_loader.rb', line 22

def load(context, definition)
  package = context.package
  return unless package.document && package.document_rels

  paths = context.matching_paths(definition)
  return if paths.empty?

  load_parts(context, definition, package, paths.sort)
end