uniword 1.2.5 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +313 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/config/ooxml/schemas/shared_types.yml +5 -4
  5. data/data/schemas/ecma/dc.xsd +118 -0
  6. data/data/schemas/ecma/dcmitype.xsd +50 -0
  7. data/data/schemas/ecma/dcterms.xsd +331 -0
  8. data/data/schemas/ecma/opc-coreProperties.xsd +2 -2
  9. data/data/schemas/ecma/xml.xsd +117 -0
  10. data/lib/uniword/builder/bibliography_builder.rb +1 -1
  11. data/lib/uniword/builder/chart_builder.rb +22 -14
  12. data/lib/uniword/builder/comment_anchorer.rb +221 -0
  13. data/lib/uniword/builder/document_builder.rb +97 -6
  14. data/lib/uniword/builder/image_builder.rb +11 -10
  15. data/lib/uniword/builder/run_utils.rb +2 -0
  16. data/lib/uniword/builder.rb +1 -0
  17. data/lib/uniword/cli/fonts_cli.rb +52 -0
  18. data/lib/uniword/cli/main.rb +110 -11
  19. data/lib/uniword/cli/page_cli.rb +85 -0
  20. data/lib/uniword/cli/styles_cli.rb +204 -0
  21. data/lib/uniword/cli/theme_cli.rb +88 -0
  22. data/lib/uniword/cli/toc_cli.rb +22 -2
  23. data/lib/uniword/comment.rb +20 -15
  24. data/lib/uniword/comment_range.rb +3 -3
  25. data/lib/uniword/comments_part.rb +51 -19
  26. data/lib/uniword/configuration/configuration_loader.rb +5 -3
  27. data/lib/uniword/configuration.rb +93 -1
  28. data/lib/uniword/content_types.rb +19 -39
  29. data/lib/uniword/document_factory.rb +12 -18
  30. data/lib/uniword/document_writer.rb +16 -5
  31. data/lib/uniword/docx/chart_part.rb +34 -0
  32. data/lib/uniword/docx/custom_xml_item.rb +91 -0
  33. data/lib/uniword/docx/header_footer_part.rb +140 -0
  34. data/lib/uniword/docx/header_footer_part_collection.rb +135 -0
  35. data/lib/uniword/docx/header_footer_view.rb +225 -0
  36. data/lib/uniword/docx/id_allocator.rb +130 -36
  37. data/lib/uniword/docx/image_part.rb +83 -0
  38. data/lib/uniword/docx/package.rb +141 -333
  39. data/lib/uniword/docx/package_defaults.rb +83 -99
  40. data/lib/uniword/docx/package_integrity_checker.rb +312 -0
  41. data/lib/uniword/docx/package_serialization.rb +144 -233
  42. data/lib/uniword/docx/part.rb +125 -0
  43. data/lib/uniword/docx/part_collection.rb +131 -0
  44. data/lib/uniword/docx/part_loader/chart_loader.rb +50 -0
  45. data/lib/uniword/docx/part_loader/custom_xml_loader.rb +53 -0
  46. data/lib/uniword/docx/part_loader/embedding_loader.rb +26 -0
  47. data/lib/uniword/docx/part_loader/header_footer_loader.rb +101 -0
  48. data/lib/uniword/docx/part_loader/image_loader.rb +105 -0
  49. data/lib/uniword/docx/part_loader/load_context.rb +85 -0
  50. data/lib/uniword/docx/part_loader/raw_part_loader.rb +183 -0
  51. data/lib/uniword/docx/part_loader/theme_media_loader.rb +39 -0
  52. data/lib/uniword/docx/part_loader/xml_model_loader.rb +56 -0
  53. data/lib/uniword/docx/part_loader.rb +92 -0
  54. data/lib/uniword/docx/raw_part.rb +75 -0
  55. data/lib/uniword/docx/reconciler/body.rb +59 -68
  56. data/lib/uniword/docx/reconciler/fix.rb +46 -0
  57. data/lib/uniword/docx/reconciler/fix_codes.rb +37 -30
  58. data/lib/uniword/docx/reconciler/helpers.rb +18 -31
  59. data/lib/uniword/docx/reconciler/notes.rb +17 -8
  60. data/lib/uniword/docx/reconciler/package_structure.rb +168 -221
  61. data/lib/uniword/docx/reconciler/parts.rb +36 -13
  62. data/lib/uniword/docx/reconciler/referential_integrity.rb +222 -123
  63. data/lib/uniword/docx/reconciler/tables.rb +78 -16
  64. data/lib/uniword/docx/reconciler/theme.rb +7 -4
  65. data/lib/uniword/docx/reconciler.rb +36 -14
  66. data/lib/uniword/docx.rb +13 -0
  67. data/lib/uniword/drawingml/blip.rb +0 -1
  68. data/lib/uniword/drawingml/color_scheme.rb +5 -6
  69. data/lib/uniword/drawingml/font_scheme.rb +4 -8
  70. data/lib/uniword/drawingml/theme.rb +12 -6
  71. data/lib/uniword/errors.rb +8 -1
  72. data/lib/uniword/footer.rb +4 -0
  73. data/lib/uniword/header.rb +4 -0
  74. data/lib/uniword/hyperlink.rb +1 -1
  75. data/lib/uniword/image.rb +6 -6
  76. data/lib/uniword/images/image_manager.rb +13 -13
  77. data/lib/uniword/lazy_loader.rb +1 -2
  78. data/lib/uniword/model_attribute_access.rb +20 -4
  79. data/lib/uniword/ooxml/dotx_package.rb +42 -2
  80. data/lib/uniword/ooxml/element_order.rb +94 -0
  81. data/lib/uniword/ooxml/part_definition.rb +329 -0
  82. data/lib/uniword/ooxml/part_registry.rb +504 -0
  83. data/lib/uniword/ooxml/relationships/image_relationship.rb +6 -3
  84. data/lib/uniword/ooxml/relationships/package_relationships.rb +20 -22
  85. data/lib/uniword/ooxml/schema/element_serializer.rb +8 -7
  86. data/lib/uniword/ooxml/types/hex_color_value.rb +38 -0
  87. data/lib/uniword/ooxml/types/ooxml_boolean.rb +27 -14
  88. data/lib/uniword/ooxml/types/ooxml_boolean_optional.rb +21 -16
  89. data/lib/uniword/ooxml/types/theme_color_value.rb +22 -0
  90. data/lib/uniword/ooxml/types/unsigned_decimal_number.rb +30 -0
  91. data/lib/uniword/ooxml/types.rb +10 -0
  92. data/lib/uniword/ooxml.rb +3 -0
  93. data/lib/uniword/properties/alignment.rb +8 -3
  94. data/lib/uniword/properties/border.rb +52 -6
  95. data/lib/uniword/properties/cell_vertical_align.rb +4 -1
  96. data/lib/uniword/properties/color_value.rb +8 -3
  97. data/lib/uniword/properties/highlight.rb +9 -5
  98. data/lib/uniword/properties/shading.rb +4 -3
  99. data/lib/uniword/properties/tab_stop.rb +6 -1
  100. data/lib/uniword/properties/table_justification.rb +4 -1
  101. data/lib/uniword/properties/underline.rb +4 -2
  102. data/lib/uniword/properties/vertical_align.rb +6 -3
  103. data/lib/uniword/review/review_manager.rb +23 -9
  104. data/lib/uniword/revision.rb +9 -9
  105. data/lib/uniword/schema/model_generator.rb +31 -15
  106. data/lib/uniword/shared_types/hex_color.rb +4 -1
  107. data/lib/uniword/shared_types/pixel_measure.rb +4 -1
  108. data/lib/uniword/shared_types/point_measure.rb +4 -1
  109. data/lib/uniword/shared_types/text_alignment.rb +6 -1
  110. data/lib/uniword/shared_types/twips_measure.rb +4 -1
  111. data/lib/uniword/spreadsheetml/phonetic_pr.rb +1 -1
  112. data/lib/uniword/spreadsheetml/shared_string_table.rb +2 -2
  113. data/lib/uniword/spreadsheetml/table_formula.rb +1 -1
  114. data/lib/uniword/template/variable_resolver.rb +40 -7
  115. data/lib/uniword/themes/theme_transformation.rb +55 -41
  116. data/lib/uniword/toc/toc_generator.rb +6 -5
  117. data/lib/uniword/transformation/mhtml_element_renderer.rb +1 -5
  118. data/lib/uniword/transformation/mhtml_metadata_builder.rb +6 -6
  119. data/lib/uniword/validation/engine.rb +35 -0
  120. data/lib/uniword/validation/link_checker.rb +1 -1
  121. data/lib/uniword/validation/opc_validator.rb +16 -2
  122. data/lib/uniword/validation/report/layer_result.rb +0 -1
  123. data/lib/uniword/validation/report/terminal_formatter.rb +0 -1
  124. data/lib/uniword/validation/report/verification_report.rb +0 -2
  125. data/lib/uniword/validation/report.rb +20 -0
  126. data/lib/uniword/validation/rules/base.rb +10 -2
  127. data/lib/uniword/validation/rules/bookmark_pairing_rule.rb +38 -0
  128. data/lib/uniword/validation/rules/bookmark_uniqueness_rule.rb +48 -0
  129. data/lib/uniword/validation/rules/bookmarks_rule.rb +0 -2
  130. data/lib/uniword/validation/rules/content_types_coverage_rule.rb +0 -2
  131. data/lib/uniword/validation/rules/core_properties_namespace_rule.rb +0 -2
  132. data/lib/uniword/validation/rules/document_body_rule.rb +25 -0
  133. data/lib/uniword/validation/rules/document_context.rb +7 -0
  134. data/lib/uniword/validation/rules/empty_paragraphs_rule.rb +27 -0
  135. data/lib/uniword/validation/rules/font_table_signature_rule.rb +0 -2
  136. data/lib/uniword/validation/rules/fonts_rule.rb +0 -2
  137. data/lib/uniword/validation/rules/footnotes_rule.rb +0 -2
  138. data/lib/uniword/validation/rules/headers_footers_rule.rb +0 -2
  139. data/lib/uniword/validation/rules/images_rule.rb +0 -2
  140. data/lib/uniword/validation/rules/mc_ignorable_namespace_rule.rb +0 -2
  141. data/lib/uniword/validation/rules/model_context.rb +32 -0
  142. data/lib/uniword/validation/rules/model_rule.rb +34 -0
  143. data/lib/uniword/validation/rules/numbering_preservation_rule.rb +0 -2
  144. data/lib/uniword/validation/rules/numbering_rule.rb +0 -2
  145. data/lib/uniword/validation/rules/relationship_integrity_rule.rb +0 -1
  146. data/lib/uniword/validation/rules/rsid_rule.rb +0 -2
  147. data/lib/uniword/validation/rules/section_properties_rule.rb +0 -2
  148. data/lib/uniword/validation/rules/settings_rule.rb +0 -2
  149. data/lib/uniword/validation/rules/settings_values_rule.rb +0 -2
  150. data/lib/uniword/validation/rules/style_references_rule.rb +0 -2
  151. data/lib/uniword/validation/rules/table_grid_rule.rb +27 -0
  152. data/lib/uniword/validation/rules/table_properties_rule.rb +27 -0
  153. data/lib/uniword/validation/rules/tables_rule.rb +0 -2
  154. data/lib/uniword/validation/rules/theme_completeness_rule.rb +0 -2
  155. data/lib/uniword/validation/rules/theme_rule.rb +0 -2
  156. data/lib/uniword/validation/rules.rb +61 -23
  157. data/lib/uniword/validation/schema_registry.rb +11 -0
  158. data/lib/uniword/validation/validators/document_semantics_validator.rb +1 -9
  159. data/lib/uniword/validation/validators/xml_schema_validator.rb +46 -2
  160. data/lib/uniword/validation/validators.rb +0 -9
  161. data/lib/uniword/validation/verify_orchestrator.rb +0 -7
  162. data/lib/uniword/validation.rb +7 -2
  163. data/lib/uniword/version.rb +1 -1
  164. data/lib/uniword/vml/imagedata.rb +0 -1
  165. data/lib/uniword/wordprocessingml/attached_template.rb +0 -1
  166. data/lib/uniword/wordprocessingml/deleted_text.rb +1 -1
  167. data/lib/uniword/wordprocessingml/document_root.rb +121 -122
  168. data/lib/uniword/wordprocessingml/document_styling.rb +246 -0
  169. data/lib/uniword/wordprocessingml/endnotes.rb +4 -1
  170. data/lib/uniword/wordprocessingml/font_replacer.rb +147 -0
  171. data/lib/uniword/wordprocessingml/footnotes.rb +4 -1
  172. data/lib/uniword/wordprocessingml/hdr_shape_defaults.rb +0 -1
  173. data/lib/uniword/wordprocessingml/hyperlink.rb +0 -1
  174. data/lib/uniword/wordprocessingml/level.rb +6 -20
  175. data/lib/uniword/wordprocessingml/math_pr.rb +0 -11
  176. data/lib/uniword/wordprocessingml/numbering_definition.rb +16 -8
  177. data/lib/uniword/wordprocessingml/numbering_elements.rb +0 -15
  178. data/lib/uniword/wordprocessingml/page_setup.rb +181 -0
  179. data/lib/uniword/wordprocessingml/paragraph_properties.rb +33 -28
  180. data/lib/uniword/wordprocessingml/rsids.rb +0 -2
  181. data/lib/uniword/wordprocessingml/run.rb +3 -0
  182. data/lib/uniword/wordprocessingml/section_properties.rb +2 -2
  183. data/lib/uniword/wordprocessingml/settings.rb +8 -34
  184. data/lib/uniword/wordprocessingml/shape_defaults.rb +0 -1
  185. data/lib/uniword/wordprocessingml/style.rb +2 -1
  186. data/lib/uniword/wordprocessingml/style_cleanup.rb +198 -0
  187. data/lib/uniword/wordprocessingml/table_cell_properties.rb +6 -6
  188. data/lib/uniword/wordprocessingml/update_fields.rb +27 -0
  189. data/lib/uniword/wordprocessingml/w14_attributes.rb +30 -2
  190. data/lib/uniword/wordprocessingml.rb +5 -2
  191. data/lib/uniword.rb +27 -2
  192. metadata +52 -19
  193. data/config/validation_rules.yml +0 -60
  194. data/config/warning_rules.yml +0 -57
  195. data/lib/uniword/validation/document_validator.rb +0 -272
  196. data/lib/uniword/validation/structural_validator.rb +0 -116
  197. data/lib/uniword/validation/validators/content_type_validator.rb +0 -165
  198. data/lib/uniword/validation/validators/file_structure_validator.rb +0 -104
  199. data/lib/uniword/validation/validators/ooxml_part_validator.rb +0 -128
  200. data/lib/uniword/validation/validators/relationship_validator.rb +0 -147
  201. data/lib/uniword/validation/validators/zip_integrity_validator.rb +0 -110
  202. data/lib/uniword/validators/element_validator.rb +0 -93
  203. data/lib/uniword/validators/paragraph_validator.rb +0 -116
  204. data/lib/uniword/validators/table_validator.rb +0 -134
  205. data/lib/uniword/validators.rb +0 -9
  206. data/lib/uniword/warnings/warning.rb +0 -130
  207. data/lib/uniword/warnings/warning_collector.rb +0 -234
  208. data/lib/uniword/warnings/warning_report.rb +0 -159
  209. data/lib/uniword/warnings.rb +0 -9
@@ -7,14 +7,15 @@ module Uniword
7
7
  #
8
8
  # Every `record_fix` call site references a constant from this module
9
9
  # instead of a bare string literal. Adding a new fix category means
10
- # adding one constant here, not hunting for the next free letter.
10
+ # adding one constant here with the next free code.
11
11
  #
12
- # Wire format is preserved — external validation rules and audit-log
13
- # consumers that pattern-match on "R1".."R16" continue to work.
14
- #
15
- # Known debt: R10 is overloaded for several distinct concerns
16
- # (note defs, table structure, style defaults, dangling refs).
17
- # Splitting requires consumer coordination.
12
+ # One code per concern: each constant has a unique, self-describing
13
+ # wire value. Codes "R1".."R16" are frozen — external validation rules
14
+ # (lib/uniword/validation/rules) and audit-log consumers pattern-match
15
+ # on them, so the original concerns keep their historic codes. Codes
16
+ # "R17" and up were introduced when the overloaded "R10" (and the
17
+ # remaining shared codes "R4"/"R11"/"R12"/"R13") were split into
18
+ # per-concern values.
18
19
  module FixCodes
19
20
  # Settings / package structure
20
21
  MC_IGNORABLE = "R1"
@@ -29,17 +30,12 @@ module Uniword
29
30
  CONTENT_TYPES_ASSEMBLED = "R7"
30
31
  APP_PROPERTIES_ENSURED = "R8"
31
32
 
32
- # Notes — pair creation
33
+ # Notes — pair creation and definition integrity
33
34
  NOTE_PAIR_CREATED = "R9"
34
35
  NOTE_DEFINITION_CREATED = "R10"
35
36
  NOTE_INVALID_TYPE_STRIPPED = "R15"
36
37
  NOTE_DUPLICATE_ID_REMOVED = "R16"
37
38
 
38
- # Notes — referential integrity warnings and removals
39
- DANGLING_NOTE_REFERENCE_WARNING = "R9"
40
- DANGLING_NOTE_REFERENCE_REMOVED = "R10"
41
- DANGLING_HYPERLINK_WARNING = "R9"
42
-
43
39
  # Body
44
40
  SECTION_PROPERTIES_DEFAULTED = "R11"
45
41
  PARAGRAPH_BACKFILL = "R12"
@@ -48,26 +44,37 @@ module Uniword
48
44
  FONT_TABLE_CREATED = "R13"
49
45
  CORE_PROPERTIES_REBUILT = "R14"
50
46
 
51
- # Styles (currently shares R10 with other concerns — see debt note above)
52
- STYLE_DEFAULTS_ADDED = "R10"
53
- SEMI_HIDDEN_ADDED = "R10"
47
+ # Referential integrity — dangling-reference repairs (split from
48
+ # the overloaded R10/R4/R11/R12 codes; one code per concern)
49
+ DANGLING_NUMBERING_REMOVED = "R17"
50
+ DANGLING_NOTE_REFERENCE_REMOVED = "R18"
51
+ DANGLING_STYLE_REFERENCE_REMOVED = "R19"
52
+ DANGLING_BASED_ON_REMOVED = "R20"
53
+ DANGLING_HYPERLINK_REMOVED = "R21"
54
+ DANGLING_HEADER_FOOTER_REMOVED = "R22"
55
+ DANGLING_DRAWING_REMOVED = "R23"
56
+ DANGLING_RELATIONSHIP_TARGET_REMOVED = "R32"
57
+
58
+ # Referential integrity — literal hyperlink targets promoted to
59
+ # proper External relationships (repairs Builder.hyperlink output)
60
+ HYPERLINK_RELATIONSHIP_CREATED = "R31"
61
+
62
+ # Styles
63
+ STYLE_DEFAULTS_ADDED = "R24"
64
+ SEMI_HIDDEN_ADDED = "R25"
54
65
 
55
- # Tables (currently shares R10)
56
- TABLE_STRUCTURE_RECONCILED = "R10"
57
- TABLE_CELL_PR_REORDERED = "R10"
58
- TABLE_CELL_DEFAULTS = "R12"
59
- TABLE_ROW_GRID_AFTER = "R13"
66
+ # Tables
67
+ TABLE_STRUCTURE_RECONCILED = "R26"
68
+ TABLE_CELL_PR_REORDERED = "R27"
69
+ TABLE_CELL_DEFAULTS = "R28"
70
+ TABLE_ROW_GRID_AFTER = "R29"
60
71
 
61
- # Referential integrity (currently shares R10)
62
- DANGLING_STYLE_REFERENCE_REMOVED = "R10"
63
- DANGLING_BASED_ON_REMOVED = "R10"
64
- DANGLING_NUMBERING_REMOVED = "R4"
65
- DANGLING_HYPERLINK_REMOVED = "R10"
66
- DANGLING_HEADER_FOOTER_REMOVED = "R11"
67
- DANGLING_DRAWING_REMOVED = "R12"
72
+ # Run cleanup
73
+ EMPTY_RUNS_STRIPPED = "R30"
68
74
 
69
- # Run cleanup (currently shares R10)
70
- EMPTY_RUNS_STRIPPED = "R10"
75
+ # Tables — gridCol widths defaulted to equal shares of the
76
+ # section content width (Word's fallback behavior)
77
+ TABLE_GRID_COL_WIDTHS_DEFAULTED = "R33"
71
78
  end
72
79
  end
73
80
  end
@@ -85,7 +85,7 @@ module Uniword
85
85
  walk_body_paragraphs(package.document.body, &block)
86
86
 
87
87
  (package.document&.header_footer_parts || []).each do |part|
88
- (part[:content]&.paragraphs || []).each(&block)
88
+ (part.content&.paragraphs || []).each(&block)
89
89
  end
90
90
  end
91
91
 
@@ -98,45 +98,24 @@ module Uniword
98
98
  end
99
99
  end
100
100
 
101
- # -- Element order --
101
+ # -- Element order (delegates to Ooxml::ElementOrder) --
102
102
 
103
+ # Idempotent singleton insert in schema position.
103
104
  def ensure_element_in_order(model, tag_name, after: nil, before: nil)
104
- order = model.element_order
105
- return unless order
106
-
107
- return if order.any? { |e| e.name == tag_name }
108
-
109
- entry = Lutaml::Xml::Element.new("Element", tag_name)
110
-
111
- if after
112
- idx = order.index { |e| e.name == after }
113
- thaw_and_insert(model, order, idx ? idx + 1 : order.size, entry)
114
- elsif before
115
- idx = order.index { |e| e.name == before }
116
- thaw_and_insert(model, order, idx || 0, entry)
117
- else
118
- thaw_and_append(model, order, entry)
119
- end
105
+ Ooxml::ElementOrder.insert_once(model, tag_name,
106
+ after: after, before: before)
120
107
  end
121
108
 
109
+ # Positional insert for repeatable elements.
122
110
  def insert_element_order(obj, name, position)
123
111
  order = obj.element_order
124
112
  return unless order
125
-
126
113
  return if order.any? { |e| e.name == name }
127
114
 
128
- entry = Lutaml::Xml::Element.new("Element", name, node_type: :element)
129
- thaw_and_insert(obj, order, position, entry)
130
- end
131
-
132
- # lutaml-model freezes element_order after XML parsing.
133
- # Replace the frozen array with a mutable copy when modification is needed.
134
- def thaw_and_insert(model, order, position, entry)
135
- model.element_order = order.dup.insert(position, entry)
136
- end
137
-
138
- def thaw_and_append(model, order, entry)
139
- model.element_order = order.dup << entry
115
+ Ooxml::ElementOrder.insert_at(
116
+ obj, position, Lutaml::Xml::Element.new("Element", name,
117
+ node_type: :element)
118
+ )
140
119
  end
141
120
 
142
121
  # -- Run utilities (delegate to RunUtils) --
@@ -295,6 +274,14 @@ module Uniword
295
274
  end
296
275
  end
297
276
 
277
+ # Package part path of the notes collection for the note type.
278
+ def notes_part_for(type)
279
+ case type
280
+ when :footnote then "word/footnotes.xml"
281
+ when :endnote then "word/endnotes.xml"
282
+ end
283
+ end
284
+
298
285
  def note_entries_for(notes, type)
299
286
  return [] unless notes
300
287
 
@@ -38,7 +38,8 @@ module Uniword
38
38
  )
39
39
  end
40
40
  record_fix(FixCodes::NOTE_DEFINITION_CREATED,
41
- "Created missing #{type}note definitions for ids=#{missing.join(', ')}")
41
+ "Created missing #{type}note definitions for ids=#{missing.join(', ')}",
42
+ part: notes_part_for(type))
42
43
  end
43
44
  end
44
45
 
@@ -70,11 +71,13 @@ module Uniword
70
71
  create_message:, pr_message:)
71
72
  if has_pr && !notes
72
73
  notes_setter.call(minimal_notes(type))
73
- record_fix(FixCodes::NOTE_PAIR_CREATED, create_message)
74
+ record_fix(FixCodes::NOTE_PAIR_CREATED, create_message,
75
+ part: notes_part_for(type))
74
76
  elsif notes && !has_pr
75
77
  package.settings ||= Wordprocessingml::Settings.new
76
78
  assign_note_pr(package.settings, type)
77
- record_fix(FixCodes::NOTE_PAIR_CREATED, pr_message)
79
+ record_fix(FixCodes::NOTE_PAIR_CREATED, pr_message,
80
+ part: "word/settings.xml")
78
81
  end
79
82
 
80
83
  current = notes_collection_for(type)
@@ -92,7 +95,7 @@ module Uniword
92
95
  strip_empty_runs_from_notes(entries)
93
96
  reorder_notes_by_reference(entries, type)
94
97
 
95
- unless allocator
98
+ unless builder_managed?
96
99
  prefix = type == :footnote ? "fn" : "en"
97
100
 
98
101
  entries.each_with_index do |entry, eidx|
@@ -182,7 +185,8 @@ module Uniword
182
185
  return if stripped.empty?
183
186
 
184
187
  record_fix(FixCodes::NOTE_INVALID_TYPE_STRIPPED,
185
- "Stripped invalid w:type from #{type}note ids=#{stripped.join(', ')}")
188
+ "Stripped invalid w:type from #{type}note ids=#{stripped.join(', ')}",
189
+ part: notes_part_for(type))
186
190
  end
187
191
 
188
192
  def deduplicate_note_ids(entries, type)
@@ -200,7 +204,8 @@ module Uniword
200
204
  return if dup_ids.empty?
201
205
 
202
206
  record_fix(FixCodes::NOTE_DUPLICATE_ID_REMOVED,
203
- "Removed duplicate #{type}note ids=#{dup_ids.join(', ')}")
207
+ "Removed duplicate #{type}note ids=#{dup_ids.join(', ')}",
208
+ part: notes_part_for(type))
204
209
  end
205
210
 
206
211
  def reorder_notes_by_reference(entries, type)
@@ -227,7 +232,9 @@ module Uniword
227
232
  structural.each { |e| entries << e }
228
233
  reordered.each { |e| entries << e }
229
234
 
230
- record_fix(FixCodes::NOTE_PAIR_CREATED, "Reordered #{type}notes by first reference in document body")
235
+ record_fix(FixCodes::NOTE_PAIR_CREATED,
236
+ "Reordered #{type}notes by first reference in document body",
237
+ part: notes_part_for(type))
231
238
  end
232
239
 
233
240
  def renumber_notes(entries, type)
@@ -255,7 +262,9 @@ module Uniword
255
262
  end
256
263
  end
257
264
 
258
- record_fix(FixCodes::NOTE_PAIR_CREATED, "Renumbered #{type}note IDs sequentially (#{id_map.size} changed)")
265
+ record_fix(FixCodes::NOTE_PAIR_CREATED,
266
+ "Renumbered #{type}note IDs sequentially (#{id_map.size} changed)",
267
+ part: notes_part_for(type))
259
268
  end
260
269
 
261
270
  def collect_note_reference_order(body, type)