Class: Uniword::Docx::Reconciler

Inherits:
Object
  • Object
show all
Includes:
Body, Helpers, Notes, PackageStructure, Parts, ReferentialIntegrity, Tables, Theme
Defined in:
lib/uniword/docx/reconciler.rb,
lib/uniword/docx/reconciler/body.rb,
lib/uniword/docx/reconciler/notes.rb,
lib/uniword/docx/reconciler/parts.rb,
lib/uniword/docx/reconciler/theme.rb,
lib/uniword/docx/reconciler/tables.rb,
lib/uniword/docx/reconciler/helpers.rb,
lib/uniword/docx/reconciler/fix_codes.rb,
lib/uniword/docx/reconciler/package_structure.rb,
lib/uniword/docx/reconciler/referential_integrity.rb

Defined Under Namespace

Modules: Body, FixCodes, Helpers, Notes, PackageStructure, Parts, ReferentialIntegrity, Tables, Theme

Constant Summary collapse

EXTENSION_PREFIXES =
Ooxml::Namespaces::EXTENSION_PREFIXES
FULL_IGNORABLE =
Ooxml::Namespaces::FULL_IGNORABLE_PREFIXES
VALID_NOTE_TYPES =
%w[separator continuationSeparator
footnoteSeparator continuationNotice].freeze

Constants included from PackageStructure

PackageStructure::PACKAGE_LEVEL_REL_TYPES, PackageStructure::UNSUPPORTED_REL_TYPES

Constants included from Helpers

Helpers::CONFIG_DIR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Body

#reconcile_headers_footers, #reconcile_section_properties

Methods included from PackageStructure

#reconcile_content_types, #reconcile_document_rels, #reconcile_package_rels

Methods included from Parts

#reconcile_app_properties, #reconcile_core_properties, #reconcile_font_table, #reconcile_numbering, #reconcile_settings, #reconcile_styles, #reconcile_web_settings

Methods included from Theme

#reconcile_theme, #repair_theme

Methods included from Tables

#reconcile_tables

Methods included from ReferentialIntegrity

#reconcile_referential_integrity

Methods included from Notes

#reconcile_endnotes, #reconcile_footnotes, #reconcile_note_references

Methods included from Helpers

#adjacent_run_indices, #assign_note_pr, #backfill_paragraphs, #build_notes_collection, #build_rel, #can_merge?, #consolidate_runs, #consolidate_runs_in_body, #document_fingerprint, #empty_run?, #ensure_element_in_order, #generate_hex_id, #generate_rsid, #hex_derive, #insert_element_order, #load_font_metadata, #load_latent_styles_config, #merge_run_into, #note_entries_for, #note_reference_from_run, #notes_collection_for, #run_properties_match?, #set_mc_ignorable, #set_notes_collection, #strip_empty_runs, #strip_empty_runs_from_notes, #text_only_run?, #thaw_and_append, #thaw_and_insert, #walk_all_paragraphs, #walk_body_paragraphs, #walk_body_tables, #walk_table_paragraphs

Constructor Details

#initialize(package, profile: nil, allocator: nil) ⇒ Reconciler

Returns a new instance of Reconciler.



32
33
34
35
36
37
# File 'lib/uniword/docx/reconciler.rb', line 32

def initialize(package, profile: nil, allocator: nil)
  @package = package
  @profile = profile
  @allocator = allocator
  @applied_fixes = []
end

Instance Attribute Details

#applied_fixesObject (readonly)

Audit trail of fixes applied during reconciliation.



75
76
77
# File 'lib/uniword/docx/reconciler.rb', line 75

def applied_fixes
  @applied_fixes
end

Instance Method Details

#reconcileObject



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
65
66
67
68
69
70
71
72
# File 'lib/uniword/docx/reconciler.rb', line 39

def reconcile
  # Group 1: Document body (always)
  reconcile_section_properties
  reconcile_footnotes
  reconcile_endnotes
  reconcile_note_references
  reconcile_headers_footers
  reconcile_tables
  repair_theme

  # Group 2: Support parts (profile-dependent)
  if @profile
    reconcile_theme
    reconcile_settings
    reconcile_font_table
    reconcile_styles
    reconcile_numbering
    reconcile_web_settings
    reconcile_app_properties
    reconcile_core_properties
    reconcile_document_body
  end

  # Clear stored namespace plans so declare: :always scopes take effect
  clear_stored_namespace_plans

  # Group 3: Package consistency (always)
  reconcile_content_types
  reconcile_package_rels
  reconcile_document_rels

  # Group 4: Integrity checks (after rels are assembled)
  reconcile_referential_integrity
end