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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +313 -0
- data/CONTRIBUTING.md +1 -1
- data/config/ooxml/schemas/shared_types.yml +5 -4
- data/data/schemas/ecma/dc.xsd +118 -0
- data/data/schemas/ecma/dcmitype.xsd +50 -0
- data/data/schemas/ecma/dcterms.xsd +331 -0
- data/data/schemas/ecma/opc-coreProperties.xsd +2 -2
- data/data/schemas/ecma/xml.xsd +117 -0
- data/lib/uniword/builder/bibliography_builder.rb +1 -1
- data/lib/uniword/builder/chart_builder.rb +22 -14
- data/lib/uniword/builder/comment_anchorer.rb +221 -0
- data/lib/uniword/builder/document_builder.rb +97 -6
- data/lib/uniword/builder/image_builder.rb +11 -10
- data/lib/uniword/builder/run_utils.rb +2 -0
- data/lib/uniword/builder.rb +1 -0
- data/lib/uniword/cli/fonts_cli.rb +52 -0
- data/lib/uniword/cli/main.rb +110 -11
- data/lib/uniword/cli/page_cli.rb +85 -0
- data/lib/uniword/cli/styles_cli.rb +204 -0
- data/lib/uniword/cli/theme_cli.rb +88 -0
- data/lib/uniword/cli/toc_cli.rb +22 -2
- data/lib/uniword/comment.rb +20 -15
- data/lib/uniword/comment_range.rb +3 -3
- data/lib/uniword/comments_part.rb +51 -19
- data/lib/uniword/configuration/configuration_loader.rb +5 -3
- data/lib/uniword/configuration.rb +93 -1
- data/lib/uniword/content_types.rb +19 -39
- data/lib/uniword/document_factory.rb +12 -18
- data/lib/uniword/document_writer.rb +16 -5
- data/lib/uniword/docx/chart_part.rb +34 -0
- data/lib/uniword/docx/custom_xml_item.rb +91 -0
- data/lib/uniword/docx/header_footer_part.rb +140 -0
- data/lib/uniword/docx/header_footer_part_collection.rb +135 -0
- data/lib/uniword/docx/header_footer_view.rb +225 -0
- data/lib/uniword/docx/id_allocator.rb +130 -36
- data/lib/uniword/docx/image_part.rb +83 -0
- data/lib/uniword/docx/package.rb +141 -333
- data/lib/uniword/docx/package_defaults.rb +83 -99
- data/lib/uniword/docx/package_integrity_checker.rb +312 -0
- data/lib/uniword/docx/package_serialization.rb +144 -233
- data/lib/uniword/docx/part.rb +125 -0
- data/lib/uniword/docx/part_collection.rb +131 -0
- data/lib/uniword/docx/part_loader/chart_loader.rb +50 -0
- data/lib/uniword/docx/part_loader/custom_xml_loader.rb +53 -0
- data/lib/uniword/docx/part_loader/embedding_loader.rb +26 -0
- data/lib/uniword/docx/part_loader/header_footer_loader.rb +101 -0
- data/lib/uniword/docx/part_loader/image_loader.rb +105 -0
- data/lib/uniword/docx/part_loader/load_context.rb +85 -0
- data/lib/uniword/docx/part_loader/raw_part_loader.rb +183 -0
- data/lib/uniword/docx/part_loader/theme_media_loader.rb +39 -0
- data/lib/uniword/docx/part_loader/xml_model_loader.rb +56 -0
- data/lib/uniword/docx/part_loader.rb +92 -0
- data/lib/uniword/docx/raw_part.rb +75 -0
- data/lib/uniword/docx/reconciler/body.rb +59 -68
- data/lib/uniword/docx/reconciler/fix.rb +46 -0
- data/lib/uniword/docx/reconciler/fix_codes.rb +37 -30
- data/lib/uniword/docx/reconciler/helpers.rb +18 -31
- data/lib/uniword/docx/reconciler/notes.rb +17 -8
- data/lib/uniword/docx/reconciler/package_structure.rb +168 -221
- data/lib/uniword/docx/reconciler/parts.rb +36 -13
- data/lib/uniword/docx/reconciler/referential_integrity.rb +222 -123
- data/lib/uniword/docx/reconciler/tables.rb +78 -16
- data/lib/uniword/docx/reconciler/theme.rb +7 -4
- data/lib/uniword/docx/reconciler.rb +36 -14
- data/lib/uniword/docx.rb +13 -0
- data/lib/uniword/drawingml/blip.rb +0 -1
- data/lib/uniword/drawingml/color_scheme.rb +5 -6
- data/lib/uniword/drawingml/font_scheme.rb +4 -8
- data/lib/uniword/drawingml/theme.rb +12 -6
- data/lib/uniword/errors.rb +8 -1
- data/lib/uniword/footer.rb +4 -0
- data/lib/uniword/header.rb +4 -0
- data/lib/uniword/hyperlink.rb +1 -1
- data/lib/uniword/image.rb +6 -6
- data/lib/uniword/images/image_manager.rb +13 -13
- data/lib/uniword/lazy_loader.rb +1 -2
- data/lib/uniword/model_attribute_access.rb +20 -4
- data/lib/uniword/ooxml/dotx_package.rb +42 -2
- data/lib/uniword/ooxml/element_order.rb +94 -0
- data/lib/uniword/ooxml/part_definition.rb +329 -0
- data/lib/uniword/ooxml/part_registry.rb +504 -0
- data/lib/uniword/ooxml/relationships/image_relationship.rb +6 -3
- data/lib/uniword/ooxml/relationships/package_relationships.rb +20 -22
- data/lib/uniword/ooxml/schema/element_serializer.rb +8 -7
- data/lib/uniword/ooxml/types/hex_color_value.rb +38 -0
- data/lib/uniword/ooxml/types/ooxml_boolean.rb +27 -14
- data/lib/uniword/ooxml/types/ooxml_boolean_optional.rb +21 -16
- data/lib/uniword/ooxml/types/theme_color_value.rb +22 -0
- data/lib/uniword/ooxml/types/unsigned_decimal_number.rb +30 -0
- data/lib/uniword/ooxml/types.rb +10 -0
- data/lib/uniword/ooxml.rb +3 -0
- data/lib/uniword/properties/alignment.rb +8 -3
- data/lib/uniword/properties/border.rb +52 -6
- data/lib/uniword/properties/cell_vertical_align.rb +4 -1
- data/lib/uniword/properties/color_value.rb +8 -3
- data/lib/uniword/properties/highlight.rb +9 -5
- data/lib/uniword/properties/shading.rb +4 -3
- data/lib/uniword/properties/tab_stop.rb +6 -1
- data/lib/uniword/properties/table_justification.rb +4 -1
- data/lib/uniword/properties/underline.rb +4 -2
- data/lib/uniword/properties/vertical_align.rb +6 -3
- data/lib/uniword/review/review_manager.rb +23 -9
- data/lib/uniword/revision.rb +9 -9
- data/lib/uniword/schema/model_generator.rb +31 -15
- data/lib/uniword/shared_types/hex_color.rb +4 -1
- data/lib/uniword/shared_types/pixel_measure.rb +4 -1
- data/lib/uniword/shared_types/point_measure.rb +4 -1
- data/lib/uniword/shared_types/text_alignment.rb +6 -1
- data/lib/uniword/shared_types/twips_measure.rb +4 -1
- data/lib/uniword/spreadsheetml/phonetic_pr.rb +1 -1
- data/lib/uniword/spreadsheetml/shared_string_table.rb +2 -2
- data/lib/uniword/spreadsheetml/table_formula.rb +1 -1
- data/lib/uniword/template/variable_resolver.rb +40 -7
- data/lib/uniword/themes/theme_transformation.rb +55 -41
- data/lib/uniword/toc/toc_generator.rb +6 -5
- data/lib/uniword/transformation/mhtml_element_renderer.rb +1 -5
- data/lib/uniword/transformation/mhtml_metadata_builder.rb +6 -6
- data/lib/uniword/validation/engine.rb +35 -0
- data/lib/uniword/validation/link_checker.rb +1 -1
- data/lib/uniword/validation/opc_validator.rb +16 -2
- data/lib/uniword/validation/report/layer_result.rb +0 -1
- data/lib/uniword/validation/report/terminal_formatter.rb +0 -1
- data/lib/uniword/validation/report/verification_report.rb +0 -2
- data/lib/uniword/validation/report.rb +20 -0
- data/lib/uniword/validation/rules/base.rb +10 -2
- data/lib/uniword/validation/rules/bookmark_pairing_rule.rb +38 -0
- data/lib/uniword/validation/rules/bookmark_uniqueness_rule.rb +48 -0
- data/lib/uniword/validation/rules/bookmarks_rule.rb +0 -2
- data/lib/uniword/validation/rules/content_types_coverage_rule.rb +0 -2
- data/lib/uniword/validation/rules/core_properties_namespace_rule.rb +0 -2
- data/lib/uniword/validation/rules/document_body_rule.rb +25 -0
- data/lib/uniword/validation/rules/document_context.rb +7 -0
- data/lib/uniword/validation/rules/empty_paragraphs_rule.rb +27 -0
- data/lib/uniword/validation/rules/font_table_signature_rule.rb +0 -2
- data/lib/uniword/validation/rules/fonts_rule.rb +0 -2
- data/lib/uniword/validation/rules/footnotes_rule.rb +0 -2
- data/lib/uniword/validation/rules/headers_footers_rule.rb +0 -2
- data/lib/uniword/validation/rules/images_rule.rb +0 -2
- data/lib/uniword/validation/rules/mc_ignorable_namespace_rule.rb +0 -2
- data/lib/uniword/validation/rules/model_context.rb +32 -0
- data/lib/uniword/validation/rules/model_rule.rb +34 -0
- data/lib/uniword/validation/rules/numbering_preservation_rule.rb +0 -2
- data/lib/uniword/validation/rules/numbering_rule.rb +0 -2
- data/lib/uniword/validation/rules/relationship_integrity_rule.rb +0 -1
- data/lib/uniword/validation/rules/rsid_rule.rb +0 -2
- data/lib/uniword/validation/rules/section_properties_rule.rb +0 -2
- data/lib/uniword/validation/rules/settings_rule.rb +0 -2
- data/lib/uniword/validation/rules/settings_values_rule.rb +0 -2
- data/lib/uniword/validation/rules/style_references_rule.rb +0 -2
- data/lib/uniword/validation/rules/table_grid_rule.rb +27 -0
- data/lib/uniword/validation/rules/table_properties_rule.rb +27 -0
- data/lib/uniword/validation/rules/tables_rule.rb +0 -2
- data/lib/uniword/validation/rules/theme_completeness_rule.rb +0 -2
- data/lib/uniword/validation/rules/theme_rule.rb +0 -2
- data/lib/uniword/validation/rules.rb +61 -23
- data/lib/uniword/validation/schema_registry.rb +11 -0
- data/lib/uniword/validation/validators/document_semantics_validator.rb +1 -9
- data/lib/uniword/validation/validators/xml_schema_validator.rb +46 -2
- data/lib/uniword/validation/validators.rb +0 -9
- data/lib/uniword/validation/verify_orchestrator.rb +0 -7
- data/lib/uniword/validation.rb +7 -2
- data/lib/uniword/version.rb +1 -1
- data/lib/uniword/vml/imagedata.rb +0 -1
- data/lib/uniword/wordprocessingml/attached_template.rb +0 -1
- data/lib/uniword/wordprocessingml/deleted_text.rb +1 -1
- data/lib/uniword/wordprocessingml/document_root.rb +121 -122
- data/lib/uniword/wordprocessingml/document_styling.rb +246 -0
- data/lib/uniword/wordprocessingml/endnotes.rb +4 -1
- data/lib/uniword/wordprocessingml/font_replacer.rb +147 -0
- data/lib/uniword/wordprocessingml/footnotes.rb +4 -1
- data/lib/uniword/wordprocessingml/hdr_shape_defaults.rb +0 -1
- data/lib/uniword/wordprocessingml/hyperlink.rb +0 -1
- data/lib/uniword/wordprocessingml/level.rb +6 -20
- data/lib/uniword/wordprocessingml/math_pr.rb +0 -11
- data/lib/uniword/wordprocessingml/numbering_definition.rb +16 -8
- data/lib/uniword/wordprocessingml/numbering_elements.rb +0 -15
- data/lib/uniword/wordprocessingml/page_setup.rb +181 -0
- data/lib/uniword/wordprocessingml/paragraph_properties.rb +33 -28
- data/lib/uniword/wordprocessingml/rsids.rb +0 -2
- data/lib/uniword/wordprocessingml/run.rb +3 -0
- data/lib/uniword/wordprocessingml/section_properties.rb +2 -2
- data/lib/uniword/wordprocessingml/settings.rb +8 -34
- data/lib/uniword/wordprocessingml/shape_defaults.rb +0 -1
- data/lib/uniword/wordprocessingml/style.rb +2 -1
- data/lib/uniword/wordprocessingml/style_cleanup.rb +198 -0
- data/lib/uniword/wordprocessingml/table_cell_properties.rb +6 -6
- data/lib/uniword/wordprocessingml/update_fields.rb +27 -0
- data/lib/uniword/wordprocessingml/w14_attributes.rb +30 -2
- data/lib/uniword/wordprocessingml.rb +5 -2
- data/lib/uniword.rb +27 -2
- metadata +52 -19
- data/config/validation_rules.yml +0 -60
- data/config/warning_rules.yml +0 -57
- data/lib/uniword/validation/document_validator.rb +0 -272
- data/lib/uniword/validation/structural_validator.rb +0 -116
- data/lib/uniword/validation/validators/content_type_validator.rb +0 -165
- data/lib/uniword/validation/validators/file_structure_validator.rb +0 -104
- data/lib/uniword/validation/validators/ooxml_part_validator.rb +0 -128
- data/lib/uniword/validation/validators/relationship_validator.rb +0 -147
- data/lib/uniword/validation/validators/zip_integrity_validator.rb +0 -110
- data/lib/uniword/validators/element_validator.rb +0 -93
- data/lib/uniword/validators/paragraph_validator.rb +0 -116
- data/lib/uniword/validators/table_validator.rb +0 -134
- data/lib/uniword/validators.rb +0 -9
- data/lib/uniword/warnings/warning.rb +0 -130
- data/lib/uniword/warnings/warning_collector.rb +0 -234
- data/lib/uniword/warnings/warning_report.rb +0 -159
- 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
|
|
10
|
+
# adding one constant here with the next free code.
|
|
11
11
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
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
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
56
|
-
TABLE_STRUCTURE_RECONCILED = "
|
|
57
|
-
TABLE_CELL_PR_REORDERED = "
|
|
58
|
-
TABLE_CELL_DEFAULTS = "
|
|
59
|
-
TABLE_ROW_GRID_AFTER = "
|
|
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
|
-
#
|
|
62
|
-
|
|
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
|
-
#
|
|
70
|
-
|
|
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
|
|
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
|
-
|
|
105
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|
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,
|
|
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,
|
|
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)
|