uniword 1.0.10 → 1.2.4

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 (204) hide show
  1. checksums.yaml +4 -4
  2. data/config/font_metadata.yml +56 -0
  3. data/lib/uniword/accessibility/rules/descriptive_headings_rule.rb +1 -1
  4. data/lib/uniword/assembly/toc.rb +4 -14
  5. data/lib/uniword/assembly/variable_substitutor.rb +3 -4
  6. data/lib/uniword/batch/stages/normalize_styles_stage.rb +4 -2
  7. data/lib/uniword/builder/base_builder.rb +25 -0
  8. data/lib/uniword/builder/chart_builder.rb +33 -14
  9. data/lib/uniword/builder/deterministic_id.rb +17 -0
  10. data/lib/uniword/builder/document_builder.rb +129 -34
  11. data/lib/uniword/builder/footnote_builder.rb +22 -23
  12. data/lib/uniword/builder/header_footer_builder.rb +10 -10
  13. data/lib/uniword/builder/image_builder.rb +24 -16
  14. data/lib/uniword/builder/list_builder.rb +2 -1
  15. data/lib/uniword/builder/paragraph_builder.rb +95 -20
  16. data/lib/uniword/builder/run_utils.rb +97 -0
  17. data/lib/uniword/builder/section_builder.rb +40 -67
  18. data/lib/uniword/builder/table_builder.rb +32 -13
  19. data/lib/uniword/builder/table_cell_builder.rb +19 -0
  20. data/lib/uniword/builder.rb +27 -19
  21. data/lib/uniword/cli/diff_cli.rb +0 -1
  22. data/lib/uniword/cli/generate_cli.rb +0 -1
  23. data/lib/uniword/cli/headers_cli.rb +0 -1
  24. data/lib/uniword/cli/images_cli.rb +0 -1
  25. data/lib/uniword/cli/main.rb +6 -7
  26. data/lib/uniword/cli/protect_cli.rb +0 -1
  27. data/lib/uniword/cli/resources_cli.rb +0 -1
  28. data/lib/uniword/cli/review_cli.rb +0 -1
  29. data/lib/uniword/cli/spellcheck_cli.rb +0 -1
  30. data/lib/uniword/cli/styleset_cli.rb +0 -1
  31. data/lib/uniword/cli/template_cli.rb +0 -1
  32. data/lib/uniword/cli/theme_cli.rb +0 -1
  33. data/lib/uniword/cli/toc_cli.rb +0 -1
  34. data/lib/uniword/cli/watermark_cli.rb +0 -1
  35. data/lib/uniword/cli.rb +6 -17
  36. data/lib/uniword/diff/document_differ.rb +23 -5
  37. data/lib/uniword/diff/package_differ.rb +0 -1
  38. data/lib/uniword/diff.rb +4 -0
  39. data/lib/uniword/document_factory.rb +16 -24
  40. data/lib/uniword/docx/document_statistics.rb +42 -54
  41. data/lib/uniword/docx/id_allocator.rb +143 -0
  42. data/lib/uniword/docx/package.rb +42 -6
  43. data/lib/uniword/docx/package_defaults.rb +16 -25
  44. data/lib/uniword/docx/package_serialization.rb +131 -127
  45. data/lib/uniword/docx/reconciler/body.rb +197 -0
  46. data/lib/uniword/docx/reconciler/fix_codes.rb +74 -0
  47. data/lib/uniword/docx/reconciler/helpers.rb +337 -0
  48. data/lib/uniword/docx/reconciler/notes.rb +301 -0
  49. data/lib/uniword/docx/reconciler/package_structure.rb +322 -0
  50. data/lib/uniword/docx/reconciler/parts.rb +484 -0
  51. data/lib/uniword/docx/reconciler/referential_integrity.rb +449 -0
  52. data/lib/uniword/docx/reconciler/tables.rb +162 -0
  53. data/lib/uniword/docx/reconciler/theme.rb +141 -0
  54. data/lib/uniword/docx/reconciler.rb +44 -1069
  55. data/lib/uniword/docx.rb +3 -0
  56. data/lib/uniword/drawingml/color_scheme.rb +38 -5
  57. data/lib/uniword/hyperlink.rb +27 -26
  58. data/lib/uniword/infrastructure/zip_packager.rb +41 -38
  59. data/lib/uniword/lazy_loader.rb +36 -62
  60. data/lib/uniword/math.rb +3 -86
  61. data/lib/uniword/mhtml/document.rb +1 -3
  62. data/lib/uniword/model_attribute_access.rb +27 -0
  63. data/lib/uniword/ooxml/namespaces.rb +62 -2
  64. data/lib/uniword/ooxml/relationships/package_relationships.rb +7 -0
  65. data/lib/uniword/presentationml/slide_id.rb +0 -1
  66. data/lib/uniword/presentationml/slide_master_id.rb +0 -1
  67. data/lib/uniword/properties/bold.rb +0 -2
  68. data/lib/uniword/properties/boolean_formatting.rb +0 -2
  69. data/lib/uniword/properties/borders.rb +1 -1
  70. data/lib/uniword/properties/italic.rb +0 -2
  71. data/lib/uniword/properties/numbering_properties.rb +1 -1
  72. data/lib/uniword/properties/style_reference.rb +13 -0
  73. data/lib/uniword/quality/rules/heading_hierarchy_rule.rb +1 -1
  74. data/lib/uniword/quality/rules/style_consistency_rule.rb +1 -1
  75. data/lib/uniword/review/review_manager.rb +0 -2
  76. data/lib/uniword/template/helpers/loop_helper.rb +2 -2
  77. data/lib/uniword/template/variable_resolver.rb +14 -1
  78. data/lib/uniword/theme/theme_xml_parser.rb +1 -1
  79. data/lib/uniword/toc/toc_generator.rb +3 -14
  80. data/lib/uniword/transformation/mhtml_element_renderer.rb +94 -37
  81. data/lib/uniword/transformation/mhtml_metadata_builder.rb +1 -1
  82. data/lib/uniword/transformation/mhtml_style_builder.rb +9 -2
  83. data/lib/uniword/transformation/ooxml_to_html_converter.rb +3 -5
  84. data/lib/uniword/transformation/ooxml_to_mhtml_converter.rb +7 -15
  85. data/lib/uniword/transformation/yaml_css_generator.rb +815 -0
  86. data/lib/uniword/transformation.rb +2 -0
  87. data/lib/uniword/validation/checkers/internal_link_checker.rb +2 -3
  88. data/lib/uniword/version.rb +1 -1
  89. data/lib/uniword/visitor/text_extractor.rb +2 -1
  90. data/lib/uniword/watermark/manager.rb +2 -2
  91. data/lib/uniword/wordprocessingml/allow_png.rb +14 -0
  92. data/lib/uniword/wordprocessingml/body.rb +53 -18
  93. data/lib/uniword/wordprocessingml/body_div.rb +17 -0
  94. data/lib/uniword/wordprocessingml/div_border.rb +23 -0
  95. data/lib/uniword/wordprocessingml/div_borders.rb +24 -0
  96. data/lib/uniword/wordprocessingml/divs_child.rb +17 -0
  97. data/lib/uniword/wordprocessingml/document_root.rb +6 -3
  98. data/lib/uniword/wordprocessingml/endnote.rb +1 -1
  99. data/lib/uniword/wordprocessingml/endnotes.rb +4 -0
  100. data/lib/uniword/wordprocessingml/footer.rb +4 -0
  101. data/lib/uniword/wordprocessingml/footer_reference.rb +0 -1
  102. data/lib/uniword/wordprocessingml/footnote.rb +1 -1
  103. data/lib/uniword/wordprocessingml/footnotes.rb +4 -0
  104. data/lib/uniword/wordprocessingml/header.rb +4 -0
  105. data/lib/uniword/wordprocessingml/header_reference.rb +0 -1
  106. data/lib/uniword/wordprocessingml/hyperlink.rb +2 -2
  107. data/lib/uniword/wordprocessingml/instr_text.rb +20 -5
  108. data/lib/uniword/wordprocessingml/level.rb +2 -0
  109. data/lib/uniword/wordprocessingml/mar_bottom.rb +17 -0
  110. data/lib/uniword/wordprocessingml/mar_left.rb +17 -0
  111. data/lib/uniword/wordprocessingml/mar_right.rb +17 -0
  112. data/lib/uniword/wordprocessingml/mar_top.rb +17 -0
  113. data/lib/uniword/wordprocessingml/num.rb +4 -0
  114. data/lib/uniword/wordprocessingml/numbering.rb +1 -22
  115. data/lib/uniword/wordprocessingml/optimize_for_browser.rb +14 -0
  116. data/lib/uniword/wordprocessingml/page_defaults.rb +39 -0
  117. data/lib/uniword/wordprocessingml/paragraph.rb +16 -13
  118. data/lib/uniword/wordprocessingml/paragraph_properties.rb +12 -8
  119. data/lib/uniword/wordprocessingml/run.rb +32 -36
  120. data/lib/uniword/wordprocessingml/run_properties/merging.rb +45 -0
  121. data/lib/uniword/wordprocessingml/run_properties.rb +8 -5
  122. data/lib/uniword/wordprocessingml/section_properties.rb +3 -3
  123. data/lib/uniword/wordprocessingml/separator_char.rb +21 -0
  124. data/lib/uniword/wordprocessingml/settings.rb +19 -17
  125. data/lib/uniword/wordprocessingml/styles/style_definition.rb +1 -1
  126. data/lib/uniword/wordprocessingml/styles/style_library.rb +16 -0
  127. data/lib/uniword/wordprocessingml/table_defaults.rb +44 -0
  128. data/lib/uniword/wordprocessingml/text.rb +8 -2
  129. data/lib/uniword/wordprocessingml/web_div.rb +41 -0
  130. data/lib/uniword/wordprocessingml/web_divs.rb +18 -0
  131. data/lib/uniword/wordprocessingml/web_encoding.rb +17 -0
  132. data/lib/uniword/wordprocessingml/web_settings.rb +5 -21
  133. data/lib/uniword/wordprocessingml/zoom.rb +2 -0
  134. data/lib/uniword/wordprocessingml.rb +23 -0
  135. data/lib/uniword.rb +27 -0
  136. metadata +47 -70
  137. data/lib/uniword/math/accent.rb +0 -25
  138. data/lib/uniword/math/accent_properties.rb +0 -25
  139. data/lib/uniword/math/argument_properties.rb +0 -22
  140. data/lib/uniword/math/bar.rb +0 -25
  141. data/lib/uniword/math/bar_properties.rb +0 -25
  142. data/lib/uniword/math/begin_char.rb +0 -22
  143. data/lib/uniword/math/border_box.rb +0 -25
  144. data/lib/uniword/math/border_box_properties.rb +0 -39
  145. data/lib/uniword/math/box.rb +0 -25
  146. data/lib/uniword/math/box_properties.rb +0 -33
  147. data/lib/uniword/math/char.rb +0 -22
  148. data/lib/uniword/math/control_properties.rb +0 -27
  149. data/lib/uniword/math/degree.rb +0 -26
  150. data/lib/uniword/math/delimiter.rb +0 -25
  151. data/lib/uniword/math/delimiter_properties.rb +0 -33
  152. data/lib/uniword/math/denominator.rb +0 -26
  153. data/lib/uniword/math/element.rb +0 -61
  154. data/lib/uniword/math/end_char.rb +0 -22
  155. data/lib/uniword/math/equation_array.rb +0 -25
  156. data/lib/uniword/math/equation_array_properties.rb +0 -33
  157. data/lib/uniword/math/fraction.rb +0 -27
  158. data/lib/uniword/math/fraction_properties.rb +0 -25
  159. data/lib/uniword/math/function.rb +0 -27
  160. data/lib/uniword/math/function_name.rb +0 -26
  161. data/lib/uniword/math/function_properties.rb +0 -23
  162. data/lib/uniword/math/group_char.rb +0 -25
  163. data/lib/uniword/math/group_char_properties.rb +0 -29
  164. data/lib/uniword/math/lim.rb +0 -26
  165. data/lib/uniword/math/lower_limit.rb +0 -27
  166. data/lib/uniword/math/lower_limit_properties.rb +0 -23
  167. data/lib/uniword/math/math_break.rb +0 -22
  168. data/lib/uniword/math/math_font.rb +0 -22
  169. data/lib/uniword/math/math_properties.rb +0 -53
  170. data/lib/uniword/math/math_run.rb +0 -42
  171. data/lib/uniword/math/math_run_properties.rb +0 -37
  172. data/lib/uniword/math/math_simple_int_val.rb +0 -24
  173. data/lib/uniword/math/math_simple_val.rb +0 -24
  174. data/lib/uniword/math/math_style.rb +0 -22
  175. data/lib/uniword/math/math_text.rb +0 -23
  176. data/lib/uniword/math/matrix.rb +0 -25
  177. data/lib/uniword/math/matrix_column.rb +0 -23
  178. data/lib/uniword/math/matrix_column_properties.rb +0 -24
  179. data/lib/uniword/math/matrix_columns.rb +0 -23
  180. data/lib/uniword/math/matrix_properties.rb +0 -37
  181. data/lib/uniword/math/matrix_row.rb +0 -23
  182. data/lib/uniword/math/nary.rb +0 -29
  183. data/lib/uniword/math/nary_properties.rb +0 -33
  184. data/lib/uniword/math/numerator.rb +0 -26
  185. data/lib/uniword/math/o_math.rb +0 -65
  186. data/lib/uniword/math/o_math_para.rb +0 -25
  187. data/lib/uniword/math/o_math_para_properties.rb +0 -22
  188. data/lib/uniword/math/phantom.rb +0 -25
  189. data/lib/uniword/math/phantom_properties.rb +0 -33
  190. data/lib/uniword/math/pre_sub_superscript.rb +0 -29
  191. data/lib/uniword/math/pre_sub_superscript_properties.rb +0 -23
  192. data/lib/uniword/math/radical.rb +0 -27
  193. data/lib/uniword/math/radical_properties.rb +0 -25
  194. data/lib/uniword/math/separator_char.rb +0 -22
  195. data/lib/uniword/math/sub.rb +0 -26
  196. data/lib/uniword/math/sub_superscript.rb +0 -29
  197. data/lib/uniword/math/sub_superscript_properties.rb +0 -25
  198. data/lib/uniword/math/subscript.rb +0 -27
  199. data/lib/uniword/math/subscript_properties.rb +0 -23
  200. data/lib/uniword/math/sup.rb +0 -26
  201. data/lib/uniword/math/superscript.rb +0 -27
  202. data/lib/uniword/math/superscript_properties.rb +0 -23
  203. data/lib/uniword/math/upper_limit.rb +0 -27
  204. data/lib/uniword/math/upper_limit_properties.rb +0 -23
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Radical object (square root, nth root)
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:rad>
11
- class Radical < Lutaml::Model::Serializable
12
- attribute :properties, RadicalProperties
13
- attribute :degree, Degree
14
- attribute :element, Element
15
-
16
- xml do
17
- element "rad"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "radPr", to: :properties, render_nil: false
22
- map_element "deg", to: :degree, render_nil: false
23
- map_element "e", to: :element
24
- end
25
- end
26
- end
27
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Radical formatting properties
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:radPr>
11
- class RadicalProperties < Lutaml::Model::Serializable
12
- attribute :deg_hide, MathSimpleVal
13
- attribute :ctrl_pr, ControlProperties
14
-
15
- xml do
16
- element "radPr"
17
- namespace Uniword::Ooxml::Namespaces::MathML
18
- mixed_content
19
-
20
- map_element "degHide", to: :deg_hide, render_nil: false
21
- map_element "ctrlPr", to: :ctrl_pr, render_nil: false
22
- end
23
- end
24
- end
25
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Separator delimiter character
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sepChr>
11
- class SeparatorChar < Lutaml::Model::Serializable
12
- attribute :val, :string
13
-
14
- xml do
15
- element "sepChr"
16
- namespace Uniword::Ooxml::Namespaces::MathML
17
-
18
- map_attribute "val", to: :val
19
- end
20
- end
21
- end
22
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Subscript content
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sub>
11
- class Sub < Lutaml::Model::Serializable
12
- # Pattern 0: Attributes BEFORE xml mappings
13
- attribute :arg_properties, ArgumentProperties
14
- attribute :runs, MathRun, collection: true, initialize_empty: true
15
-
16
- xml do
17
- element "sub"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "argPr", to: :arg_properties, render_nil: false
22
- map_element "r", to: :runs, render_nil: false
23
- end
24
- end
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Subscript and superscript object
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSubSup>
11
- class SubSuperscript < Lutaml::Model::Serializable
12
- attribute :properties, SubSuperscriptProperties
13
- attribute :element, Element
14
- attribute :sub, Sub
15
- attribute :sup, Sup
16
-
17
- xml do
18
- element "sSubSup"
19
- namespace Uniword::Ooxml::Namespaces::MathML
20
- mixed_content
21
-
22
- map_element "sSubSupPr", to: :properties, render_nil: false
23
- map_element "e", to: :element
24
- map_element "sub", to: :sub
25
- map_element "sup", to: :sup
26
- end
27
- end
28
- end
29
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Sub-superscript formatting properties
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSubSupPr>
11
- class SubSuperscriptProperties < Lutaml::Model::Serializable
12
- attribute :aln_scr, :string
13
- attribute :ctrl_pr, ControlProperties
14
-
15
- xml do
16
- element "sSubSupPr"
17
- namespace Uniword::Ooxml::Namespaces::MathML
18
- mixed_content
19
-
20
- map_attribute "val", to: :aln_scr
21
- map_element "ctrlPr", to: :ctrl_pr, render_nil: false
22
- end
23
- end
24
- end
25
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Subscript object
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSub>
11
- class Subscript < Lutaml::Model::Serializable
12
- attribute :properties, SubscriptProperties
13
- attribute :element, Element
14
- attribute :sub, Sub
15
-
16
- xml do
17
- element "sSub"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "sSubPr", to: :properties, render_nil: false
22
- map_element "e", to: :element
23
- map_element "sub", to: :sub
24
- end
25
- end
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Subscript formatting properties
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSubPr>
11
- class SubscriptProperties < Lutaml::Model::Serializable
12
- attribute :ctrl_pr, ControlProperties
13
-
14
- xml do
15
- element "sSubPr"
16
- namespace Uniword::Ooxml::Namespaces::MathML
17
- mixed_content
18
-
19
- map_element "ctrlPr", to: :ctrl_pr, render_nil: false
20
- end
21
- end
22
- end
23
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Superscript content
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sup>
11
- class Sup < Lutaml::Model::Serializable
12
- # Pattern 0: Attributes BEFORE xml mappings
13
- attribute :arg_properties, ArgumentProperties
14
- attribute :runs, MathRun, collection: true, initialize_empty: true
15
-
16
- xml do
17
- element "sup"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "argPr", to: :arg_properties, render_nil: false
22
- map_element "r", to: :runs, render_nil: false
23
- end
24
- end
25
- end
26
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Superscript object
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSup>
11
- class Superscript < Lutaml::Model::Serializable
12
- attribute :properties, SuperscriptProperties
13
- attribute :element, Element
14
- attribute :sup, Sup
15
-
16
- xml do
17
- element "sSup"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "sSupPr", to: :properties, render_nil: false
22
- map_element "e", to: :element
23
- map_element "sup", to: :sup
24
- end
25
- end
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Superscript formatting properties
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:sSupPr>
11
- class SuperscriptProperties < Lutaml::Model::Serializable
12
- attribute :ctrl_pr, ControlProperties
13
-
14
- xml do
15
- element "sSupPr"
16
- namespace Uniword::Ooxml::Namespaces::MathML
17
- mixed_content
18
-
19
- map_element "ctrlPr", to: :ctrl_pr, render_nil: false
20
- end
21
- end
22
- end
23
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Upper limit object
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:limUpp>
11
- class UpperLimit < Lutaml::Model::Serializable
12
- attribute :properties, UpperLimitProperties
13
- attribute :element, Element
14
- attribute :lim, Lim
15
-
16
- xml do
17
- element "limUpp"
18
- namespace Uniword::Ooxml::Namespaces::MathML
19
- mixed_content
20
-
21
- map_element "limUppPr", to: :properties, render_nil: false
22
- map_element "e", to: :element
23
- map_element "lim", to: :lim
24
- end
25
- end
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "lutaml/model"
4
-
5
- module Uniword
6
- module Math
7
- # Upper limit formatting properties
8
- #
9
- # Generated from OOXML schema: math.yml
10
- # Element: <m:limUppPr>
11
- class UpperLimitProperties < Lutaml::Model::Serializable
12
- attribute :ctrl_pr, ControlProperties
13
-
14
- xml do
15
- element "limUppPr"
16
- namespace Uniword::Ooxml::Namespaces::MathML
17
- mixed_content
18
-
19
- map_element "ctrlPr", to: :ctrl_pr, render_nil: false
20
- end
21
- end
22
- end
23
- end