uniword 1.7.10 → 1.7.11
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/CONTRIBUTING.md +21 -1
- data/lib/uniword/accessibility/rules/image_alt_text_rule.rb +3 -1
- data/lib/uniword/accessibility/rules/table_headers_rule.rb +3 -1
- data/lib/uniword/diff/document_differ.rb +6 -1
- data/lib/uniword/document_factory.rb +36 -35
- data/lib/uniword/docx/reconciler/tables.rb +3 -1
- data/lib/uniword/mhtml/word_css.rb +9 -3
- data/lib/uniword/ooxml/dotx_package.rb +17 -5
- data/lib/uniword/quality/rules/link_validation_rule.rb +9 -3
- data/lib/uniword/resource/font_substitutor.rb +8 -2
- data/lib/uniword/resource/theme_processor.rb +5 -1
- data/lib/uniword/resource/theme_transition.rb +4 -1
- data/lib/uniword/styleset.rb +3 -1
- data/lib/uniword/transformation/mhtml_element_renderer.rb +2 -1
- data/lib/uniword/validation/checkers/footnote_reference_checker.rb +3 -2
- data/lib/uniword/validation/report/terminal_formatter.rb +5 -1
- data/lib/uniword/version.rb +1 -1
- data/lib/uniword/wordprocessingml/document_root.rb +5 -3
- data/lib/uniword/wordprocessingml/run_properties/conversion.rb +11 -3
- data/lib/uniword/wordprocessingml/structured_document_tag/date.rb +4 -1
- data/lib/uniword/wordprocessingml/structured_document_tag/run_properties.rb +3 -1
- data/lib/uniword.rb +26 -4
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 272a4660c2d6afffd4c24aa33206b75cbd2cf30136c8272674f039e89d5a185e
|
|
4
|
+
data.tar.gz: 6c11a3d55539aa2b613e5ea3bae7d53dd0be329ffe40b9dce95ec2f99d2e5093
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 835b665c01d52949fa339e1b262acb9fa303e2a4f3429667cf914d940ff689e20bf0b5192aba8182eaffd7e65877144664191c0e19e84857c219d449f4f79be8
|
|
7
|
+
data.tar.gz: 841f85fa9124534dda4061bfc75ae616745fd0e75486f20e3bea1b496caec088408ef7f933310afa2fc2a267474ae1a210fa760b609d25c1b733fe6bc54a98ae
|
data/CONTRIBUTING.md
CHANGED
|
@@ -476,4 +476,24 @@ By contributing, you agree that your contributions will be licensed under the sa
|
|
|
476
476
|
|
|
477
477
|
## Thank You!
|
|
478
478
|
|
|
479
|
-
Your contributions make Uniword better for everyone. Thank you for taking the time to contribute!
|
|
479
|
+
Your contributions make Uniword better for everyone. Thank you for taking the time to contribute!
|
|
480
|
+
|
|
481
|
+
## Ribose Contributor License Agreement
|
|
482
|
+
|
|
483
|
+
Before your first pull request can be merged in any Ribose GitHub
|
|
484
|
+
organization, you need to be covered by the Ribose Contributor License
|
|
485
|
+
Agreement (CLA). Sign once; one signature covers every Ribose
|
|
486
|
+
organization.
|
|
487
|
+
|
|
488
|
+
- **Individual contributors** — sign the Individual CLA at
|
|
489
|
+
<https://cla.ribose.com/icla>. The `cla/ribose` check on your pull
|
|
490
|
+
request reports the state, and you can also sign from the pull request
|
|
491
|
+
by commenting `@ribose-cla agree` and completing the one-click link
|
|
492
|
+
the App replies with.
|
|
493
|
+
- **Corporate contributors** — if your employer has an executed
|
|
494
|
+
Organization CLA, the employer's Point of Contact adds your GitHub
|
|
495
|
+
handle to its Schedule A at
|
|
496
|
+
<https://cla.ribose.com/organizations>, or you can request coverage
|
|
497
|
+
there yourself. No individual signature is then needed.
|
|
498
|
+
- **The full guide** — the signing flows and the agreement text are at
|
|
499
|
+
<https://github.com/riboseinc/cla/blob/main/docs/SIGNING.md>.
|
|
@@ -77,7 +77,9 @@ module Uniword
|
|
|
77
77
|
"(too short: #{alt_text.length} chars)",
|
|
78
78
|
element: image,
|
|
79
79
|
severity: :warning,
|
|
80
|
-
suggestion: "Alternative text should describe the image
|
|
80
|
+
suggestion: "Alternative text should describe the image " \
|
|
81
|
+
"content meaningfully " \
|
|
82
|
+
"(min #{@config[:min_length]} chars)",
|
|
81
83
|
)
|
|
82
84
|
end
|
|
83
85
|
|
|
@@ -53,7 +53,9 @@ module Uniword
|
|
|
53
53
|
# @return [Boolean] True if caption exists
|
|
54
54
|
def table_has_caption?(table)
|
|
55
55
|
# Tables may have a caption property or title
|
|
56
|
-
table.is_a?(Lutaml::Model::Serializable) &&
|
|
56
|
+
table.is_a?(Lutaml::Model::Serializable) &&
|
|
57
|
+
table.class.attributes.key?(:caption) &&
|
|
58
|
+
!table.caption.to_s.strip.empty?
|
|
57
59
|
end
|
|
58
60
|
end
|
|
59
61
|
end
|
|
@@ -421,7 +421,12 @@ module Uniword
|
|
|
421
421
|
styles.each do |style|
|
|
422
422
|
style_id = style.styleId&.to_s
|
|
423
423
|
name_obj = style.name
|
|
424
|
-
name = name_obj.is_a?(Lutaml::Model::Serializable) &&
|
|
424
|
+
name = if name_obj.is_a?(Lutaml::Model::Serializable) &&
|
|
425
|
+
name_obj.class.attributes.key?(:val)
|
|
426
|
+
name_obj.val
|
|
427
|
+
else
|
|
428
|
+
name_obj.to_s
|
|
429
|
+
end
|
|
425
430
|
result[style_id] = name if style_id
|
|
426
431
|
end
|
|
427
432
|
|
|
@@ -44,37 +44,38 @@ module Uniword
|
|
|
44
44
|
# @example Load with explicit format
|
|
45
45
|
# document = DocumentFactory.from_file("doc.mht", format: :mhtml)
|
|
46
46
|
def from_file(path, format: :auto)
|
|
47
|
-
Uniword.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
Uniword.with_boot_adapter do
|
|
48
|
+
# Handle binary strings (for docx gem compatibility)
|
|
49
|
+
# Convert to StringIO if it's a binary string (contains null bytes or has binary encoding)
|
|
50
|
+
path = StringIO.new(path) if path.is_a?(String) &&
|
|
51
|
+
(path.encoding == Encoding::ASCII_8BIT || path.include?("\x00"))
|
|
52
|
+
|
|
53
|
+
validate_path(path)
|
|
54
|
+
|
|
55
|
+
format = detect_format(path) if format == :auto
|
|
56
|
+
|
|
57
|
+
case format
|
|
58
|
+
when :docx, :docm
|
|
59
|
+
package = Docx::Package.from_file(path)
|
|
60
|
+
doc = package.document
|
|
61
|
+
copy_package_parts_to_document(package, doc)
|
|
62
|
+
doc
|
|
63
|
+
when :dotx, :dotm
|
|
64
|
+
Ooxml::DotxPackage.from_file(path)
|
|
65
|
+
when :mhtml
|
|
66
|
+
mhtml_doc = Mhtml::MhtmlPackage.from_file(path)
|
|
67
|
+
# Convert Mhtml::Document to DocumentRoot for uniform API
|
|
68
|
+
if mhtml_doc.is_a?(Mhtml::Document)
|
|
69
|
+
Transformation::Transformer.new.mhtml_to_docx(mhtml_doc)
|
|
70
|
+
else
|
|
71
|
+
mhtml_doc
|
|
72
|
+
end
|
|
73
|
+
when :html
|
|
74
|
+
html_content = read_file_content(path)
|
|
75
|
+
Uniword.from_html(html_content)
|
|
70
76
|
else
|
|
71
|
-
|
|
77
|
+
raise ArgumentError, "Unsupported format: #{format}"
|
|
72
78
|
end
|
|
73
|
-
when :html
|
|
74
|
-
html_content = read_file_content(path)
|
|
75
|
-
Uniword.from_html(html_content)
|
|
76
|
-
else
|
|
77
|
-
raise ArgumentError, "Unsupported format: #{format}"
|
|
78
79
|
end
|
|
79
80
|
rescue ArgumentError
|
|
80
81
|
# Re-raise validation errors as-is
|
|
@@ -107,13 +108,13 @@ module Uniword
|
|
|
107
108
|
# data = File.binread("doc.docx")
|
|
108
109
|
# document = DocumentFactory.from_file_data(data)
|
|
109
110
|
def from_file_data(stream, format: :auto)
|
|
110
|
-
Uniword.
|
|
111
|
+
Uniword.with_boot_adapter do
|
|
112
|
+
# Convert binary string to StringIO if needed
|
|
113
|
+
stream = StringIO.new(stream) if stream.is_a?(String)
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# Use from_file which already supports IO/StringIO
|
|
116
|
-
from_file(stream, format: format)
|
|
115
|
+
# Use from_file which already supports IO/StringIO
|
|
116
|
+
from_file(stream, format: format)
|
|
117
|
+
end
|
|
117
118
|
end
|
|
118
119
|
|
|
119
120
|
# Create a Theme from a theme file (.thmx).
|
|
@@ -219,7 +219,9 @@ module Uniword
|
|
|
219
219
|
row_props.grid_after.value = missing
|
|
220
220
|
end
|
|
221
221
|
record_fix(FixCodes::TABLE_ROW_GRID_AFTER,
|
|
222
|
-
"Added gridAfter=#{missing} to table row
|
|
222
|
+
"Added gridAfter=#{missing} to table row " \
|
|
223
|
+
"(grid has #{grid_col_count} cols, " \
|
|
224
|
+
"row covers #{covered})",
|
|
223
225
|
part: "word/document.xml")
|
|
224
226
|
end
|
|
225
227
|
end
|
|
@@ -98,13 +98,19 @@ module Uniword
|
|
|
98
98
|
|
|
99
99
|
# Margins
|
|
100
100
|
rules << "margin-top: #{CssNumberFormatter.twips_to_in(properties.margin_top)}" if properties.margin_top
|
|
101
|
-
|
|
101
|
+
if properties.margin_bottom
|
|
102
|
+
rules << "margin-bottom: #{CssNumberFormatter.twips_to_in(properties.margin_bottom)}"
|
|
103
|
+
end
|
|
102
104
|
rules << "margin-left: #{CssNumberFormatter.twips_to_in(properties.margin_left)}" if properties.margin_left
|
|
103
105
|
rules << "margin-right: #{CssNumberFormatter.twips_to_in(properties.margin_right)}" if properties.margin_right
|
|
104
106
|
|
|
105
107
|
# Header/Footer margins
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
if properties.header_margin
|
|
109
|
+
rules << "mso-header-margin: #{CssNumberFormatter.twips_to_in(properties.header_margin)}"
|
|
110
|
+
end
|
|
111
|
+
if properties.footer_margin
|
|
112
|
+
rules << "mso-footer-margin: #{CssNumberFormatter.twips_to_in(properties.footer_margin)}"
|
|
113
|
+
end
|
|
108
114
|
|
|
109
115
|
"@page #{section_name} {\n #{rules.join(";\n ")};\n}"
|
|
110
116
|
end
|
|
@@ -108,16 +108,28 @@ module Uniword
|
|
|
108
108
|
package = new
|
|
109
109
|
|
|
110
110
|
# Parse lutaml-model files
|
|
111
|
-
|
|
111
|
+
if (core = zip_content["docProps/core.xml"])
|
|
112
|
+
package.core_properties = CoreProperties.from_xml(core)
|
|
113
|
+
end
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
if (app = zip_content["docProps/app.xml"])
|
|
116
|
+
package.app_properties = AppProperties.from_xml(app)
|
|
117
|
+
end
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
if (theme = zip_content["word/theme/theme1.xml"])
|
|
120
|
+
package.theme = Uniword::Drawingml::Theme.from_xml(theme)
|
|
121
|
+
end
|
|
116
122
|
|
|
117
123
|
# Parse styles and numbering as models
|
|
118
|
-
|
|
124
|
+
if (styles = zip_content["word/styles.xml"])
|
|
125
|
+
package.styles_configuration =
|
|
126
|
+
Uniword::Wordprocessingml::StylesConfiguration.from_xml(styles)
|
|
127
|
+
end
|
|
119
128
|
|
|
120
|
-
|
|
129
|
+
if (numbering = zip_content["word/numbering.xml"])
|
|
130
|
+
package.numbering_configuration =
|
|
131
|
+
Uniword::Wordprocessingml::NumberingConfiguration.from_xml(numbering)
|
|
132
|
+
end
|
|
121
133
|
|
|
122
134
|
# Store raw document XML (will be parsed by DotxHandler)
|
|
123
135
|
package.raw_document_xml = zip_content["word/document.xml"] if zip_content["word/document.xml"]
|
|
@@ -71,7 +71,9 @@ module Uniword
|
|
|
71
71
|
# @param link [Hyperlink] The link to check
|
|
72
72
|
# @return [Boolean] true if internal link
|
|
73
73
|
def internal_link?(link)
|
|
74
|
-
link.is_a?(Lutaml::Model::Serializable) &&
|
|
74
|
+
link.is_a?(Lutaml::Model::Serializable) &&
|
|
75
|
+
link.class.attributes.key?(:anchor) &&
|
|
76
|
+
!link.anchor.nil? && !link.anchor.empty?
|
|
75
77
|
end
|
|
76
78
|
|
|
77
79
|
# Check if link is external (URL)
|
|
@@ -83,10 +85,14 @@ module Uniword
|
|
|
83
85
|
return false unless link
|
|
84
86
|
|
|
85
87
|
# Check for id attribute (relationship-based external link)
|
|
86
|
-
return true if link.is_a?(Lutaml::Model::Serializable) &&
|
|
88
|
+
return true if link.is_a?(Lutaml::Model::Serializable) &&
|
|
89
|
+
link.class.attributes.key?(:id) &&
|
|
90
|
+
!link.id.nil? && !link.id.empty? &&
|
|
91
|
+
!internal_link?(link)
|
|
87
92
|
|
|
88
93
|
# Check for target that looks like a URL
|
|
89
|
-
return !link.target.start_with?("#") if link.is_a?(Lutaml::Model::Serializable) &&
|
|
94
|
+
return !link.target.start_with?("#") if link.is_a?(Lutaml::Model::Serializable) &&
|
|
95
|
+
link.class.attributes.key?(:target) && !link.target.nil? && !link.target.empty?
|
|
90
96
|
|
|
91
97
|
false
|
|
92
98
|
end
|
|
@@ -44,10 +44,16 @@ module Uniword
|
|
|
44
44
|
def self.transform_font_scheme(font_scheme)
|
|
45
45
|
font_scheme.dup.tap do |scheme|
|
|
46
46
|
# Transform major font Latin
|
|
47
|
-
|
|
47
|
+
if scheme.major_font_obj&.latin
|
|
48
|
+
scheme.major_font_obj.latin.typeface =
|
|
49
|
+
substitute(scheme.major_font_obj.latin.typeface)
|
|
50
|
+
end
|
|
48
51
|
|
|
49
52
|
# Transform minor font Latin
|
|
50
|
-
|
|
53
|
+
if scheme.minor_font_obj&.latin
|
|
54
|
+
scheme.minor_font_obj.latin.typeface =
|
|
55
|
+
substitute(scheme.minor_font_obj.latin.typeface)
|
|
56
|
+
end
|
|
51
57
|
end
|
|
52
58
|
end
|
|
53
59
|
|
|
@@ -69,7 +69,11 @@ lightness_shift: nil)
|
|
|
69
69
|
transform_color_scheme(processed.theme_elements.clr_scheme) if processed.theme_elements&.clr_scheme
|
|
70
70
|
|
|
71
71
|
# Transform font scheme
|
|
72
|
-
|
|
72
|
+
if processed.theme_elements&.font_scheme
|
|
73
|
+
FontSubstitutor.transform_font_scheme(
|
|
74
|
+
processed.theme_elements.font_scheme,
|
|
75
|
+
)
|
|
76
|
+
end
|
|
73
77
|
|
|
74
78
|
# Update name to indicate it's a Uniword variant
|
|
75
79
|
processed.name = "#{theme.name} (Uniword)"
|
|
@@ -66,7 +66,10 @@ module Uniword
|
|
|
66
66
|
uniword_slug = detect_ms_theme(word_theme)
|
|
67
67
|
|
|
68
68
|
# Fall back to detection by theme name
|
|
69
|
-
|
|
69
|
+
if uniword_slug.nil? && word_theme.is_a?(Uniword::Drawingml::Theme) &&
|
|
70
|
+
word_theme.name
|
|
71
|
+
uniword_slug = from_ms_name(word_theme.name)
|
|
72
|
+
end
|
|
70
73
|
|
|
71
74
|
return nil unless uniword_slug
|
|
72
75
|
|
data/lib/uniword/styleset.rb
CHANGED
|
@@ -148,7 +148,9 @@ module Uniword
|
|
|
148
148
|
document.styles_configuration.add_style(style.dup,
|
|
149
149
|
allow_overwrite: true)
|
|
150
150
|
when :keep_existing
|
|
151
|
-
|
|
151
|
+
unless document.styles_configuration.style_exists?(style.id)
|
|
152
|
+
document.styles_configuration.add_style(style.dup)
|
|
153
|
+
end
|
|
152
154
|
when :rename
|
|
153
155
|
if document.styles_configuration.style_exists?(style.id)
|
|
154
156
|
new_style = style.dup
|
|
@@ -494,7 +494,8 @@ module Uniword
|
|
|
494
494
|
if text.empty?
|
|
495
495
|
%(<w:sdt#{sdt_attrs}><w:sdtPr></w:sdtPr></w:sdt>)
|
|
496
496
|
else
|
|
497
|
-
%(<w:sdt#{sdt_attrs}><w:sdtPr></w:sdtPr><w:sdtContent
|
|
497
|
+
%(<w:sdt#{sdt_attrs}><w:sdtPr></w:sdtPr><w:sdtContent>) +
|
|
498
|
+
%(<span>#{escape_html(text)}</span></w:sdtContent></w:sdt>)
|
|
498
499
|
end
|
|
499
500
|
end
|
|
500
501
|
|
|
@@ -41,8 +41,9 @@ module Uniword
|
|
|
41
41
|
# Check if link is a footnote reference
|
|
42
42
|
(link.is_a?(Lutaml::Model::Serializable) && link.class.attributes.key?(:footnote_id)) ||
|
|
43
43
|
(link.is_a?(Lutaml::Model::Serializable) && link.class.attributes.key?(:endnote_id)) ||
|
|
44
|
-
(link.is_a?(Lutaml::Model::Serializable) &&
|
|
45
|
-
|
|
44
|
+
(link.is_a?(Lutaml::Model::Serializable) &&
|
|
45
|
+
link.class.attributes.key?(:type) &&
|
|
46
|
+
%i[footnote endnote].include?(link.type))
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
# Validate the footnote reference.
|
|
@@ -75,7 +75,11 @@ module Uniword
|
|
|
75
75
|
parts << " #{layers_count} layers"
|
|
76
76
|
parts << Rainbow("\xC2\xB7").color("#555555").to_s
|
|
77
77
|
parts << Rainbow(" \xE2\x9D\x8C #{errors} error#{'s' unless errors == 1}").red.to_s if errors.positive?
|
|
78
|
-
|
|
78
|
+
if warnings.positive?
|
|
79
|
+
parts << Rainbow(
|
|
80
|
+
" \xE2\x9A\xA0\xEF\xB8\x8F #{warnings} warning#{'s' unless warnings == 1}",
|
|
81
|
+
).yellow.to_s
|
|
82
|
+
end
|
|
79
83
|
parts << Rainbow(" \xE2\x9C\x85 All checks passed").green.to_s if errors.zero? && warnings.zero?
|
|
80
84
|
parts << Rainbow(" \xE2\x8F\xB1 #{report.duration_ms}ms").color("#888888").to_s
|
|
81
85
|
|
data/lib/uniword/version.rb
CHANGED
|
@@ -254,9 +254,11 @@ module Uniword
|
|
|
254
254
|
# writing; nil falls back to Uniword.configuration.validate_on_save
|
|
255
255
|
# @return [void]
|
|
256
256
|
def save(path, format: :auto, profile: nil, validate: nil)
|
|
257
|
-
Uniword.
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
Uniword.with_boot_adapter do
|
|
258
|
+
writer = DocumentWriter.new(self)
|
|
259
|
+
writer.save(path, format: format, profile: profile,
|
|
260
|
+
validate: validate)
|
|
261
|
+
end
|
|
260
262
|
end
|
|
261
263
|
|
|
262
264
|
# Save document to DOCX file using DocxPackage
|
|
@@ -175,15 +175,23 @@ module Uniword
|
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
def convert_vertical_align_attr!
|
|
178
|
-
|
|
178
|
+
return unless @vertical_align && !@vertical_align.is_a?(Properties::VerticalAlign)
|
|
179
|
+
|
|
180
|
+
@vertical_align =
|
|
181
|
+
Properties::VerticalAlign.new(value: @vertical_align.to_s)
|
|
179
182
|
end
|
|
180
183
|
|
|
181
184
|
def convert_simple_wrapper_attrs!
|
|
182
185
|
@position = Properties::Position.new(value: @position) if @position && !@position.is_a?(Properties::Position)
|
|
183
|
-
|
|
186
|
+
if @character_spacing && !@character_spacing.is_a?(Properties::CharacterSpacing)
|
|
187
|
+
@character_spacing =
|
|
188
|
+
Properties::CharacterSpacing.new(value: @character_spacing)
|
|
189
|
+
end
|
|
184
190
|
@kerning = Properties::Kerning.new(value: @kerning) if @kerning && !@kerning.is_a?(Properties::Kerning)
|
|
185
191
|
@width_scale = Properties::WidthScale.new(value: @width_scale) if @width_scale && !@width_scale.is_a?(Properties::WidthScale)
|
|
186
|
-
|
|
192
|
+
if @emphasis_mark && !@emphasis_mark.is_a?(Properties::EmphasisMark)
|
|
193
|
+
@emphasis_mark = Properties::EmphasisMark.new(value: @emphasis_mark.to_s)
|
|
194
|
+
end
|
|
187
195
|
end
|
|
188
196
|
|
|
189
197
|
def convert_text_effect_attrs!
|
|
@@ -50,7 +50,10 @@ module Uniword
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Date control in SDT properties
|
|
53
|
-
# Reference XML:
|
|
53
|
+
# Reference XML:
|
|
54
|
+
# <w:date w:fullDate="2012-06-20T00:00:00Z"><w:dateFormat w:val="M/d/yy"/>
|
|
55
|
+
# <w:lid w:val="en-US"/><w:storeMappedDataAs w:val="dateTime"/>
|
|
56
|
+
# <w:calendar w:val="gregorian"/></w:date>
|
|
54
57
|
class Date < Lutaml::Model::Serializable
|
|
55
58
|
attribute :full_date, :string
|
|
56
59
|
attribute :date_format, DateFormat
|
|
@@ -6,7 +6,9 @@ module Uniword
|
|
|
6
6
|
module Wordprocessingml
|
|
7
7
|
class StructuredDocumentTag
|
|
8
8
|
# Run properties for SDT content formatting
|
|
9
|
-
# Reference XML:
|
|
9
|
+
# Reference XML:
|
|
10
|
+
# <w:rPr><w:caps/><w:color w:val="FFFFFF" w:themeColor="background1"/>
|
|
11
|
+
# <w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr>
|
|
10
12
|
#
|
|
11
13
|
# Uses mixed_content to preserve all child run property elements.
|
|
12
14
|
# This is the same structure as Wordprocessingml::RunProperties but
|
data/lib/uniword.rb
CHANGED
|
@@ -57,15 +57,37 @@ module Uniword
|
|
|
57
57
|
# process-global adapter at their own require or first-parse time -
|
|
58
58
|
# plurimath's mml chain writes
|
|
59
59
|
# Lutaml::Model::Config.xml_adapter_type = :ox (plurimath#588) - so
|
|
60
|
-
# every public entry point
|
|
60
|
+
# every public entry point pins this value for the duration of its
|
|
61
|
+
# operation via with_boot_adapter.
|
|
61
62
|
UNIWORD_XML_ADAPTER = Moxml::Config.default_adapter
|
|
62
63
|
|
|
64
|
+
# Pin the adapter boot resolved for the duration of a uniword
|
|
65
|
+
# operation and restore the caller's value on return. lutaml's adapter
|
|
66
|
+
# setting is process-global: a foreign gem's write (plurimath#588's
|
|
67
|
+
# :ox) must not change uniword's serialization or validation
|
|
68
|
+
# semantics mid-operation - and uniword's entries must not clobber
|
|
69
|
+
# the host's value for the rest of the process. A host may have
|
|
70
|
+
# configured the adapter for its own serializations (metanorma pins
|
|
71
|
+
# :nokogiri for its collection Config; a bare re-assert turned that
|
|
72
|
+
# lane onto the leptris adapter and reformatted its inline XML -
|
|
73
|
+
# metanorma's collection.doc Word suite). nil means the unset
|
|
74
|
+
# delegate form (which resolves to the same Moxml default) and is
|
|
75
|
+
# restored as-is.
|
|
76
|
+
def self.with_boot_adapter
|
|
77
|
+
prior = Lutaml::Model::Config.xml_adapter_type
|
|
78
|
+
Lutaml::Model::Config.xml_adapter_type = UNIWORD_XML_ADAPTER
|
|
79
|
+
yield
|
|
80
|
+
ensure
|
|
81
|
+
Lutaml::Model::Config.xml_adapter_type = prior
|
|
82
|
+
end
|
|
83
|
+
|
|
63
84
|
# Re-assert the adapter boot resolved when another gem's global write
|
|
64
85
|
# has replaced it. nil means the unset delegate form (which resolves to
|
|
65
86
|
# the same Moxml default) and is left alone; a concrete foreign value
|
|
66
|
-
# is replaced.
|
|
67
|
-
#
|
|
68
|
-
#
|
|
87
|
+
# is replaced. Kept for 1.7.10 API compatibility: the entry points no
|
|
88
|
+
# longer call this - they scope the pin with with_boot_adapter,
|
|
89
|
+
# because a bare re-assert permanently overwrites a host-configured
|
|
90
|
+
# adapter for the rest of the process.
|
|
69
91
|
def self.ensure_adapter!
|
|
70
92
|
current = Lutaml::Model::Config.xml_adapter_type
|
|
71
93
|
return if current.nil? || current == UNIWORD_XML_ADAPTER
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uniword
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: leptris
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.9.
|
|
19
|
+
version: 1.9.429
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.9.
|
|
26
|
+
version: 1.9.429
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: logger
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.8.
|
|
47
|
+
version: 0.8.176
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.8.
|
|
54
|
+
version: 0.8.176
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: omml
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|