uniword 1.0.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 +7 -0
- data/CHANGELOG.md +428 -0
- data/CONTRIBUTING.md +479 -0
- data/LICENSE.txt +25 -0
- data/README.adoc +2186 -0
- data/exe/uniword +6 -0
- data/lib/uniword/accessibility/accessibility_checker.rb +115 -0
- data/lib/uniword/accessibility/accessibility_profile.rb +133 -0
- data/lib/uniword/accessibility/accessibility_report.rb +212 -0
- data/lib/uniword/accessibility/accessibility_rule.rb +93 -0
- data/lib/uniword/accessibility/accessibility_violation.rb +80 -0
- data/lib/uniword/accessibility/rules/color_usage_rule.rb +30 -0
- data/lib/uniword/accessibility/rules/contrast_ratio_rule.rb +31 -0
- data/lib/uniword/accessibility/rules/descriptive_headings_rule.rb +99 -0
- data/lib/uniword/accessibility/rules/document_title_rule.rb +64 -0
- data/lib/uniword/accessibility/rules/heading_structure_rule.rb +127 -0
- data/lib/uniword/accessibility/rules/image_alt_text_rule.rb +89 -0
- data/lib/uniword/accessibility/rules/language_specification_rule.rb +55 -0
- data/lib/uniword/accessibility/rules/list_structure_rule.rb +33 -0
- data/lib/uniword/accessibility/rules/reading_order_rule.rb +30 -0
- data/lib/uniword/accessibility/rules/table_headers_rule.rb +61 -0
- data/lib/uniword/accessibility/rules.rb +18 -0
- data/lib/uniword/accessibility.rb +12 -0
- data/lib/uniword/assembly/assembly_manifest.rb +189 -0
- data/lib/uniword/assembly/component_registry.rb +260 -0
- data/lib/uniword/assembly/cross_reference_resolver.rb +241 -0
- data/lib/uniword/assembly/document_assembler.rb +296 -0
- data/lib/uniword/assembly/toc.rb +227 -0
- data/lib/uniword/assembly/toc_entry.rb +124 -0
- data/lib/uniword/assembly/toc_instruction.rb +92 -0
- data/lib/uniword/assembly/variable_substitutor.rb +238 -0
- data/lib/uniword/assembly.rb +14 -0
- data/lib/uniword/batch/batch_result.rb +244 -0
- data/lib/uniword/batch/document_processor.rb +339 -0
- data/lib/uniword/batch/processing_stage.rb +92 -0
- data/lib/uniword/batch/stages/compress_images_stage.rb +187 -0
- data/lib/uniword/batch/stages/convert_format_stage.rb +117 -0
- data/lib/uniword/batch/stages/normalize_styles_stage.rb +174 -0
- data/lib/uniword/batch/stages/quality_check_stage.rb +149 -0
- data/lib/uniword/batch/stages/update_metadata_stage.rb +103 -0
- data/lib/uniword/batch/stages/validate_links_stage.rb +203 -0
- data/lib/uniword/batch.rb +16 -0
- data/lib/uniword/bibliography/author.rb +80 -0
- data/lib/uniword/bibliography/city.rb +22 -0
- data/lib/uniword/bibliography/corporate.rb +22 -0
- data/lib/uniword/bibliography/day.rb +22 -0
- data/lib/uniword/bibliography/edition.rb +22 -0
- data/lib/uniword/bibliography/first.rb +22 -0
- data/lib/uniword/bibliography/first_name.rb +22 -0
- data/lib/uniword/bibliography/guid.rb +22 -0
- data/lib/uniword/bibliography/issue.rb +22 -0
- data/lib/uniword/bibliography/last.rb +22 -0
- data/lib/uniword/bibliography/last_name.rb +22 -0
- data/lib/uniword/bibliography/lcid.rb +22 -0
- data/lib/uniword/bibliography/locale_id.rb +22 -0
- data/lib/uniword/bibliography/month.rb +22 -0
- data/lib/uniword/bibliography/name_list.rb +23 -0
- data/lib/uniword/bibliography/pages.rb +22 -0
- data/lib/uniword/bibliography/person.rb +27 -0
- data/lib/uniword/bibliography/publisher.rb +22 -0
- data/lib/uniword/bibliography/ref_order.rb +22 -0
- data/lib/uniword/bibliography/source.rb +169 -0
- data/lib/uniword/bibliography/source_tag.rb +22 -0
- data/lib/uniword/bibliography/source_type.rb +22 -0
- data/lib/uniword/bibliography/sources.rb +29 -0
- data/lib/uniword/bibliography/tag.rb +22 -0
- data/lib/uniword/bibliography/title.rb +22 -0
- data/lib/uniword/bibliography/url.rb +22 -0
- data/lib/uniword/bibliography/volume_number.rb +22 -0
- data/lib/uniword/bibliography/year.rb +22 -0
- data/lib/uniword/bibliography.rb +45 -0
- data/lib/uniword/bookmark.rb +103 -0
- data/lib/uniword/builder/bibliography_builder.rb +188 -0
- data/lib/uniword/builder/chart_builder.rb +365 -0
- data/lib/uniword/builder/comment_builder.rb +54 -0
- data/lib/uniword/builder/document_builder.rb +548 -0
- data/lib/uniword/builder/footnote_builder.rb +102 -0
- data/lib/uniword/builder/header_footer_builder.rb +79 -0
- data/lib/uniword/builder/image_builder.rb +316 -0
- data/lib/uniword/builder/list_builder.rb +51 -0
- data/lib/uniword/builder/numbering_builder.rb +42 -0
- data/lib/uniword/builder/paragraph_builder.rb +228 -0
- data/lib/uniword/builder/run_builder.rb +285 -0
- data/lib/uniword/builder/sdt_builder.rb +205 -0
- data/lib/uniword/builder/section_builder.rb +170 -0
- data/lib/uniword/builder/style_builder.rb +129 -0
- data/lib/uniword/builder/table_builder.rb +111 -0
- data/lib/uniword/builder/table_cell_builder.rb +138 -0
- data/lib/uniword/builder/table_row_builder.rb +65 -0
- data/lib/uniword/builder/theme_builder.rb +98 -0
- data/lib/uniword/builder/toc_builder.rb +54 -0
- data/lib/uniword/builder/watermark_builder.rb +95 -0
- data/lib/uniword/builder.rb +232 -0
- data/lib/uniword/chart/area3_d_chart.rb +35 -0
- data/lib/uniword/chart/area_chart.rb +33 -0
- data/lib/uniword/chart/auto_title_deleted.rb +22 -0
- data/lib/uniword/chart/axis_id.rb +22 -0
- data/lib/uniword/chart/axis_position.rb +22 -0
- data/lib/uniword/chart/bar3_d_chart.rb +39 -0
- data/lib/uniword/chart/bar_chart.rb +37 -0
- data/lib/uniword/chart/bubble_chart.rb +37 -0
- data/lib/uniword/chart/bubble_size.rb +25 -0
- data/lib/uniword/chart/cat_ax.rb +45 -0
- data/lib/uniword/chart/category_axis_data.rb +29 -0
- data/lib/uniword/chart/chart.rb +33 -0
- data/lib/uniword/chart/chart_reference.rb +24 -0
- data/lib/uniword/chart/chart_space.rb +35 -0
- data/lib/uniword/chart/color_map_override.rb +22 -0
- data/lib/uniword/chart/data_label.rb +35 -0
- data/lib/uniword/chart/data_labels.rb +41 -0
- data/lib/uniword/chart/date_ax.rb +45 -0
- data/lib/uniword/chart/diagram_reference.rb +24 -0
- data/lib/uniword/chart/doughnut_chart.rb +31 -0
- data/lib/uniword/chart/drop_lines.rb +23 -0
- data/lib/uniword/chart/error_bar_type.rb +22 -0
- data/lib/uniword/chart/error_bars.rb +37 -0
- data/lib/uniword/chart/error_direction.rb +22 -0
- data/lib/uniword/chart/explosion.rb +22 -0
- data/lib/uniword/chart/gap_width.rb +22 -0
- data/lib/uniword/chart/hi_low_lines.rb +23 -0
- data/lib/uniword/chart/index.rb +22 -0
- data/lib/uniword/chart/layout.rb +23 -0
- data/lib/uniword/chart/legend.rb +33 -0
- data/lib/uniword/chart/legend_entry.rb +27 -0
- data/lib/uniword/chart/legend_position.rb +22 -0
- data/lib/uniword/chart/line3_d_chart.rb +35 -0
- data/lib/uniword/chart/line_chart.rb +41 -0
- data/lib/uniword/chart/major_gridlines.rb +23 -0
- data/lib/uniword/chart/marker.rb +27 -0
- data/lib/uniword/chart/marker_size.rb +22 -0
- data/lib/uniword/chart/marker_style.rb +22 -0
- data/lib/uniword/chart/minor_gridlines.rb +23 -0
- data/lib/uniword/chart/number_reference.rb +25 -0
- data/lib/uniword/chart/numbering_format.rb +24 -0
- data/lib/uniword/chart/order.rb +22 -0
- data/lib/uniword/chart/orientation.rb +22 -0
- data/lib/uniword/chart/pie3_d_chart.rb +27 -0
- data/lib/uniword/chart/pie_chart.rb +29 -0
- data/lib/uniword/chart/plot_area.rb +35 -0
- data/lib/uniword/chart/plot_vis_only.rb +22 -0
- data/lib/uniword/chart/radar_chart.rb +31 -0
- data/lib/uniword/chart/scaling.rb +29 -0
- data/lib/uniword/chart/scatter_chart.rb +31 -0
- data/lib/uniword/chart/ser_ax.rb +43 -0
- data/lib/uniword/chart/series.rb +29 -0
- data/lib/uniword/chart/series_text.rb +25 -0
- data/lib/uniword/chart/shape_properties.rb +22 -0
- data/lib/uniword/chart/show_category_name.rb +22 -0
- data/lib/uniword/chart/show_legend_key.rb +22 -0
- data/lib/uniword/chart/show_value.rb +22 -0
- data/lib/uniword/chart/smooth.rb +22 -0
- data/lib/uniword/chart/stock_chart.rb +33 -0
- data/lib/uniword/chart/style.rb +22 -0
- data/lib/uniword/chart/surface3_d_chart.rb +29 -0
- data/lib/uniword/chart/surface_chart.rb +29 -0
- data/lib/uniword/chart/text_properties.rb +22 -0
- data/lib/uniword/chart/tick_label_position.rb +22 -0
- data/lib/uniword/chart/title.rb +31 -0
- data/lib/uniword/chart/trendline.rb +35 -0
- data/lib/uniword/chart/trendline_type.rb +22 -0
- data/lib/uniword/chart/up_down_bars.rb +27 -0
- data/lib/uniword/chart/val_ax.rb +49 -0
- data/lib/uniword/chart/values.rb +25 -0
- data/lib/uniword/chart/x_values.rb +25 -0
- data/lib/uniword/chart/y_values.rb +25 -0
- data/lib/uniword/chart.rb +105 -0
- data/lib/uniword/cli.rb +737 -0
- data/lib/uniword/column_configuration.rb +111 -0
- data/lib/uniword/comment.rb +147 -0
- data/lib/uniword/comment_range.rb +122 -0
- data/lib/uniword/comments_part.rb +130 -0
- data/lib/uniword/configuration/configuration_loader.rb +168 -0
- data/lib/uniword/configuration.rb +7 -0
- data/lib/uniword/content_types/default.rb +24 -0
- data/lib/uniword/content_types/override.rb +24 -0
- data/lib/uniword/content_types/types.rb +26 -0
- data/lib/uniword/content_types.rb +76 -0
- data/lib/uniword/customxml/custom_xml.rb +29 -0
- data/lib/uniword/customxml/custom_xml_attribute.rb +26 -0
- data/lib/uniword/customxml/custom_xml_block.rb +29 -0
- data/lib/uniword/customxml/custom_xml_cell.rb +29 -0
- data/lib/uniword/customxml/custom_xml_del_range_start.rb +26 -0
- data/lib/uniword/customxml/custom_xml_ins_range_end.rb +22 -0
- data/lib/uniword/customxml/custom_xml_ins_range_start.rb +26 -0
- data/lib/uniword/customxml/custom_xml_move_from_range_end.rb +22 -0
- data/lib/uniword/customxml/custom_xml_move_from_range_start.rb +26 -0
- data/lib/uniword/customxml/custom_xml_move_to_range_end.rb +22 -0
- data/lib/uniword/customxml/custom_xml_move_to_range_start.rb +26 -0
- data/lib/uniword/customxml/custom_xml_properties.rb +27 -0
- data/lib/uniword/customxml/custom_xml_row.rb +29 -0
- data/lib/uniword/customxml/custom_xml_run.rb +29 -0
- data/lib/uniword/customxml/data_binding.rb +26 -0
- data/lib/uniword/customxml/data_store_item.rb +24 -0
- data/lib/uniword/customxml/element_name.rb +22 -0
- data/lib/uniword/customxml/name.rb +22 -0
- data/lib/uniword/customxml/namespace_uri.rb +22 -0
- data/lib/uniword/customxml/placeholder.rb +22 -0
- data/lib/uniword/customxml/placeholder_text.rb +22 -0
- data/lib/uniword/customxml/prefix_mappings.rb +22 -0
- data/lib/uniword/customxml/schema_reference.rb +41 -0
- data/lib/uniword/customxml/showing_placeholder.rb +24 -0
- data/lib/uniword/customxml/showing_placeholder_header.rb +22 -0
- data/lib/uniword/customxml/smart_tag.rb +29 -0
- data/lib/uniword/customxml/smart_tag_attribute.rb +24 -0
- data/lib/uniword/customxml/smart_tag_element.rb +22 -0
- data/lib/uniword/customxml/smart_tag_name.rb +22 -0
- data/lib/uniword/customxml/smart_tag_properties.rb +23 -0
- data/lib/uniword/customxml/smart_tag_type.rb +26 -0
- data/lib/uniword/customxml/smart_tag_uri.rb +22 -0
- data/lib/uniword/customxml/store_item_id.rb +22 -0
- data/lib/uniword/customxml/x_path.rb +22 -0
- data/lib/uniword/customxml/x_path_expression.rb +22 -0
- data/lib/uniword/customxml.rb +53 -0
- data/lib/uniword/document_factory.rb +214 -0
- data/lib/uniword/document_properties/app_version.rb +22 -0
- data/lib/uniword/document_properties/application.rb +22 -0
- data/lib/uniword/document_properties/bool_value.rb +22 -0
- data/lib/uniword/document_properties/company.rb +22 -0
- data/lib/uniword/document_properties/custom_properties.rb +23 -0
- data/lib/uniword/document_properties/custom_property.rb +37 -0
- data/lib/uniword/document_properties/doc_security.rb +22 -0
- data/lib/uniword/document_properties/extended_properties.rb +41 -0
- data/lib/uniword/document_properties/file_time.rb +22 -0
- data/lib/uniword/document_properties/heading_pairs.rb +23 -0
- data/lib/uniword/document_properties/hyperlinks_changed.rb +22 -0
- data/lib/uniword/document_properties/i4.rb +22 -0
- data/lib/uniword/document_properties/links_up_to_date.rb +22 -0
- data/lib/uniword/document_properties/lpw_str.rb +22 -0
- data/lib/uniword/document_properties/manager.rb +22 -0
- data/lib/uniword/document_properties/scale_crop.rb +22 -0
- data/lib/uniword/document_properties/shared_doc.rb +22 -0
- data/lib/uniword/document_properties/titles_of_parts.rb +23 -0
- data/lib/uniword/document_properties/variant.rb +25 -0
- data/lib/uniword/document_properties/vector.rb +27 -0
- data/lib/uniword/document_properties.rb +32 -0
- data/lib/uniword/document_variables/data_type.rb +22 -0
- data/lib/uniword/document_variables/default_value.rb +22 -0
- data/lib/uniword/document_variables/doc_var.rb +24 -0
- data/lib/uniword/document_variables/doc_vars.rb +23 -0
- data/lib/uniword/document_variables/read_only.rb +24 -0
- data/lib/uniword/document_variables/variable_binding.rb +26 -0
- data/lib/uniword/document_variables/variable_collection.rb +25 -0
- data/lib/uniword/document_variables/variable_expression.rb +22 -0
- data/lib/uniword/document_variables/variable_format.rb +22 -0
- data/lib/uniword/document_variables/variable_scope.rb +22 -0
- data/lib/uniword/document_variables.rb +23 -0
- data/lib/uniword/document_writer.rb +157 -0
- data/lib/uniword/drawingml/adjust_value_list.rb +22 -0
- data/lib/uniword/drawingml/alpha.rb +22 -0
- data/lib/uniword/drawingml/alpha_bi_level.rb +22 -0
- data/lib/uniword/drawingml/alpha_modulation.rb +22 -0
- data/lib/uniword/drawingml/alpha_modulation_fixed.rb +22 -0
- data/lib/uniword/drawingml/alpha_offset.rb +22 -0
- data/lib/uniword/drawingml/arc_to.rb +28 -0
- data/lib/uniword/drawingml/background_color.rb +24 -0
- data/lib/uniword/drawingml/bevel_top.rb +26 -0
- data/lib/uniword/drawingml/bi_level.rb +22 -0
- data/lib/uniword/drawingml/blip.rb +30 -0
- data/lib/uniword/drawingml/blip_fill.rb +28 -0
- data/lib/uniword/drawingml/blue.rb +22 -0
- data/lib/uniword/drawingml/blur.rb +24 -0
- data/lib/uniword/drawingml/body_properties.rb +22 -0
- data/lib/uniword/drawingml/camera.rb +24 -0
- data/lib/uniword/drawingml/close_path.rb +18 -0
- data/lib/uniword/drawingml/color_scheme.rb +381 -0
- data/lib/uniword/drawingml/complex_script_font.rb +24 -0
- data/lib/uniword/drawingml/custom_dash.rb +22 -0
- data/lib/uniword/drawingml/custom_geometry.rb +24 -0
- data/lib/uniword/drawingml/dash_stop.rb +24 -0
- data/lib/uniword/drawingml/default_paragraph_properties.rb +24 -0
- data/lib/uniword/drawingml/duotone.rb +22 -0
- data/lib/uniword/drawingml/east_asian_font.rb +24 -0
- data/lib/uniword/drawingml/effect_container.rb +22 -0
- data/lib/uniword/drawingml/effect_list.rb +30 -0
- data/lib/uniword/drawingml/extension.rb +53 -0
- data/lib/uniword/drawingml/extension_list.rb +25 -0
- data/lib/uniword/drawingml/extents.rb +24 -0
- data/lib/uniword/drawingml/extra_color_scheme_list.rb +20 -0
- data/lib/uniword/drawingml/fill_overlay.rb +22 -0
- data/lib/uniword/drawingml/fill_to_rect.rb +28 -0
- data/lib/uniword/drawingml/font_reference.rb +23 -0
- data/lib/uniword/drawingml/font_scheme.rb +241 -0
- data/lib/uniword/drawingml/foreground_color.rb +24 -0
- data/lib/uniword/drawingml/format_scheme.rb +141 -0
- data/lib/uniword/drawingml/gamma.rb +18 -0
- data/lib/uniword/drawingml/geometry_guide.rb +24 -0
- data/lib/uniword/drawingml/glow.rb +26 -0
- data/lib/uniword/drawingml/gradient_fill.rb +29 -0
- data/lib/uniword/drawingml/gradient_stop.rb +26 -0
- data/lib/uniword/drawingml/gradient_stop_list.rb +23 -0
- data/lib/uniword/drawingml/graphic.rb +21 -0
- data/lib/uniword/drawingml/graphic_data.rb +27 -0
- data/lib/uniword/drawingml/grayscale.rb +18 -0
- data/lib/uniword/drawingml/green.rb +22 -0
- data/lib/uniword/drawingml/group_locking.rb +35 -0
- data/lib/uniword/drawingml/group_shape_properties.rb +21 -0
- data/lib/uniword/drawingml/gvml.rb +26 -0
- data/lib/uniword/drawingml/gvml_connector.rb +25 -0
- data/lib/uniword/drawingml/gvml_connector_non_visual.rb +23 -0
- data/lib/uniword/drawingml/gvml_graphic_frame_non_visual.rb +23 -0
- data/lib/uniword/drawingml/gvml_graphical_object_frame.rb +25 -0
- data/lib/uniword/drawingml/gvml_group_shape.rb +36 -0
- data/lib/uniword/drawingml/gvml_group_shape_non_visual.rb +23 -0
- data/lib/uniword/drawingml/gvml_picture.rb +27 -0
- data/lib/uniword/drawingml/gvml_picture_non_visual.rb +23 -0
- data/lib/uniword/drawingml/gvml_shape.rb +27 -0
- data/lib/uniword/drawingml/gvml_shape_non_visual.rb +23 -0
- data/lib/uniword/drawingml/gvml_text_shape.rb +25 -0
- data/lib/uniword/drawingml/gvml_use_shape_rectangle.rb +17 -0
- data/lib/uniword/drawingml/hue.rb +22 -0
- data/lib/uniword/drawingml/hue_modulation.rb +22 -0
- data/lib/uniword/drawingml/hue_offset.rb +22 -0
- data/lib/uniword/drawingml/inner_shadow.rb +30 -0
- data/lib/uniword/drawingml/inverse_gamma.rb +18 -0
- data/lib/uniword/drawingml/level1_paragraph_properties.rb +24 -0
- data/lib/uniword/drawingml/level2_paragraph_properties.rb +24 -0
- data/lib/uniword/drawingml/level3_paragraph_properties.rb +24 -0
- data/lib/uniword/drawingml/light_rig.rb +26 -0
- data/lib/uniword/drawingml/line_defaults.rb +27 -0
- data/lib/uniword/drawingml/line_join_miter.rb +22 -0
- data/lib/uniword/drawingml/line_join_round.rb +18 -0
- data/lib/uniword/drawingml/line_properties.rb +36 -0
- data/lib/uniword/drawingml/line_to.rb +22 -0
- data/lib/uniword/drawingml/linear_gradient.rb +24 -0
- data/lib/uniword/drawingml/list_style.rb +28 -0
- data/lib/uniword/drawingml/luminance.rb +22 -0
- data/lib/uniword/drawingml/luminance_modulation.rb +22 -0
- data/lib/uniword/drawingml/luminance_offset.rb +22 -0
- data/lib/uniword/drawingml/move_to.rb +22 -0
- data/lib/uniword/drawingml/no_fill.rb +18 -0
- data/lib/uniword/drawingml/non_visual_connector_properties.rb +21 -0
- data/lib/uniword/drawingml/non_visual_drawing_properties.rb +24 -0
- data/lib/uniword/drawingml/non_visual_graphic_frame_properties.rb +21 -0
- data/lib/uniword/drawingml/non_visual_group_drawing_shape_properties.rb +21 -0
- data/lib/uniword/drawingml/non_visual_picture_properties.rb +25 -0
- data/lib/uniword/drawingml/non_visual_shape_properties.rb +22 -0
- data/lib/uniword/drawingml/object_defaults.rb +23 -0
- data/lib/uniword/drawingml/office_art_extension.rb +21 -0
- data/lib/uniword/drawingml/office_art_extension_list.rb +21 -0
- data/lib/uniword/drawingml/offset.rb +24 -0
- data/lib/uniword/drawingml/outer_shadow.rb +38 -0
- data/lib/uniword/drawingml/path_gradient.rb +24 -0
- data/lib/uniword/drawingml/path_list.rb +22 -0
- data/lib/uniword/drawingml/pattern_fill.rb +26 -0
- data/lib/uniword/drawingml/picture_locking.rb +35 -0
- data/lib/uniword/drawingml/preset_dash.rb +22 -0
- data/lib/uniword/drawingml/preset_geometry.rb +24 -0
- data/lib/uniword/drawingml/preset_shadow.rb +26 -0
- data/lib/uniword/drawingml/red.rb +22 -0
- data/lib/uniword/drawingml/red_modulation.rb +22 -0
- data/lib/uniword/drawingml/red_offset.rb +22 -0
- data/lib/uniword/drawingml/reflection.rb +36 -0
- data/lib/uniword/drawingml/relative_rect.rb +27 -0
- data/lib/uniword/drawingml/rotation.rb +26 -0
- data/lib/uniword/drawingml/saturation.rb +22 -0
- data/lib/uniword/drawingml/saturation_modulation.rb +22 -0
- data/lib/uniword/drawingml/saturation_offset.rb +22 -0
- data/lib/uniword/drawingml/scene_3d.rb +24 -0
- data/lib/uniword/drawingml/scheme_color.rb +43 -0
- data/lib/uniword/drawingml/shade.rb +22 -0
- data/lib/uniword/drawingml/shape.rb +24 -0
- data/lib/uniword/drawingml/shape_3d.rb +28 -0
- data/lib/uniword/drawingml/shape_defaults.rb +27 -0
- data/lib/uniword/drawingml/shape_properties.rb +24 -0
- data/lib/uniword/drawingml/shape_style.rb +27 -0
- data/lib/uniword/drawingml/soft_edge.rb +22 -0
- data/lib/uniword/drawingml/solid_fill.rb +24 -0
- data/lib/uniword/drawingml/source_rect.rb +28 -0
- data/lib/uniword/drawingml/srgb_color.rb +43 -0
- data/lib/uniword/drawingml/stretch.rb +18 -0
- data/lib/uniword/drawingml/style_matrix.rb +27 -0
- data/lib/uniword/drawingml/style_matrix_reference.rb +25 -0
- data/lib/uniword/drawingml/style_reference.rb +23 -0
- data/lib/uniword/drawingml/text_body.rb +25 -0
- data/lib/uniword/drawingml/text_character_properties.rb +33 -0
- data/lib/uniword/drawingml/text_defaults.rb +27 -0
- data/lib/uniword/drawingml/text_font.rb +24 -0
- data/lib/uniword/drawingml/text_paragraph.rb +23 -0
- data/lib/uniword/drawingml/text_paragraph_properties.rb +26 -0
- data/lib/uniword/drawingml/text_run.rb +23 -0
- data/lib/uniword/drawingml/theme.rb +263 -0
- data/lib/uniword/drawingml/tile.rb +32 -0
- data/lib/uniword/drawingml/tile_rect.rb +28 -0
- data/lib/uniword/drawingml/tint.rb +22 -0
- data/lib/uniword/drawingml/transform2_d.rb +24 -0
- data/lib/uniword/drawingml.rb +190 -0
- data/lib/uniword/element.rb +52 -0
- data/lib/uniword/element_registry.rb +111 -0
- data/lib/uniword/endnote.rb +66 -0
- data/lib/uniword/errors.rb +140 -0
- data/lib/uniword/field.rb +76 -0
- data/lib/uniword/footer.rb +41 -0
- data/lib/uniword/footnote.rb +65 -0
- data/lib/uniword/format_converter.rb +350 -0
- data/lib/uniword/format_detector.rb +142 -0
- data/lib/uniword/glossary/auto_text.rb +24 -0
- data/lib/uniword/glossary/category_name.rb +22 -0
- data/lib/uniword/glossary/doc_part.rb +25 -0
- data/lib/uniword/glossary/doc_part_behavior.rb +22 -0
- data/lib/uniword/glossary/doc_part_behaviors.rb +23 -0
- data/lib/uniword/glossary/doc_part_body.rb +30 -0
- data/lib/uniword/glossary/doc_part_category.rb +25 -0
- data/lib/uniword/glossary/doc_part_description.rb +22 -0
- data/lib/uniword/glossary/doc_part_gallery.rb +22 -0
- data/lib/uniword/glossary/doc_part_id.rb +22 -0
- data/lib/uniword/glossary/doc_part_name.rb +22 -0
- data/lib/uniword/glossary/doc_part_properties.rb +35 -0
- data/lib/uniword/glossary/doc_part_type.rb +22 -0
- data/lib/uniword/glossary/doc_part_types.rb +25 -0
- data/lib/uniword/glossary/doc_parts.rb +22 -0
- data/lib/uniword/glossary/equation.rb +24 -0
- data/lib/uniword/glossary/glossary_document.rb +32 -0
- data/lib/uniword/glossary/style_id.rb +22 -0
- data/lib/uniword/glossary/text_box.rb +24 -0
- data/lib/uniword/glossary.rb +33 -0
- data/lib/uniword/header.rb +41 -0
- data/lib/uniword/html_importer.rb +55 -0
- data/lib/uniword/hyperlink.rb +76 -0
- data/lib/uniword/image.rb +244 -0
- data/lib/uniword/infrastructure/mime_packager.rb +155 -0
- data/lib/uniword/infrastructure/mime_parser.rb +195 -0
- data/lib/uniword/infrastructure/xml_namespace_normalizer.rb +105 -0
- data/lib/uniword/infrastructure/zip_extractor.rb +133 -0
- data/lib/uniword/infrastructure/zip_packager.rb +249 -0
- data/lib/uniword/infrastructure.rb +10 -0
- data/lib/uniword/lazy_loader.rb +118 -0
- data/lib/uniword/line_numbering.rb +129 -0
- data/lib/uniword/loggable.rb +57 -0
- data/lib/uniword/logger.rb +75 -0
- data/lib/uniword/math/accent.rb +25 -0
- data/lib/uniword/math/accent_properties.rb +25 -0
- data/lib/uniword/math/argument_properties.rb +22 -0
- data/lib/uniword/math/bar.rb +25 -0
- data/lib/uniword/math/bar_properties.rb +25 -0
- data/lib/uniword/math/begin_char.rb +22 -0
- data/lib/uniword/math/border_box.rb +25 -0
- data/lib/uniword/math/border_box_properties.rb +39 -0
- data/lib/uniword/math/box.rb +25 -0
- data/lib/uniword/math/box_properties.rb +33 -0
- data/lib/uniword/math/char.rb +22 -0
- data/lib/uniword/math/control_properties.rb +27 -0
- data/lib/uniword/math/degree.rb +26 -0
- data/lib/uniword/math/delimiter.rb +25 -0
- data/lib/uniword/math/delimiter_properties.rb +33 -0
- data/lib/uniword/math/denominator.rb +26 -0
- data/lib/uniword/math/element.rb +56 -0
- data/lib/uniword/math/end_char.rb +22 -0
- data/lib/uniword/math/equation_array.rb +25 -0
- data/lib/uniword/math/equation_array_properties.rb +33 -0
- data/lib/uniword/math/fraction.rb +27 -0
- data/lib/uniword/math/fraction_properties.rb +25 -0
- data/lib/uniword/math/function.rb +27 -0
- data/lib/uniword/math/function_name.rb +26 -0
- data/lib/uniword/math/function_properties.rb +23 -0
- data/lib/uniword/math/group_char.rb +25 -0
- data/lib/uniword/math/group_char_properties.rb +29 -0
- data/lib/uniword/math/lim.rb +26 -0
- data/lib/uniword/math/lower_limit.rb +27 -0
- data/lib/uniword/math/lower_limit_properties.rb +23 -0
- data/lib/uniword/math/math_break.rb +22 -0
- data/lib/uniword/math/math_font.rb +22 -0
- data/lib/uniword/math/math_properties.rb +53 -0
- data/lib/uniword/math/math_run.rb +42 -0
- data/lib/uniword/math/math_run_properties.rb +37 -0
- data/lib/uniword/math/math_simple_int_val.rb +24 -0
- data/lib/uniword/math/math_simple_val.rb +24 -0
- data/lib/uniword/math/math_style.rb +22 -0
- data/lib/uniword/math/math_text.rb +23 -0
- data/lib/uniword/math/matrix.rb +25 -0
- data/lib/uniword/math/matrix_column.rb +23 -0
- data/lib/uniword/math/matrix_column_properties.rb +24 -0
- data/lib/uniword/math/matrix_columns.rb +23 -0
- data/lib/uniword/math/matrix_properties.rb +37 -0
- data/lib/uniword/math/matrix_row.rb +23 -0
- data/lib/uniword/math/nary.rb +29 -0
- data/lib/uniword/math/nary_properties.rb +33 -0
- data/lib/uniword/math/numerator.rb +26 -0
- data/lib/uniword/math/o_math.rb +54 -0
- data/lib/uniword/math/o_math_para.rb +25 -0
- data/lib/uniword/math/o_math_para_properties.rb +22 -0
- data/lib/uniword/math/phantom.rb +25 -0
- data/lib/uniword/math/phantom_properties.rb +33 -0
- data/lib/uniword/math/plurimath_adapter.rb +289 -0
- data/lib/uniword/math/pre_sub_superscript.rb +29 -0
- data/lib/uniword/math/pre_sub_superscript_properties.rb +23 -0
- data/lib/uniword/math/radical.rb +27 -0
- data/lib/uniword/math/radical_properties.rb +25 -0
- data/lib/uniword/math/separator_char.rb +22 -0
- data/lib/uniword/math/sub.rb +26 -0
- data/lib/uniword/math/sub_superscript.rb +29 -0
- data/lib/uniword/math/sub_superscript_properties.rb +25 -0
- data/lib/uniword/math/subscript.rb +27 -0
- data/lib/uniword/math/subscript_properties.rb +23 -0
- data/lib/uniword/math/sup.rb +26 -0
- data/lib/uniword/math/superscript.rb +27 -0
- data/lib/uniword/math/superscript_properties.rb +23 -0
- data/lib/uniword/math/upper_limit.rb +27 -0
- data/lib/uniword/math/upper_limit_properties.rb +23 -0
- data/lib/uniword/math.rb +90 -0
- data/lib/uniword/math_equation.rb +158 -0
- data/lib/uniword/metadata/metadata.rb +345 -0
- data/lib/uniword/metadata/metadata_extractor.rb +403 -0
- data/lib/uniword/metadata/metadata_index.rb +455 -0
- data/lib/uniword/metadata/metadata_manager.rb +334 -0
- data/lib/uniword/metadata/metadata_updater.rb +243 -0
- data/lib/uniword/metadata/metadata_validator.rb +326 -0
- data/lib/uniword/metadata.rb +12 -0
- data/lib/uniword/mhtml/css_number_formatter.rb +127 -0
- data/lib/uniword/mhtml/document.rb +160 -0
- data/lib/uniword/mhtml/header_footer_part.rb +12 -0
- data/lib/uniword/mhtml/html_part.rb +108 -0
- data/lib/uniword/mhtml/image_part.rb +29 -0
- data/lib/uniword/mhtml/math_converter.rb +153 -0
- data/lib/uniword/mhtml/metadata/document_properties.rb +65 -0
- data/lib/uniword/mhtml/metadata/latent_styles.rb +33 -0
- data/lib/uniword/mhtml/metadata/office_document_settings.rb +22 -0
- data/lib/uniword/mhtml/metadata/word_document_settings.rb +47 -0
- data/lib/uniword/mhtml/metadata.rb +12 -0
- data/lib/uniword/mhtml/mhtml_package.rb +67 -0
- data/lib/uniword/mhtml/mime_part.rb +68 -0
- data/lib/uniword/mhtml/namespaces.rb +31 -0
- data/lib/uniword/mhtml/numbering_configuration.rb +49 -0
- data/lib/uniword/mhtml/styles_configuration.rb +57 -0
- data/lib/uniword/mhtml/theme.rb +50 -0
- data/lib/uniword/mhtml/theme_part.rb +19 -0
- data/lib/uniword/mhtml/word_css.rb +220 -0
- data/lib/uniword/mhtml/wordstyle.css +998 -0
- data/lib/uniword/mhtml/xml_part.rb +18 -0
- data/lib/uniword/mhtml.rb +31 -0
- data/lib/uniword/office/bottom.rb +22 -0
- data/lib/uniword/office/brightness.rb +22 -0
- data/lib/uniword/office/button.rb +26 -0
- data/lib/uniword/office/callout.rb +36 -0
- data/lib/uniword/office/callout_anchor.rb +22 -0
- data/lib/uniword/office/checkbox.rb +24 -0
- data/lib/uniword/office/color_menu.rb +24 -0
- data/lib/uniword/office/color_mru.rb +24 -0
- data/lib/uniword/office/complex.rb +22 -0
- data/lib/uniword/office/diagram.rb +36 -0
- data/lib/uniword/office/diffusity.rb +22 -0
- data/lib/uniword/office/document_protection.rb +26 -0
- data/lib/uniword/office/document_view.rb +22 -0
- data/lib/uniword/office/edge.rb +24 -0
- data/lib/uniword/office/extrusion.rb +54 -0
- data/lib/uniword/office/extrusion_color.rb +24 -0
- data/lib/uniword/office/extrusion_color_mode.rb +22 -0
- data/lib/uniword/office/extrusion_ok.rb +22 -0
- data/lib/uniword/office/field.rb +24 -0
- data/lib/uniword/office/forms.rb +22 -0
- data/lib/uniword/office/id_map.rb +24 -0
- data/lib/uniword/office/ink.rb +24 -0
- data/lib/uniword/office/ink_annotation.rb +24 -0
- data/lib/uniword/office/left.rb +22 -0
- data/lib/uniword/office/lock.rb +30 -0
- data/lib/uniword/office/metal.rb +22 -0
- data/lib/uniword/office/proof_state.rb +24 -0
- data/lib/uniword/office/regroup.rb +22 -0
- data/lib/uniword/office/regroup_table.rb +22 -0
- data/lib/uniword/office/relation_table.rb +22 -0
- data/lib/uniword/office/right.rb +22 -0
- data/lib/uniword/office/rules.rb +22 -0
- data/lib/uniword/office/shape_defaults.rb +29 -0
- data/lib/uniword/office/shape_layout.rb +25 -0
- data/lib/uniword/office/signature_line.rb +40 -0
- data/lib/uniword/office/skew.rb +28 -0
- data/lib/uniword/office/specularity.rb +22 -0
- data/lib/uniword/office/top.rb +22 -0
- data/lib/uniword/office/writing_style.rb +28 -0
- data/lib/uniword/office/zoom.rb +22 -0
- data/lib/uniword/office.rb +57 -0
- data/lib/uniword/ooxml/additional_characteristics.rb +43 -0
- data/lib/uniword/ooxml/app_properties.rb +130 -0
- data/lib/uniword/ooxml/core_properties.rb +69 -0
- data/lib/uniword/ooxml/custom_properties.rb +132 -0
- data/lib/uniword/ooxml/docx_package.rb +989 -0
- data/lib/uniword/ooxml/dotx_package.rb +247 -0
- data/lib/uniword/ooxml/namespaces.rb +363 -0
- data/lib/uniword/ooxml/package_file.rb +227 -0
- data/lib/uniword/ooxml/relationships/hyperlink_relationship.rb +24 -0
- data/lib/uniword/ooxml/relationships/image_relationship.rb +22 -0
- data/lib/uniword/ooxml/relationships/office_document_relationship.rb +24 -0
- data/lib/uniword/ooxml/relationships/package_relationship.rb +29 -0
- data/lib/uniword/ooxml/relationships/package_relationships.rb +51 -0
- data/lib/uniword/ooxml/relationships/relationship.rb +30 -0
- data/lib/uniword/ooxml/relationships/relationships.rb +43 -0
- data/lib/uniword/ooxml/relationships.rb +24 -0
- data/lib/uniword/ooxml/schema/attribute_definition.rb +159 -0
- data/lib/uniword/ooxml/schema/child_definition.rb +125 -0
- data/lib/uniword/ooxml/schema/element_definition.rb +155 -0
- data/lib/uniword/ooxml/schema/element_serializer.rb +319 -0
- data/lib/uniword/ooxml/schema/ooxml_schema.rb +226 -0
- data/lib/uniword/ooxml/schema.rb +16 -0
- data/lib/uniword/ooxml/schema_library.rb +38 -0
- data/lib/uniword/ooxml/styleset_package.rb +122 -0
- data/lib/uniword/ooxml/theme_package.rb +222 -0
- data/lib/uniword/ooxml/thmx_package.rb +127 -0
- data/lib/uniword/ooxml/types/cp_description_type.rb +17 -0
- data/lib/uniword/ooxml/types/cp_keywords_type.rb +17 -0
- data/lib/uniword/ooxml/types/cp_last_modified_by_type.rb +17 -0
- data/lib/uniword/ooxml/types/cp_revision_type.rb +17 -0
- data/lib/uniword/ooxml/types/dc_creator_type.rb +17 -0
- data/lib/uniword/ooxml/types/dc_subject_type.rb +17 -0
- data/lib/uniword/ooxml/types/dc_title_type.rb +17 -0
- data/lib/uniword/ooxml/types/dcterms_created_type.rb +24 -0
- data/lib/uniword/ooxml/types/dcterms_modified_type.rb +24 -0
- data/lib/uniword/ooxml/types/dcterms_w3cdtf_type.rb +49 -0
- data/lib/uniword/ooxml/types/mc_ignorable_type.rb +18 -0
- data/lib/uniword/ooxml/types/on_off_type.rb +64 -0
- data/lib/uniword/ooxml/types/ooxml_boolean.rb +49 -0
- data/lib/uniword/ooxml/types/ooxml_boolean_optional.rb +57 -0
- data/lib/uniword/ooxml/types/variant_types.rb +308 -0
- data/lib/uniword/ooxml/types.rb +76 -0
- data/lib/uniword/ooxml.rb +40 -0
- data/lib/uniword/page_borders.rb +117 -0
- data/lib/uniword/paragraph_border.rb +113 -0
- data/lib/uniword/picture/fill_rect.rb +28 -0
- data/lib/uniword/picture/non_visual_picture_drawing_properties.rb +25 -0
- data/lib/uniword/picture/non_visual_picture_properties.rb +25 -0
- data/lib/uniword/picture/picture.rb +27 -0
- data/lib/uniword/picture/picture_blip_fill.rb +27 -0
- data/lib/uniword/picture/picture_locks.rb +24 -0
- data/lib/uniword/picture/picture_shape_properties.rb +27 -0
- data/lib/uniword/picture/picture_source_rect.rb +28 -0
- data/lib/uniword/picture/picture_stretch.rb +23 -0
- data/lib/uniword/picture/tile.rb +30 -0
- data/lib/uniword/picture.rb +25 -0
- data/lib/uniword/presentationml/audio.rb +26 -0
- data/lib/uniword/presentationml/body_properties.rb +30 -0
- data/lib/uniword/presentationml/break.rb +22 -0
- data/lib/uniword/presentationml/color_map.rb +28 -0
- data/lib/uniword/presentationml/common_slide_data.rb +27 -0
- data/lib/uniword/presentationml/common_time_node.rb +33 -0
- data/lib/uniword/presentationml/connection_shape.rb +25 -0
- data/lib/uniword/presentationml/embed.rb +22 -0
- data/lib/uniword/presentationml/embedded_font.rb +24 -0
- data/lib/uniword/presentationml/end_conditions_list.rb +23 -0
- data/lib/uniword/presentationml/end_paragraph_run_properties.rb +26 -0
- data/lib/uniword/presentationml/extension.rb +22 -0
- data/lib/uniword/presentationml/extension_list.rb +23 -0
- data/lib/uniword/presentationml/field.rb +31 -0
- data/lib/uniword/presentationml/graphic_frame.rb +27 -0
- data/lib/uniword/presentationml/group_shape.rb +29 -0
- data/lib/uniword/presentationml/handout_master.rb +25 -0
- data/lib/uniword/presentationml/handout_master_id_list.rb +22 -0
- data/lib/uniword/presentationml/list_style.rb +29 -0
- data/lib/uniword/presentationml/non_visual_shape_properties.rb +27 -0
- data/lib/uniword/presentationml/notes.rb +27 -0
- data/lib/uniword/presentationml/notes_master_id_list.rb +22 -0
- data/lib/uniword/presentationml/notes_size.rb +24 -0
- data/lib/uniword/presentationml/ole_object.rb +26 -0
- data/lib/uniword/presentationml/paragraph.rb +31 -0
- data/lib/uniword/presentationml/paragraph_properties.rb +30 -0
- data/lib/uniword/presentationml/parallel_time_node.rb +23 -0
- data/lib/uniword/presentationml/picture.rb +27 -0
- data/lib/uniword/presentationml/presentation.rb +39 -0
- data/lib/uniword/presentationml/run.rb +25 -0
- data/lib/uniword/presentationml/run_properties.rb +34 -0
- data/lib/uniword/presentationml/sequence_time_node.rb +27 -0
- data/lib/uniword/presentationml/shape.rb +27 -0
- data/lib/uniword/presentationml/shape_properties.rb +31 -0
- data/lib/uniword/presentationml/shape_tree.rb +35 -0
- data/lib/uniword/presentationml/slide.rb +33 -0
- data/lib/uniword/presentationml/slide_id.rb +24 -0
- data/lib/uniword/presentationml/slide_id_list.rb +23 -0
- data/lib/uniword/presentationml/slide_layout.rb +33 -0
- data/lib/uniword/presentationml/slide_master.rb +33 -0
- data/lib/uniword/presentationml/slide_master_id.rb +24 -0
- data/lib/uniword/presentationml/slide_master_id_list.rb +23 -0
- data/lib/uniword/presentationml/slide_size.rb +26 -0
- data/lib/uniword/presentationml/start_conditions_list.rb +23 -0
- data/lib/uniword/presentationml/text_body.rb +27 -0
- data/lib/uniword/presentationml/time_node_list.rb +25 -0
- data/lib/uniword/presentationml/timing.rb +25 -0
- data/lib/uniword/presentationml/transition.rb +33 -0
- data/lib/uniword/presentationml/video.rb +24 -0
- data/lib/uniword/presentationml.rb +67 -0
- data/lib/uniword/properties/alignment.rb +26 -0
- data/lib/uniword/properties/bold.rb +40 -0
- data/lib/uniword/properties/boolean_formatting.rb +214 -0
- data/lib/uniword/properties/border.rb +48 -0
- data/lib/uniword/properties/borders.rb +39 -0
- data/lib/uniword/properties/cell_vertical_align.rb +32 -0
- data/lib/uniword/properties/cell_width.rb +28 -0
- data/lib/uniword/properties/character_spacing.rb +34 -0
- data/lib/uniword/properties/color_value.rb +57 -0
- data/lib/uniword/properties/contextual_spacing.rb +32 -0
- data/lib/uniword/properties/emphasis_mark.rb +35 -0
- data/lib/uniword/properties/font_size.rb +26 -0
- data/lib/uniword/properties/highlight.rb +28 -0
- data/lib/uniword/properties/indentation.rb +28 -0
- data/lib/uniword/properties/italic.rb +40 -0
- data/lib/uniword/properties/kerning.rb +34 -0
- data/lib/uniword/properties/language.rb +39 -0
- data/lib/uniword/properties/margin.rb +22 -0
- data/lib/uniword/properties/numbering_id.rb +26 -0
- data/lib/uniword/properties/numbering_level.rb +26 -0
- data/lib/uniword/properties/numbering_properties.rb +25 -0
- data/lib/uniword/properties/outline.rb +33 -0
- data/lib/uniword/properties/outline_level.rb +26 -0
- data/lib/uniword/properties/position.rb +33 -0
- data/lib/uniword/properties/run_fonts.rb +38 -0
- data/lib/uniword/properties/shading.rb +41 -0
- data/lib/uniword/properties/spacing.rb +28 -0
- data/lib/uniword/properties/style_reference.rb +81 -0
- data/lib/uniword/properties/tab_stop.rb +45 -0
- data/lib/uniword/properties/table_cell_margin.rb +33 -0
- data/lib/uniword/properties/table_indent.rb +23 -0
- data/lib/uniword/properties/table_justification.rb +22 -0
- data/lib/uniword/properties/table_look.rb +36 -0
- data/lib/uniword/properties/table_width.rb +28 -0
- data/lib/uniword/properties/tabs.rb +64 -0
- data/lib/uniword/properties/text_fill.rb +38 -0
- data/lib/uniword/properties/text_outline.rb +34 -0
- data/lib/uniword/properties/underline.rb +32 -0
- data/lib/uniword/properties/vertical_align.rb +26 -0
- data/lib/uniword/properties/width_scale.rb +34 -0
- data/lib/uniword/properties.rb +71 -0
- data/lib/uniword/quality/document_checker.rb +150 -0
- data/lib/uniword/quality/quality_report.rb +317 -0
- data/lib/uniword/quality/quality_rule.rb +153 -0
- data/lib/uniword/quality/rules/heading_hierarchy_rule.rb +83 -0
- data/lib/uniword/quality/rules/image_alt_text_rule.rb +87 -0
- data/lib/uniword/quality/rules/link_validation_rule.rb +136 -0
- data/lib/uniword/quality/rules/paragraph_length_rule.rb +77 -0
- data/lib/uniword/quality/rules/style_consistency_rule.rb +116 -0
- data/lib/uniword/quality/rules/table_header_rule.rb +69 -0
- data/lib/uniword/quality.rb +16 -0
- data/lib/uniword/resource/cache.rb +82 -0
- data/lib/uniword/resource/cache_paths.rb +29 -0
- data/lib/uniword/resource/cache_version.rb +49 -0
- data/lib/uniword/resource/color_transformer.rb +134 -0
- data/lib/uniword/resource/font_substitutor.rb +60 -0
- data/lib/uniword/resource/importer.rb +114 -0
- data/lib/uniword/resource/resource_location.rb +35 -0
- data/lib/uniword/resource/resource_resolver.rb +100 -0
- data/lib/uniword/resource/theme_processor.rb +107 -0
- data/lib/uniword/resource.rb +19 -0
- data/lib/uniword/revision.rb +200 -0
- data/lib/uniword/schema/model_generator.rb +182 -0
- data/lib/uniword/schema/schema_loader.rb +90 -0
- data/lib/uniword/schema.rb +8 -0
- data/lib/uniword/section.rb +183 -0
- data/lib/uniword/section_properties.rb +180 -0
- data/lib/uniword/serialization/ooxml_serializer.rb +30 -0
- data/lib/uniword/shading.rb +109 -0
- data/lib/uniword/shared_types/angle.rb +22 -0
- data/lib/uniword/shared_types/boolean_value.rb +24 -0
- data/lib/uniword/shared_types/decimal_number.rb +22 -0
- data/lib/uniword/shared_types/emu_measure.rb +22 -0
- data/lib/uniword/shared_types/fixed_percentage.rb +22 -0
- data/lib/uniword/shared_types/hex_color.rb +22 -0
- data/lib/uniword/shared_types/on_off.rb +24 -0
- data/lib/uniword/shared_types/percent_value.rb +22 -0
- data/lib/uniword/shared_types/pixel_measure.rb +22 -0
- data/lib/uniword/shared_types/point_measure.rb +22 -0
- data/lib/uniword/shared_types/positive_percentage.rb +22 -0
- data/lib/uniword/shared_types/string_type.rb +22 -0
- data/lib/uniword/shared_types/text_alignment.rb +22 -0
- data/lib/uniword/shared_types/twips_measure.rb +22 -0
- data/lib/uniword/shared_types/vertical_alignment.rb +22 -0
- data/lib/uniword/shared_types.rb +31 -0
- data/lib/uniword/spreadsheetml/alignment.rb +32 -0
- data/lib/uniword/spreadsheetml/authors.rb +23 -0
- data/lib/uniword/spreadsheetml/auto_filter.rb +25 -0
- data/lib/uniword/spreadsheetml/bold.rb +22 -0
- data/lib/uniword/spreadsheetml/book_views.rb +23 -0
- data/lib/uniword/spreadsheetml/border.rb +31 -0
- data/lib/uniword/spreadsheetml/borders.rb +25 -0
- data/lib/uniword/spreadsheetml/calc_properties.rb +26 -0
- data/lib/uniword/spreadsheetml/cell.rb +31 -0
- data/lib/uniword/spreadsheetml/cell_format.rb +41 -0
- data/lib/uniword/spreadsheetml/cell_formats.rb +25 -0
- data/lib/uniword/spreadsheetml/cell_formula.rb +28 -0
- data/lib/uniword/spreadsheetml/cell_style.rb +31 -0
- data/lib/uniword/spreadsheetml/cell_style_xfs.rb +23 -0
- data/lib/uniword/spreadsheetml/cell_styles.rb +23 -0
- data/lib/uniword/spreadsheetml/cell_value.rb +22 -0
- data/lib/uniword/spreadsheetml/chartsheet.rb +25 -0
- data/lib/uniword/spreadsheetml/col.rb +32 -0
- data/lib/uniword/spreadsheetml/col_breaks.rb +25 -0
- data/lib/uniword/spreadsheetml/color.rb +28 -0
- data/lib/uniword/spreadsheetml/color_filter.rb +23 -0
- data/lib/uniword/spreadsheetml/colors.rb +21 -0
- data/lib/uniword/spreadsheetml/cols.rb +23 -0
- data/lib/uniword/spreadsheetml/comment.rb +27 -0
- data/lib/uniword/spreadsheetml/comment_list.rb +23 -0
- data/lib/uniword/spreadsheetml/comments.rb +25 -0
- data/lib/uniword/spreadsheetml/conditional_formatting.rb +25 -0
- data/lib/uniword/spreadsheetml/conditional_formatting_rule.rb +27 -0
- data/lib/uniword/spreadsheetml/custom_filter.rb +23 -0
- data/lib/uniword/spreadsheetml/custom_filters.rb +23 -0
- data/lib/uniword/spreadsheetml/custom_workbook_views.rb +23 -0
- data/lib/uniword/spreadsheetml/data_validation.rb +43 -0
- data/lib/uniword/spreadsheetml/data_validations.rb +25 -0
- data/lib/uniword/spreadsheetml/date_group_item.rb +33 -0
- data/lib/uniword/spreadsheetml/defined_name.rb +28 -0
- data/lib/uniword/spreadsheetml/defined_names.rb +23 -0
- data/lib/uniword/spreadsheetml/dimension.rb +22 -0
- data/lib/uniword/spreadsheetml/drawing.rb +22 -0
- data/lib/uniword/spreadsheetml/dynamic_filter.rb +25 -0
- data/lib/uniword/spreadsheetml/external_reference.rb +21 -0
- data/lib/uniword/spreadsheetml/external_references.rb +23 -0
- data/lib/uniword/spreadsheetml/file_sharing.rb +22 -0
- data/lib/uniword/spreadsheetml/file_version.rb +24 -0
- data/lib/uniword/spreadsheetml/fill.rb +23 -0
- data/lib/uniword/spreadsheetml/fills.rb +25 -0
- data/lib/uniword/spreadsheetml/filter.rb +21 -0
- data/lib/uniword/spreadsheetml/filter_column.rb +37 -0
- data/lib/uniword/spreadsheetml/filters.rb +27 -0
- data/lib/uniword/spreadsheetml/font.rb +31 -0
- data/lib/uniword/spreadsheetml/font_name.rb +22 -0
- data/lib/uniword/spreadsheetml/font_size.rb +22 -0
- data/lib/uniword/spreadsheetml/fonts.rb +25 -0
- data/lib/uniword/spreadsheetml/hyperlink.rb +30 -0
- data/lib/uniword/spreadsheetml/hyperlinks.rb +23 -0
- data/lib/uniword/spreadsheetml/icon_filter.rb +23 -0
- data/lib/uniword/spreadsheetml/italic.rb +22 -0
- data/lib/uniword/spreadsheetml/legacy_drawing.rb +22 -0
- data/lib/uniword/spreadsheetml/merge_cell.rb +22 -0
- data/lib/uniword/spreadsheetml/merge_cells.rb +25 -0
- data/lib/uniword/spreadsheetml/number_format.rb +24 -0
- data/lib/uniword/spreadsheetml/number_formats.rb +25 -0
- data/lib/uniword/spreadsheetml/ole_object.rb +24 -0
- data/lib/uniword/spreadsheetml/ole_objects.rb +23 -0
- data/lib/uniword/spreadsheetml/ole_size.rb +21 -0
- data/lib/uniword/spreadsheetml/pattern_fill.rb +27 -0
- data/lib/uniword/spreadsheetml/phonetic_pr.rb +35 -0
- data/lib/uniword/spreadsheetml/phonetic_properties.rb +24 -0
- data/lib/uniword/spreadsheetml/pivot_caches.rb +23 -0
- data/lib/uniword/spreadsheetml/pivot_table.rb +24 -0
- data/lib/uniword/spreadsheetml/pivot_table_definition.rb +26 -0
- data/lib/uniword/spreadsheetml/protected_ranges.rb +23 -0
- data/lib/uniword/spreadsheetml/query_table.rb +24 -0
- data/lib/uniword/spreadsheetml/rich_text_run.rb +25 -0
- data/lib/uniword/spreadsheetml/row.rb +33 -0
- data/lib/uniword/spreadsheetml/row_breaks.rb +25 -0
- data/lib/uniword/spreadsheetml/run_properties.rb +29 -0
- data/lib/uniword/spreadsheetml/scenarios.rb +27 -0
- data/lib/uniword/spreadsheetml/shared_string_table.rb +27 -0
- data/lib/uniword/spreadsheetml/sheet.rb +28 -0
- data/lib/uniword/spreadsheetml/sheet_data.rb +23 -0
- data/lib/uniword/spreadsheetml/sheet_format_pr.rb +33 -0
- data/lib/uniword/spreadsheetml/sheet_protection.rb +28 -0
- data/lib/uniword/spreadsheetml/sheet_view.rb +30 -0
- data/lib/uniword/spreadsheetml/sheet_views.rb +23 -0
- data/lib/uniword/spreadsheetml/sheets.rb +23 -0
- data/lib/uniword/spreadsheetml/sort_condition.rb +33 -0
- data/lib/uniword/spreadsheetml/sort_state.rb +23 -0
- data/lib/uniword/spreadsheetml/sparkline_group.rb +24 -0
- data/lib/uniword/spreadsheetml/sparkline_groups.rb +23 -0
- data/lib/uniword/spreadsheetml/string_item.rb +27 -0
- data/lib/uniword/spreadsheetml/table.rb +35 -0
- data/lib/uniword/spreadsheetml/table_column.rb +24 -0
- data/lib/uniword/spreadsheetml/table_columns.rb +25 -0
- data/lib/uniword/spreadsheetml/table_formula.rb +23 -0
- data/lib/uniword/spreadsheetml/table_parts.rb +23 -0
- data/lib/uniword/spreadsheetml/table_style_info.rb +30 -0
- data/lib/uniword/spreadsheetml/table_styles.rb +23 -0
- data/lib/uniword/spreadsheetml/text.rb +24 -0
- data/lib/uniword/spreadsheetml/top10.rb +27 -0
- data/lib/uniword/spreadsheetml/workbook.rb +31 -0
- data/lib/uniword/spreadsheetml/workbook_properties.rb +26 -0
- data/lib/uniword/spreadsheetml/workbook_protection.rb +24 -0
- data/lib/uniword/spreadsheetml/workbook_view.rb +26 -0
- data/lib/uniword/spreadsheetml/worksheet/sheet_format_pr.rb +35 -0
- data/lib/uniword/spreadsheetml/worksheet.rb +33 -0
- data/lib/uniword/spreadsheetml.rb +121 -0
- data/lib/uniword/streaming_parser.rb +277 -0
- data/lib/uniword/styles.rb +14 -0
- data/lib/uniword/styleset.rb +166 -0
- data/lib/uniword/stylesets/package.rb +107 -0
- data/lib/uniword/stylesets/styleset_importer.rb +96 -0
- data/lib/uniword/stylesets/yaml_styleset_loader.rb +58 -0
- data/lib/uniword/stylesets.rb +9 -0
- data/lib/uniword/tab_stop.rb +85 -0
- data/lib/uniword/table_border.rb +87 -0
- data/lib/uniword/template/helpers/conditional_helper.rb +107 -0
- data/lib/uniword/template/helpers/filter_helper.rb +124 -0
- data/lib/uniword/template/helpers/loop_helper.rb +119 -0
- data/lib/uniword/template/helpers/variable_helper.rb +85 -0
- data/lib/uniword/template/helpers.rb +12 -0
- data/lib/uniword/template/template.rb +147 -0
- data/lib/uniword/template/template_context.rb +103 -0
- data/lib/uniword/template/template_marker.rb +121 -0
- data/lib/uniword/template/template_parser.rb +186 -0
- data/lib/uniword/template/template_renderer.rb +204 -0
- data/lib/uniword/template/template_validator.rb +202 -0
- data/lib/uniword/template/variable_resolver.rb +195 -0
- data/lib/uniword/template.rb +14 -0
- data/lib/uniword/text_box.rb +55 -0
- data/lib/uniword/text_frame.rb +168 -0
- data/lib/uniword/theme/media_file.rb +128 -0
- data/lib/uniword/theme/theme_applicator.rb +141 -0
- data/lib/uniword/theme/theme_loader.rb +107 -0
- data/lib/uniword/theme/theme_package_reader.rb +102 -0
- data/lib/uniword/theme/theme_variant.rb +87 -0
- data/lib/uniword/theme/theme_xml_parser.rb +239 -0
- data/lib/uniword/theme_writer.rb +58 -0
- data/lib/uniword/themes/theme.rb +159 -0
- data/lib/uniword/themes/theme_importer.rb +138 -0
- data/lib/uniword/themes/theme_transformation.rb +202 -0
- data/lib/uniword/themes.rb +23 -0
- data/lib/uniword/tracked_changes.rb +231 -0
- data/lib/uniword/transformation/html_to_ooxml_converter.rb +541 -0
- data/lib/uniword/transformation/hyperlink_transformation_rule.rb +72 -0
- data/lib/uniword/transformation/image_transformation_rule.rb +69 -0
- data/lib/uniword/transformation/ooxml_to_html_converter.rb +172 -0
- data/lib/uniword/transformation/ooxml_to_mhtml_converter.rb +1406 -0
- data/lib/uniword/transformation/paragraph_transformation_rule.rb +166 -0
- data/lib/uniword/transformation/run_transformation_rule.rb +76 -0
- data/lib/uniword/transformation/table_transformation_rule.rb +120 -0
- data/lib/uniword/transformation/transformation_rule.rb +91 -0
- data/lib/uniword/transformation/transformation_rule_registry.rb +133 -0
- data/lib/uniword/transformation/transformer.rb +386 -0
- data/lib/uniword/transformation.rb +18 -0
- data/lib/uniword/validation/checkers/external_link_checker.rb +200 -0
- data/lib/uniword/validation/checkers/file_reference_checker.rb +196 -0
- data/lib/uniword/validation/checkers/footnote_reference_checker.rb +178 -0
- data/lib/uniword/validation/checkers/internal_link_checker.rb +181 -0
- data/lib/uniword/validation/checkers.rb +12 -0
- data/lib/uniword/validation/document_validator.rb +272 -0
- data/lib/uniword/validation/layer_validation_result.rb +157 -0
- data/lib/uniword/validation/layer_validator.rb +104 -0
- data/lib/uniword/validation/link_checker.rb +94 -0
- data/lib/uniword/validation/link_validator.rb +318 -0
- data/lib/uniword/validation/validation_report.rb +409 -0
- data/lib/uniword/validation/validation_result.rb +215 -0
- data/lib/uniword/validation/validators/content_type_validator.rb +159 -0
- data/lib/uniword/validation/validators/document_semantics_validator.rb +152 -0
- data/lib/uniword/validation/validators/file_structure_validator.rb +101 -0
- data/lib/uniword/validation/validators/ooxml_part_validator.rb +128 -0
- data/lib/uniword/validation/validators/relationship_validator.rb +146 -0
- data/lib/uniword/validation/validators/xml_schema_validator.rb +120 -0
- data/lib/uniword/validation/validators/zip_integrity_validator.rb +110 -0
- data/lib/uniword/validation/validators.rb +15 -0
- data/lib/uniword/validation.rb +15 -0
- data/lib/uniword/validators/element_validator.rb +97 -0
- data/lib/uniword/validators/paragraph_validator.rb +122 -0
- data/lib/uniword/validators/table_validator.rb +140 -0
- data/lib/uniword/validators.rb +9 -0
- data/lib/uniword/version.rb +5 -0
- data/lib/uniword/visitor/base_visitor.rb +81 -0
- data/lib/uniword/visitor/text_extractor.rb +119 -0
- data/lib/uniword/visitor.rb +8 -0
- data/lib/uniword/vml/arc.rb +41 -0
- data/lib/uniword/vml/background.rb +33 -0
- data/lib/uniword/vml/curve.rb +36 -0
- data/lib/uniword/vml/fill.rb +32 -0
- data/lib/uniword/vml/formula.rb +23 -0
- data/lib/uniword/vml/formulas.rb +24 -0
- data/lib/uniword/vml/group.rb +30 -0
- data/lib/uniword/vml/handle.rb +39 -0
- data/lib/uniword/vml/handles.rb +24 -0
- data/lib/uniword/vml/image.rb +47 -0
- data/lib/uniword/vml/imagedata.rb +34 -0
- data/lib/uniword/vml/line.rb +34 -0
- data/lib/uniword/vml/oval.rb +34 -0
- data/lib/uniword/vml/path.rb +28 -0
- data/lib/uniword/vml/polyline.rb +32 -0
- data/lib/uniword/vml/rect.rb +34 -0
- data/lib/uniword/vml/roundrect.rb +39 -0
- data/lib/uniword/vml/shadow.rb +33 -0
- data/lib/uniword/vml/shape.rb +73 -0
- data/lib/uniword/vml/shapetype.rb +32 -0
- data/lib/uniword/vml/stroke.rb +34 -0
- data/lib/uniword/vml/textbox.rb +28 -0
- data/lib/uniword/vml/textpath.rb +25 -0
- data/lib/uniword/vml/wrap.rb +24 -0
- data/lib/uniword/vml.rb +39 -0
- data/lib/uniword/vml_office/vml_anchor_lock.rb +22 -0
- data/lib/uniword/vml_office/vml_bottom.rb +24 -0
- data/lib/uniword/vml_office/vml_callout.rb +35 -0
- data/lib/uniword/vml_office/vml_clip_path.rb +24 -0
- data/lib/uniword/vml_office/vml_color_mru.rb +24 -0
- data/lib/uniword/vml_office/vml_column.rb +24 -0
- data/lib/uniword/vml_office/vml_complex.rb +22 -0
- data/lib/uniword/vml_office/vml_complex_extension.rb +24 -0
- data/lib/uniword/vml_office/vml_diagram.rb +32 -0
- data/lib/uniword/vml_office/vml_entry.rb +24 -0
- data/lib/uniword/vml_office/vml_extrusion.rb +43 -0
- data/lib/uniword/vml_office/vml_id_map.rb +24 -0
- data/lib/uniword/vml_office/vml_ink.rb +26 -0
- data/lib/uniword/vml_office/vml_left.rb +24 -0
- data/lib/uniword/vml_office/vml_lock.rb +37 -0
- data/lib/uniword/vml_office/vml_office_fill.rb +32 -0
- data/lib/uniword/vml_office/vml_proxy.rb +28 -0
- data/lib/uniword/vml_office/vml_regroup.rb +22 -0
- data/lib/uniword/vml_office/vml_relation_table.rb +24 -0
- data/lib/uniword/vml_office/vml_right.rb +24 -0
- data/lib/uniword/vml_office/vml_rule.rb +26 -0
- data/lib/uniword/vml_office/vml_rules.rb +24 -0
- data/lib/uniword/vml_office/vml_shape_defaults.rb +53 -0
- data/lib/uniword/vml_office/vml_shape_layout.rb +70 -0
- data/lib/uniword/vml_office/vml_signature_line.rb +38 -0
- data/lib/uniword/vml_office/vml_skew.rb +29 -0
- data/lib/uniword/vml_office/vml_top.rb +24 -0
- data/lib/uniword/vml_office/vml_wrap_block.rb +24 -0
- data/lib/uniword/vml_office/vml_wrap_coords.rb +22 -0
- data/lib/uniword/vml_office.rb +47 -0
- data/lib/uniword/vml_word/border_bottom.rb +29 -0
- data/lib/uniword/vml_word/border_left.rb +29 -0
- data/lib/uniword/vml_word/border_right.rb +29 -0
- data/lib/uniword/vml_word/border_top.rb +29 -0
- data/lib/uniword/vml_word.rb +17 -0
- data/lib/uniword/warnings/warning.rb +130 -0
- data/lib/uniword/warnings/warning_collector.rb +229 -0
- data/lib/uniword/warnings/warning_report.rb +159 -0
- data/lib/uniword/warnings.rb +9 -0
- data/lib/uniword/word2010_ext/wrap.rb +26 -0
- data/lib/uniword/word2010_ext.rb +14 -0
- data/lib/uniword/word_implementation.rb +58 -0
- data/lib/uniword/word_implementation_factory.rb +15 -0
- data/lib/uniword/word_implementation_linux.rb +42 -0
- data/lib/uniword/word_implementation_macos.rb +41 -0
- data/lib/uniword/word_implementation_null.rb +34 -0
- data/lib/uniword/word_implementation_windows.rb +75 -0
- data/lib/uniword/wordprocessing_group.rb +29 -0
- data/lib/uniword/wordprocessing_shape.rb +48 -0
- data/lib/uniword/wordprocessingml/abstract_num.rb +27 -0
- data/lib/uniword/wordprocessingml/abstract_num_id.rb +22 -0
- data/lib/uniword/wordprocessingml/alternate_content.rb +24 -0
- data/lib/uniword/wordprocessingml/anchor.rb +35 -0
- data/lib/uniword/wordprocessingml/based_on.rb +22 -0
- data/lib/uniword/wordprocessingml/body.rb +95 -0
- data/lib/uniword/wordprocessingml/bookmark_end.rb +22 -0
- data/lib/uniword/wordprocessingml/bookmark_start.rb +24 -0
- data/lib/uniword/wordprocessingml/border.rb +30 -0
- data/lib/uniword/wordprocessingml/break.rb +24 -0
- data/lib/uniword/wordprocessingml/carriage_return.rb +17 -0
- data/lib/uniword/wordprocessingml/character_style.rb +199 -0
- data/lib/uniword/wordprocessingml/choice.rb +24 -0
- data/lib/uniword/wordprocessingml/cnf_style.rb +52 -0
- data/lib/uniword/wordprocessingml/columns.rb +26 -0
- data/lib/uniword/wordprocessingml/comment_range_end.rb +22 -0
- data/lib/uniword/wordprocessingml/comment_range_start.rb +22 -0
- data/lib/uniword/wordprocessingml/comment_reference.rb +22 -0
- data/lib/uniword/wordprocessingml/compat.rb +35 -0
- data/lib/uniword/wordprocessingml/compat_setting.rb +26 -0
- data/lib/uniword/wordprocessingml/deleted_text.rb +29 -0
- data/lib/uniword/wordprocessingml/doc_defaults.rb +25 -0
- data/lib/uniword/wordprocessingml/doc_grid.rb +25 -0
- data/lib/uniword/wordprocessingml/doc_pr.rb +26 -0
- data/lib/uniword/wordprocessingml/document_root.rb +251 -0
- data/lib/uniword/wordprocessingml/drawing.rb +24 -0
- data/lib/uniword/wordprocessingml/emboss.rb +24 -0
- data/lib/uniword/wordprocessingml/endnote.rb +27 -0
- data/lib/uniword/wordprocessingml/endnote_ref.rb +20 -0
- data/lib/uniword/wordprocessingml/endnote_reference.rb +22 -0
- data/lib/uniword/wordprocessingml/endnotes.rb +23 -0
- data/lib/uniword/wordprocessingml/extent.rb +24 -0
- data/lib/uniword/wordprocessingml/fallback.rb +24 -0
- data/lib/uniword/wordprocessingml/field_char.rb +24 -0
- data/lib/uniword/wordprocessingml/font.rb +110 -0
- data/lib/uniword/wordprocessingml/font_table.rb +30 -0
- data/lib/uniword/wordprocessingml/fonts.rb +23 -0
- data/lib/uniword/wordprocessingml/footer.rb +25 -0
- data/lib/uniword/wordprocessingml/footer_reference.rb +27 -0
- data/lib/uniword/wordprocessingml/footnote.rb +27 -0
- data/lib/uniword/wordprocessingml/footnote_ref.rb +20 -0
- data/lib/uniword/wordprocessingml/footnote_reference.rb +22 -0
- data/lib/uniword/wordprocessingml/footnotes.rb +23 -0
- data/lib/uniword/wordprocessingml/graphic.rb +23 -0
- data/lib/uniword/wordprocessingml/graphic_data.rb +22 -0
- data/lib/uniword/wordprocessingml/grid_after.rb +17 -0
- data/lib/uniword/wordprocessingml/grid_before.rb +17 -0
- data/lib/uniword/wordprocessingml/grid_col.rb +22 -0
- data/lib/uniword/wordprocessingml/header.rb +25 -0
- data/lib/uniword/wordprocessingml/header_reference.rb +27 -0
- data/lib/uniword/wordprocessingml/hyperlink.rb +73 -0
- data/lib/uniword/wordprocessingml/imprint.rb +24 -0
- data/lib/uniword/wordprocessingml/inline.rb +27 -0
- data/lib/uniword/wordprocessingml/instr_text.rb +32 -0
- data/lib/uniword/wordprocessingml/last_rendered_page_break.rb +16 -0
- data/lib/uniword/wordprocessingml/latent_styles.rb +59 -0
- data/lib/uniword/wordprocessingml/level.rb +103 -0
- data/lib/uniword/wordprocessingml/link.rb +22 -0
- data/lib/uniword/wordprocessingml/lvl_jc.rb +22 -0
- data/lib/uniword/wordprocessingml/lvl_text.rb +22 -0
- data/lib/uniword/wordprocessingml/mc_requires.rb +11 -0
- data/lib/uniword/wordprocessingml/multi_level_type.rb +22 -0
- data/lib/uniword/wordprocessingml/next.rb +22 -0
- data/lib/uniword/wordprocessingml/no_break_hyphen.rb +17 -0
- data/lib/uniword/wordprocessingml/no_wrap.rb +16 -0
- data/lib/uniword/wordprocessingml/num.rb +25 -0
- data/lib/uniword/wordprocessingml/num_fmt.rb +22 -0
- data/lib/uniword/wordprocessingml/numbering.rb +25 -0
- data/lib/uniword/wordprocessingml/numbering_configuration.rb +173 -0
- data/lib/uniword/wordprocessingml/numbering_definition.rb +155 -0
- data/lib/uniword/wordprocessingml/numbering_elements.rb +78 -0
- data/lib/uniword/wordprocessingml/numbering_instance.rb +55 -0
- data/lib/uniword/wordprocessingml/numbering_level.rb +90 -0
- data/lib/uniword/wordprocessingml/object.rb +24 -0
- data/lib/uniword/wordprocessingml/outline.rb +24 -0
- data/lib/uniword/wordprocessingml/p_pr_default.rb +23 -0
- data/lib/uniword/wordprocessingml/page_margins.rb +34 -0
- data/lib/uniword/wordprocessingml/page_numbering.rb +24 -0
- data/lib/uniword/wordprocessingml/page_size.rb +26 -0
- data/lib/uniword/wordprocessingml/paragraph.rb +197 -0
- data/lib/uniword/wordprocessingml/paragraph_borders.rb +58 -0
- data/lib/uniword/wordprocessingml/paragraph_properties.rb +339 -0
- data/lib/uniword/wordprocessingml/paragraph_style.rb +163 -0
- data/lib/uniword/wordprocessingml/pict.rb +23 -0
- data/lib/uniword/wordprocessingml/picture.rb +27 -0
- data/lib/uniword/wordprocessingml/position_tab.rb +26 -0
- data/lib/uniword/wordprocessingml/proof_err.rb +20 -0
- data/lib/uniword/wordprocessingml/r_pr_default.rb +23 -0
- data/lib/uniword/wordprocessingml/recipient_data.rb +25 -0
- data/lib/uniword/wordprocessingml/recipients.rb +21 -0
- data/lib/uniword/wordprocessingml/run.rb +254 -0
- data/lib/uniword/wordprocessingml/run_properties.rb +701 -0
- data/lib/uniword/wordprocessingml/section_properties.rb +55 -0
- data/lib/uniword/wordprocessingml/semi_hidden.rb +27 -0
- data/lib/uniword/wordprocessingml/settings.rb +606 -0
- data/lib/uniword/wordprocessingml/shading.rb +30 -0
- data/lib/uniword/wordprocessingml/shadow.rb +24 -0
- data/lib/uniword/wordprocessingml/shape.rb +26 -0
- data/lib/uniword/wordprocessingml/simple_field.rb +27 -0
- data/lib/uniword/wordprocessingml/simple_pos.rb +24 -0
- data/lib/uniword/wordprocessingml/soft_hyphen.rb +17 -0
- data/lib/uniword/wordprocessingml/start.rb +22 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/alias.rb +21 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/appearance.rb +22 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/bibliography.rb +18 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/content.rb +32 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/data_binding.rb +27 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/date.rb +75 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/doc_part_obj.rb +57 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/end_properties.rb +24 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/id.rb +21 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/placeholder.rb +33 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/run_properties.rb +83 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/showing_placeholder_header.rb +18 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/tag.rb +21 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/temporary.rb +19 -0
- data/lib/uniword/wordprocessingml/structured_document_tag/text.rb +18 -0
- data/lib/uniword/wordprocessingml/structured_document_tag.rb +62 -0
- data/lib/uniword/wordprocessingml/structured_document_tag_properties.rb +53 -0
- data/lib/uniword/wordprocessingml/style.rb +383 -0
- data/lib/uniword/wordprocessingml/style_name.rb +45 -0
- data/lib/uniword/wordprocessingml/styles/character_style_definition.rb +45 -0
- data/lib/uniword/wordprocessingml/styles/list_style_definition.rb +74 -0
- data/lib/uniword/wordprocessingml/styles/paragraph_style_definition.rb +54 -0
- data/lib/uniword/wordprocessingml/styles/semantic_style.rb +58 -0
- data/lib/uniword/wordprocessingml/styles/style_definition.rb +61 -0
- data/lib/uniword/wordprocessingml/styles/style_library.rb +207 -0
- data/lib/uniword/wordprocessingml/styles/table_style_definition.rb +60 -0
- data/lib/uniword/wordprocessingml/styles.rb +13 -0
- data/lib/uniword/wordprocessingml/styles_configuration.rb +352 -0
- data/lib/uniword/wordprocessingml/symbol.rb +24 -0
- data/lib/uniword/wordprocessingml/tab.rb +23 -0
- data/lib/uniword/wordprocessingml/tab_stop.rb +58 -0
- data/lib/uniword/wordprocessingml/table.rb +72 -0
- data/lib/uniword/wordprocessingml/table_borders.rb +33 -0
- data/lib/uniword/wordprocessingml/table_cell.rb +80 -0
- data/lib/uniword/wordprocessingml/table_cell_borders.rb +29 -0
- data/lib/uniword/wordprocessingml/table_cell_margin.rb +29 -0
- data/lib/uniword/wordprocessingml/table_cell_properties.rb +60 -0
- data/lib/uniword/wordprocessingml/table_grid.rb +23 -0
- data/lib/uniword/wordprocessingml/table_properties.rb +352 -0
- data/lib/uniword/wordprocessingml/table_row.rb +79 -0
- data/lib/uniword/wordprocessingml/table_row_properties.rb +58 -0
- data/lib/uniword/wordprocessingml/table_style.rb +20 -0
- data/lib/uniword/wordprocessingml/text.rb +81 -0
- data/lib/uniword/wordprocessingml/text_box_content.rb +27 -0
- data/lib/uniword/wordprocessingml/text_direction.rb +19 -0
- data/lib/uniword/wordprocessingml/tr_height.rb +21 -0
- data/lib/uniword/wordprocessingml/ui_priority.rb +22 -0
- data/lib/uniword/wordprocessingml/val_int.rb +18 -0
- data/lib/uniword/wordprocessingml/w14_attributes.rb +47 -0
- data/lib/uniword/wordprocessingml/web_settings.rb +43 -0
- data/lib/uniword/wordprocessingml/width_after.rb +19 -0
- data/lib/uniword/wordprocessingml/width_before.rb +19 -0
- data/lib/uniword/wordprocessingml/zoom.rb +22 -0
- data/lib/uniword/wordprocessingml.rb +237 -0
- data/lib/uniword/wordprocessingml_2010/checkbox.rb +27 -0
- data/lib/uniword/wordprocessingml_2010/checked_state.rb +24 -0
- data/lib/uniword/wordprocessingml_2010/conditional_format_style.rb +30 -0
- data/lib/uniword/wordprocessingml_2010/conflict_deletion.rb +26 -0
- data/lib/uniword/wordprocessingml_2010/conflict_insertion.rb +26 -0
- data/lib/uniword/wordprocessingml_2010/conflict_mode.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/custom_xml_conflict_insertion.rb +24 -0
- data/lib/uniword/wordprocessingml_2010/doc_id.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/doc_part_gallery.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/doc_part_obj.rb +27 -0
- data/lib/uniword/wordprocessingml_2010/entity_picker.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/ligatures.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/number_form.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/para_id.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/props3d.rb +26 -0
- data/lib/uniword/wordprocessingml_2010/sdt_content.rb +23 -0
- data/lib/uniword/wordprocessingml_2010/sdt_properties.rb +27 -0
- data/lib/uniword/wordprocessingml_2010/structured_document_tag.rb +25 -0
- data/lib/uniword/wordprocessingml_2010/text_fill.rb +27 -0
- data/lib/uniword/wordprocessingml_2010/text_glow.rb +25 -0
- data/lib/uniword/wordprocessingml_2010/text_id.rb +22 -0
- data/lib/uniword/wordprocessingml_2010/text_outline.rb +28 -0
- data/lib/uniword/wordprocessingml_2010/text_reflection.rb +28 -0
- data/lib/uniword/wordprocessingml_2010/text_shadow.rb +28 -0
- data/lib/uniword/wordprocessingml_2010/unchecked_state.rb +24 -0
- data/lib/uniword/wordprocessingml_2010.rb +44 -0
- data/lib/uniword/wordprocessingml_2013/chart_props.rb +25 -0
- data/lib/uniword/wordprocessingml_2013/chart_tracking_ref_based.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/comment_author.rb +26 -0
- data/lib/uniword/wordprocessingml_2013/comment_collapsed.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/comment_done.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/comment_ex.rb +26 -0
- data/lib/uniword/wordprocessingml_2013/comments_ids.rb +23 -0
- data/lib/uniword/wordprocessingml_2013/doc_part_anchor.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/document_part.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/footnote_columns.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/people_group.rb +25 -0
- data/lib/uniword/wordprocessingml_2013/person.rb +26 -0
- data/lib/uniword/wordprocessingml_2013/presence_info.rb +24 -0
- data/lib/uniword/wordprocessingml_2013/repeating_section.rb +25 -0
- data/lib/uniword/wordprocessingml_2013/repeating_section_item.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/sdt_appearance.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/sdt_color.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/sdt_data_binding.rb +24 -0
- data/lib/uniword/wordprocessingml_2013/web_extension.rb +22 -0
- data/lib/uniword/wordprocessingml_2013/web_extension_linked.rb +22 -0
- data/lib/uniword/wordprocessingml_2013.rb +38 -0
- data/lib/uniword/wordprocessingml_2016/cell_rsid.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/chart_color_style.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/chart_style2016.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/comments_ext.rb +24 -0
- data/lib/uniword/wordprocessingml_2016/conflict_mode2016.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/content_id.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/data_binding2016.rb +26 -0
- data/lib/uniword/wordprocessingml_2016/extension.rb +25 -0
- data/lib/uniword/wordprocessingml_2016/extension_list.rb +23 -0
- data/lib/uniword/wordprocessingml_2016/persistent_document_id.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/row_rsid.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/sdt_appearance2016.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/separator_extension.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/table_rsid.rb +22 -0
- data/lib/uniword/wordprocessingml_2016/web_video_property.rb +24 -0
- data/lib/uniword/wordprocessingml_2016.rb +33 -0
- data/lib/uniword/wp_drawing/align.rb +22 -0
- data/lib/uniword/wp_drawing/allow_overlap.rb +22 -0
- data/lib/uniword/wp_drawing/anchor.rb +80 -0
- data/lib/uniword/wp_drawing/behind_doc.rb +22 -0
- data/lib/uniword/wp_drawing/c_nv_graphic_frame_pr.rb +23 -0
- data/lib/uniword/wp_drawing/doc_pr.rb +30 -0
- data/lib/uniword/wp_drawing/doc_properties.rb +27 -0
- data/lib/uniword/wp_drawing/effect_extent.rb +28 -0
- data/lib/uniword/wp_drawing/extent.rb +24 -0
- data/lib/uniword/wp_drawing/hidden.rb +22 -0
- data/lib/uniword/wp_drawing/inline.rb +38 -0
- data/lib/uniword/wp_drawing/layout_in_cell.rb +22 -0
- data/lib/uniword/wp_drawing/line_to.rb +24 -0
- data/lib/uniword/wp_drawing/locked.rb +22 -0
- data/lib/uniword/wp_drawing/non_visual_drawing_props.rb +20 -0
- data/lib/uniword/wp_drawing/pos_offset.rb +22 -0
- data/lib/uniword/wp_drawing/position_h.rb +27 -0
- data/lib/uniword/wp_drawing/position_v.rb +27 -0
- data/lib/uniword/wp_drawing/relative_height.rb +22 -0
- data/lib/uniword/wp_drawing/simple_pos.rb +24 -0
- data/lib/uniword/wp_drawing/size_rel_h.rb +25 -0
- data/lib/uniword/wp_drawing/size_rel_v.rb +25 -0
- data/lib/uniword/wp_drawing/start.rb +24 -0
- data/lib/uniword/wp_drawing/wrap_none.rb +18 -0
- data/lib/uniword/wp_drawing/wrap_polygon.rb +27 -0
- data/lib/uniword/wp_drawing/wrap_square.rb +33 -0
- data/lib/uniword/wp_drawing/wrap_through.rb +29 -0
- data/lib/uniword/wp_drawing/wrap_tight.rb +29 -0
- data/lib/uniword/wp_drawing/wrap_top_and_bottom.rb +27 -0
- data/lib/uniword/wp_drawing.rb +55 -0
- data/lib/uniword.rb +295 -0
- metadata +1386 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Uniword
|
|
4
|
+
module Transformation
|
|
5
|
+
# SERVICE for converting HTML to OOXML elements.
|
|
6
|
+
#
|
|
7
|
+
# Pure functions - no state, no side effects.
|
|
8
|
+
# Used by Transformer when source_format is :mhtml.
|
|
9
|
+
#
|
|
10
|
+
class HtmlToOoxmlConverter
|
|
11
|
+
# Convert HTML content to OOXML paragraphs
|
|
12
|
+
#
|
|
13
|
+
# @param html_content [String] HTML content (may include full HTML document)
|
|
14
|
+
# @return [Array<Uniword::Wordprocessingml::Paragraph>] Array of paragraphs
|
|
15
|
+
def self.html_to_paragraphs(html_content)
|
|
16
|
+
return [] if html_content.nil? || html_content.empty?
|
|
17
|
+
|
|
18
|
+
# Extract body content if full HTML document
|
|
19
|
+
body = extract_body(html_content)
|
|
20
|
+
|
|
21
|
+
# Parse HTML and extract paragraphs
|
|
22
|
+
doc = Nokogiri::HTML(body)
|
|
23
|
+
paragraphs = []
|
|
24
|
+
|
|
25
|
+
doc.css('p, h1, h2, h3, h4, h5, h6, li, div, tr').each do |element|
|
|
26
|
+
# Skip elements that are inside table cells (table content is handled separately)
|
|
27
|
+
next if element.ancestors('td, th').any?
|
|
28
|
+
|
|
29
|
+
# Skip table row/cell containers themselves
|
|
30
|
+
next if %w[tr td].include?(element.name)
|
|
31
|
+
|
|
32
|
+
# Skip container elements (div, li) that have children matching the same selector.
|
|
33
|
+
# This prevents duplicate processing when a div contains a p, since the p's
|
|
34
|
+
# content is more semantically meaningful and the div's text would duplicate it.
|
|
35
|
+
if %w[div
|
|
36
|
+
li].include?(element.name) && element.css('p, h1, h2, h3, h4, h5, h6, li, div, tr').any?
|
|
37
|
+
next
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
paragraph = html_element_to_paragraph(element)
|
|
41
|
+
paragraphs << paragraph if paragraph
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
paragraphs
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Convert HTML content to OOXML tables
|
|
48
|
+
#
|
|
49
|
+
# @param html_content [String] HTML content (may include full HTML document)
|
|
50
|
+
# @return [Array<Uniword::Wordprocessingml::Table>] Array of tables
|
|
51
|
+
def self.html_to_tables(html_content)
|
|
52
|
+
return [] if html_content.nil? || html_content.empty?
|
|
53
|
+
|
|
54
|
+
# Extract body content if full HTML document
|
|
55
|
+
body = extract_body(html_content)
|
|
56
|
+
|
|
57
|
+
# Parse HTML and extract tables
|
|
58
|
+
doc = Nokogiri::HTML(body)
|
|
59
|
+
tables = []
|
|
60
|
+
|
|
61
|
+
doc.css('table').each do |html_table|
|
|
62
|
+
table = html_table_to_table(html_table)
|
|
63
|
+
tables << table if table
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
tables
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Convert a single HTML table to OOXML table
|
|
70
|
+
#
|
|
71
|
+
# @param html_table [Nokogiri::XML::Element] HTML table element
|
|
72
|
+
# @return [Uniword::Wordprocessingml::Table, nil] OOXML table or nil
|
|
73
|
+
def self.html_table_to_table(html_table)
|
|
74
|
+
table = Uniword::Wordprocessingml::Table.new
|
|
75
|
+
rows = []
|
|
76
|
+
|
|
77
|
+
html_table.css('tr').each do |html_row|
|
|
78
|
+
row = html_row_to_row(html_row)
|
|
79
|
+
rows << row if row
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
return nil if rows.empty?
|
|
83
|
+
|
|
84
|
+
rows.each { |r| table.rows << r }
|
|
85
|
+
table
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Convert a single HTML row to OOXML table row
|
|
89
|
+
#
|
|
90
|
+
# @param html_row [Nokogiri::XML::Element] HTML tr element
|
|
91
|
+
# @return [Uniword::Wordprocessingml::TableRow, nil] OOXML row or nil
|
|
92
|
+
def self.html_row_to_row(html_row)
|
|
93
|
+
row = Uniword::Wordprocessingml::TableRow.new
|
|
94
|
+
cells = []
|
|
95
|
+
|
|
96
|
+
html_row.css('td, th').each do |html_cell|
|
|
97
|
+
cell = html_cell_to_cell(html_cell)
|
|
98
|
+
cells << cell if cell
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
return nil if cells.empty?
|
|
102
|
+
|
|
103
|
+
cells.each { |c| row.cells << c }
|
|
104
|
+
row
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Convert a single HTML cell to OOXML table cell
|
|
108
|
+
#
|
|
109
|
+
# @param html_cell [Nokogiri::XML::Element] HTML td/th element
|
|
110
|
+
# @return [Uniword::Wordprocessingml::TableCell, nil] OOXML cell or nil
|
|
111
|
+
def self.html_cell_to_cell(html_cell)
|
|
112
|
+
cell = Uniword::Wordprocessingml::TableCell.new
|
|
113
|
+
|
|
114
|
+
# Map CSS class to cell style if present
|
|
115
|
+
css_class = html_cell.attr('class')
|
|
116
|
+
if css_class && !css_class.empty?
|
|
117
|
+
map_css_class_to_style(css_class)
|
|
118
|
+
# Style mapping available if needed for cell-level styling
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Convert cell content to paragraphs
|
|
122
|
+
html_cell.css('p, div, h1, h2, h3, h4, h5, h6').each do |para_element|
|
|
123
|
+
paragraph = html_element_to_paragraph(para_element)
|
|
124
|
+
cell.paragraphs << paragraph if paragraph
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# If no paragraphs found, create one from text content
|
|
128
|
+
if cell.paragraphs.empty?
|
|
129
|
+
text = html_cell.text.strip
|
|
130
|
+
if text && !text.empty?
|
|
131
|
+
para = Uniword::Wordprocessingml::Paragraph.new
|
|
132
|
+
para.runs << create_run(text)
|
|
133
|
+
cell.paragraphs << para
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Always return a cell, even if empty (preserves table structure)
|
|
138
|
+
cell.paragraphs.empty? ? create_empty_cell(cell) : cell
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Create a cell with an empty paragraph to preserve structure
|
|
142
|
+
def self.create_empty_cell(cell)
|
|
143
|
+
# Ensure at least one empty paragraph exists to represent the cell
|
|
144
|
+
cell.paragraphs << Uniword::Wordprocessingml::Paragraph.new
|
|
145
|
+
cell
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Convert a single HTML element to OOXML paragraph
|
|
149
|
+
#
|
|
150
|
+
# @param element [Nokogiri::XML::Element] HTML element
|
|
151
|
+
# @return [Uniword::Wordprocessingml::Paragraph] OOXML paragraph
|
|
152
|
+
def self.html_element_to_paragraph(element)
|
|
153
|
+
paragraph = Uniword::Wordprocessingml::Paragraph.new
|
|
154
|
+
|
|
155
|
+
# Determine heading level from tag name
|
|
156
|
+
if element.name.match?(/^h[1-6]$/)
|
|
157
|
+
paragraph.properties ||= Uniword::Wordprocessingml::ParagraphProperties.new
|
|
158
|
+
heading_num = element.name[1]
|
|
159
|
+
paragraph.properties.style = "Heading#{heading_num}"
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Map CSS class to OOXML style (MHT-specific classes)
|
|
163
|
+
css_class = element.attr('class')
|
|
164
|
+
if css_class && !css_class.empty?
|
|
165
|
+
mapped_style = map_css_class_to_style(css_class)
|
|
166
|
+
if mapped_style
|
|
167
|
+
paragraph.properties ||= Uniword::Wordprocessingml::ParagraphProperties.new
|
|
168
|
+
paragraph.properties.style = mapped_style
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Convert child nodes to runs
|
|
173
|
+
element.children.each do |child|
|
|
174
|
+
case child.type
|
|
175
|
+
when Nokogiri::XML::Node::TEXT_NODE
|
|
176
|
+
text = child.text.strip
|
|
177
|
+
next if text.empty?
|
|
178
|
+
|
|
179
|
+
run = create_run(text)
|
|
180
|
+
paragraph.runs << run
|
|
181
|
+
when Nokogiri::XML::Node::ELEMENT_NODE
|
|
182
|
+
# Handle SDT elements separately from runs
|
|
183
|
+
if child.name.downcase == 'w:sdt' || child.name == 'sdt'
|
|
184
|
+
sdt = create_sdt_from_element(child)
|
|
185
|
+
paragraph.sdts << sdt if sdt
|
|
186
|
+
else
|
|
187
|
+
run = create_run_from_element(child)
|
|
188
|
+
paragraph.runs << run if run
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Only return paragraph if it has content
|
|
194
|
+
paragraph.runs.any? ? paragraph : nil
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Map MHT CSS class to OOXML style name
|
|
198
|
+
#
|
|
199
|
+
# @param css_class [String] CSS class string (may contain multiple classes)
|
|
200
|
+
# @return [String, nil] OOXML style name or nil
|
|
201
|
+
def self.map_css_class_to_style(css_class)
|
|
202
|
+
# CSS class to OOXML style mapping for MHT documents
|
|
203
|
+
class_mapping = {
|
|
204
|
+
# Microsoft Office Built-in Styles
|
|
205
|
+
'MsoTitle' => 'Title',
|
|
206
|
+
'MsoTitle2' => 'Title2',
|
|
207
|
+
'MsoSubtitle' => 'Subtitle',
|
|
208
|
+
'MsoHeading1' => 'Heading1',
|
|
209
|
+
'MsoHeading2' => 'Heading2',
|
|
210
|
+
'MsoHeading3' => 'Heading3',
|
|
211
|
+
'MsoHeading4' => 'Heading4',
|
|
212
|
+
'MsoHeading5' => 'Heading5',
|
|
213
|
+
'MsoHeading6' => 'Heading6',
|
|
214
|
+
'MsoToc1' => 'TOC1',
|
|
215
|
+
'MsoToc2' => 'TOC2',
|
|
216
|
+
'MsoToc3' => 'TOC3',
|
|
217
|
+
'MsoToc4' => 'TOC4',
|
|
218
|
+
'MsoToc5' => 'TOC5',
|
|
219
|
+
'MsoToc6' => 'TOC6',
|
|
220
|
+
'MsoToc7' => 'TOC7',
|
|
221
|
+
'MsoToc8' => 'TOC8',
|
|
222
|
+
'MsoToc9' => 'TOC9',
|
|
223
|
+
'MsoTocHeading' => 'TOC Heading',
|
|
224
|
+
'MsoBibliography' => 'Bibliography',
|
|
225
|
+
'MsoNoSpacing' => 'No Spacing',
|
|
226
|
+
'MsoQuote' => 'Quote',
|
|
227
|
+
'MsoHeader' => 'Header',
|
|
228
|
+
'MsoFooter' => 'Footer',
|
|
229
|
+
'MsoListBullet' => 'List Bullet',
|
|
230
|
+
'MsoCaption' => 'Caption',
|
|
231
|
+
'MsoEndnoteText' => 'EndnoteText',
|
|
232
|
+
'MsoFootnoteText' => 'FootnoteText',
|
|
233
|
+
'MsoPageBreak' => 'PageBreak',
|
|
234
|
+
|
|
235
|
+
# Table-related styles
|
|
236
|
+
'TableNote' => 'TableNote',
|
|
237
|
+
'TableSource' => 'TableSource',
|
|
238
|
+
'TableTitle' => 'TableTitle',
|
|
239
|
+
'TableFigure' => 'TableFigure',
|
|
240
|
+
|
|
241
|
+
# Document part styles
|
|
242
|
+
'SectionTitle' => 'SectionTitle',
|
|
243
|
+
'Heading4Char' => 'Heading4Char',
|
|
244
|
+
'Author' => 'Author',
|
|
245
|
+
|
|
246
|
+
# Direct class matches (non-Mso prefixed)
|
|
247
|
+
'Title' => 'Title',
|
|
248
|
+
'Heading1' => 'Heading1',
|
|
249
|
+
'Heading2' => 'Heading2',
|
|
250
|
+
'Heading3' => 'Heading3',
|
|
251
|
+
'Heading4' => 'Heading4',
|
|
252
|
+
'Heading5' => 'Heading5',
|
|
253
|
+
'Heading6' => 'Heading6',
|
|
254
|
+
'Quote' => 'Quote',
|
|
255
|
+
'Bibliography' => 'Bibliography',
|
|
256
|
+
'NoSpacing' => 'No Spacing'
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
# Check each class in the class string
|
|
260
|
+
css_class.split.each do |cls|
|
|
261
|
+
return class_mapping[cls] if class_mapping.key?(cls)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
nil
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Create OOXML run from HTML element with inline formatting
|
|
268
|
+
#
|
|
269
|
+
# @param element [Nokogiri::XML::Element] HTML element
|
|
270
|
+
# @return [Uniword::Wordprocessingml::Run, nil] OOXML Run or nil
|
|
271
|
+
def self.create_run_from_element(element)
|
|
272
|
+
text = element.text.strip
|
|
273
|
+
return nil if text.empty?
|
|
274
|
+
|
|
275
|
+
# Decode HTML entities (e.g., © -> ©)
|
|
276
|
+
decoded_text = decode_html_entities(text)
|
|
277
|
+
|
|
278
|
+
# Recursively collect formatting from nested elements
|
|
279
|
+
props = collect_formatting_from_element(element)
|
|
280
|
+
|
|
281
|
+
run = Uniword::Wordprocessingml::Run.new
|
|
282
|
+
run.text = decoded_text
|
|
283
|
+
run.properties = props if has_properties?(props)
|
|
284
|
+
run
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Create OOXML SDT from HTML element
|
|
288
|
+
#
|
|
289
|
+
# @param element [Nokogiri::XML::Element] HTML w:sdt element
|
|
290
|
+
# @return [Uniword::Wordprocessingml::StructuredDocumentTag, nil] OOXML SDT or nil
|
|
291
|
+
def self.create_sdt_from_element(element)
|
|
292
|
+
text = element.text.strip
|
|
293
|
+
return nil if text.empty?
|
|
294
|
+
|
|
295
|
+
sdt = Uniword::Wordprocessingml::StructuredDocumentTag.new
|
|
296
|
+
|
|
297
|
+
# Parse SDT attributes
|
|
298
|
+
sdt_props = parse_sdt_attributes(element)
|
|
299
|
+
sdt.properties = sdt_props if sdt_props
|
|
300
|
+
|
|
301
|
+
# Create SDT content with the text
|
|
302
|
+
content = Uniword::Wordprocessingml::StructuredDocumentTag::Content.new
|
|
303
|
+
run = Uniword::Wordprocessingml::Run.new
|
|
304
|
+
run.text = decode_html_entities(text)
|
|
305
|
+
content.runs = [run]
|
|
306
|
+
sdt.content = content
|
|
307
|
+
|
|
308
|
+
sdt
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# Parse SDT attributes from HTML element
|
|
312
|
+
#
|
|
313
|
+
# @param element [Nokogiri::XML::Element] HTML w:sdt element
|
|
314
|
+
# @return [Uniword::Wordprocessingml::StructuredDocumentTagProperties, nil]
|
|
315
|
+
def self.parse_sdt_attributes(element)
|
|
316
|
+
attrs = element.attributes
|
|
317
|
+
return nil if attrs.empty?
|
|
318
|
+
|
|
319
|
+
sdt_props = Uniword::Wordprocessingml::StructuredDocumentTagProperties.new
|
|
320
|
+
|
|
321
|
+
# ShowingPlcHdr - placeholder display flag
|
|
322
|
+
if attrs['showingplchdr'] || attrs['ShowingPlcHdr']
|
|
323
|
+
sdt_props.showing_placeholder_header =
|
|
324
|
+
Uniword::Wordprocessingml::StructuredDocumentTag::ShowingPlaceholderHeader.new
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# Temporary - temporary SDT flag
|
|
328
|
+
if attrs['temporary'] || attrs['Temporary']
|
|
329
|
+
sdt_props.temporary =
|
|
330
|
+
Uniword::Wordprocessingml::StructuredDocumentTag::Temporary.new
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# DocPart - document part UUID
|
|
334
|
+
doc_part = attrs['docpart'] || attrs['DocPart']
|
|
335
|
+
if doc_part
|
|
336
|
+
placeholder = Uniword::Wordprocessingml::StructuredDocumentTag::Placeholder.new
|
|
337
|
+
doc_part_ref = Uniword::Wordprocessingml::StructuredDocumentTag::DocPartReference.new(value: doc_part.value)
|
|
338
|
+
placeholder.doc_part = doc_part_ref
|
|
339
|
+
sdt_props.placeholder = placeholder
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# Text - text-only flag
|
|
343
|
+
if attrs['text'] || attrs['Text']
|
|
344
|
+
sdt_props.text = Uniword::Wordprocessingml::StructuredDocumentTag::Text.new(value: 'whole')
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# ID - numeric ID
|
|
348
|
+
id_attr = attrs['id'] || attrs['ID']
|
|
349
|
+
if id_attr
|
|
350
|
+
sdt_props.id = Uniword::Wordprocessingml::StructuredDocumentTag::Id.new(value: id_attr.value.to_i)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# SdtDocPart - SDT document part type
|
|
354
|
+
sdt_doc_part = attrs['sdtdocpart'] || attrs['SdtDocPart']
|
|
355
|
+
if sdt_doc_part
|
|
356
|
+
# This is a special attribute indicating the SDT is a document part
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# DocPartType - document part type (e.g., "Table of Contents")
|
|
360
|
+
doc_part_type = attrs['docparttype'] || attrs['DocPartType']
|
|
361
|
+
if doc_part_type
|
|
362
|
+
# Store as tag or alias
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Bibliography - bibliography flag
|
|
366
|
+
if attrs['bibliography'] || attrs['Bibliography']
|
|
367
|
+
sdt_props.bibliography =
|
|
368
|
+
Uniword::Wordprocessingml::StructuredDocumentTag::Bibliography.new
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
sdt_props
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# Recursively collect formatting properties from element and its children
|
|
375
|
+
#
|
|
376
|
+
# @param element [Nokogiri::XML::Element] HTML element
|
|
377
|
+
# @return [Uniword::Wordprocessingml::RunProperties] Run properties with all formatting
|
|
378
|
+
def self.collect_formatting_from_element(element)
|
|
379
|
+
props = Uniword::Wordprocessingml::RunProperties.new
|
|
380
|
+
|
|
381
|
+
case element.name.downcase
|
|
382
|
+
when 'strong', 'b'
|
|
383
|
+
props.bold = Uniword::Properties::Bold.new
|
|
384
|
+
when 'em', 'i'
|
|
385
|
+
props.italic = Uniword::Properties::Italic.new
|
|
386
|
+
when 'u'
|
|
387
|
+
props.underline = Uniword::Properties::Underline.new
|
|
388
|
+
when 's', 'strike'
|
|
389
|
+
props.strike = Uniword::Properties::Strike.new
|
|
390
|
+
when 'sup'
|
|
391
|
+
props.vertical_align = Uniword::Properties::VerticalAlign.new(value: 'superscript')
|
|
392
|
+
when 'sub'
|
|
393
|
+
props.vertical_align = Uniword::Properties::VerticalAlign.new(value: 'subscript')
|
|
394
|
+
when 'span'
|
|
395
|
+
apply_span_formatting(element, props)
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# Recursively collect formatting from child elements
|
|
399
|
+
# This handles nested formatting like <u><em><strong>text</strong></em></u>
|
|
400
|
+
element.children.each do |child|
|
|
401
|
+
next unless child.element?
|
|
402
|
+
|
|
403
|
+
child_props = collect_formatting_from_element(child)
|
|
404
|
+
merge_run_properties(props, child_props)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
props
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
# Merge formatting properties from child into parent
|
|
411
|
+
#
|
|
412
|
+
# @param parent [Uniword::Wordprocessingml::RunProperties] Parent properties
|
|
413
|
+
# @param child [Uniword::Wordprocessingml::RunProperties] Child properties to merge
|
|
414
|
+
def self.merge_run_properties(parent, child)
|
|
415
|
+
parent.bold = child.bold if child.bold
|
|
416
|
+
parent.italic = child.italic if child.italic
|
|
417
|
+
parent.underline = child.underline if child.underline
|
|
418
|
+
parent.strike = child.strike if child.strike
|
|
419
|
+
parent.vertical_align = child.vertical_align if child.vertical_align
|
|
420
|
+
parent.color = child.color if child.color
|
|
421
|
+
parent.size = child.size if child.size
|
|
422
|
+
parent.font = child.font if child.font
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# Apply formatting from span element's style attribute
|
|
426
|
+
#
|
|
427
|
+
# @param element [Nokogiri::XML::Element] span element
|
|
428
|
+
# @param props [Uniword::Wordprocessingml::RunProperties] run properties
|
|
429
|
+
def self.apply_span_formatting(element, props)
|
|
430
|
+
style = element.attr('style') || ''
|
|
431
|
+
|
|
432
|
+
# Color
|
|
433
|
+
if style =~ /color:\s*#?([0-9a-fA-F]{6})/i
|
|
434
|
+
props.color = Uniword::Properties::ColorValue.new(value: Regexp.last_match(1))
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
# Font size
|
|
438
|
+
if style =~ /font-size:\s*([0-9.]+)(pt|px|em)/i
|
|
439
|
+
size = Regexp.last_match(1).to_f
|
|
440
|
+
unit = Regexp.last_match(2)
|
|
441
|
+
# Convert to half-points (OOXML unit)
|
|
442
|
+
half_pts = case unit
|
|
443
|
+
when 'pt' then (size * 2).round
|
|
444
|
+
when 'px' then (size * 2 * 72 / 96).round # 96 DPI assumption
|
|
445
|
+
when 'em' then (size * 24).round # em relative to 12pt base
|
|
446
|
+
else size.round
|
|
447
|
+
end
|
|
448
|
+
props.size = Uniword::Properties::FontSize.new(value: half_pts.to_s)
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Font family
|
|
452
|
+
return unless style =~ /font-family:\s*['"]([^'"]+)['"]/i
|
|
453
|
+
|
|
454
|
+
font = Regexp.last_match(1).split(',').first.strip
|
|
455
|
+
props.font = Uniword::Properties::RunFonts.new(ascii: font)
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
# Decode standard HTML entities in text.
|
|
459
|
+
# Converts entity names like © to their actual characters.
|
|
460
|
+
# Unknown entities are preserved as-is.
|
|
461
|
+
#
|
|
462
|
+
# @param text [String] Text that may contain HTML entities
|
|
463
|
+
# @return [String] Text with entities decoded
|
|
464
|
+
def self.decode_html_entities(text)
|
|
465
|
+
return text unless text.include?('&')
|
|
466
|
+
|
|
467
|
+
# Standard HTML entities that we decode
|
|
468
|
+
entities = {
|
|
469
|
+
'nbsp' => [160].pack('U'),
|
|
470
|
+
'copy' => [169].pack('U'),
|
|
471
|
+
'reg' => [174].pack('U'),
|
|
472
|
+
'trade' => [8482].pack('U'),
|
|
473
|
+
'amp' => '&', # & -> & (already unescaped by Nokogiri, but handle just in case)
|
|
474
|
+
'lt' => '<',
|
|
475
|
+
'gt' => '>',
|
|
476
|
+
'quot' => '"',
|
|
477
|
+
'apos' => "'",
|
|
478
|
+
'ndash' => [8211].pack('U'),
|
|
479
|
+
'mdash' => [8212].pack('U'),
|
|
480
|
+
'lsquo' => [8216].pack('U'),
|
|
481
|
+
'rsquo' => [8217].pack('U'),
|
|
482
|
+
'ldquo' => [8220].pack('U'),
|
|
483
|
+
'rdquo' => [8221].pack('U'),
|
|
484
|
+
'hellip' => [8230].pack('U'),
|
|
485
|
+
'bull' => [8226].pack('U'),
|
|
486
|
+
'mu' => [181].pack('U'), # micro sign
|
|
487
|
+
'plusmn' => [177].pack('U'), # plus-minus
|
|
488
|
+
'times' => [215].pack('U'), # multiplication
|
|
489
|
+
'divide' => [247].pack('U'), # division
|
|
490
|
+
'euro' => [8364].pack('U'),
|
|
491
|
+
'pound' => [163].pack('U'),
|
|
492
|
+
'yen' => [165].pack('U'),
|
|
493
|
+
'cent' => [162].pack('U')
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
text.gsub(/&(\w+);/) do
|
|
497
|
+
key = Regexp.last_match(1)
|
|
498
|
+
if entities.key?(key)
|
|
499
|
+
entities[key]
|
|
500
|
+
else
|
|
501
|
+
"&#{key};" # Preserve unknown entity
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
|
|
506
|
+
# Create a simple run without properties
|
|
507
|
+
#
|
|
508
|
+
# @param text [String] Run text
|
|
509
|
+
# @return [Uniword::Wordprocessingml::Run] OOXML run
|
|
510
|
+
def self.create_run(text)
|
|
511
|
+
# Decode HTML entities in text (e.g., © -> ©)
|
|
512
|
+
decoded_text = decode_html_entities(text)
|
|
513
|
+
|
|
514
|
+
run = Uniword::Wordprocessingml::Run.new
|
|
515
|
+
run.text = decoded_text
|
|
516
|
+
run
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
# Check if run properties object has any formatting
|
|
520
|
+
#
|
|
521
|
+
# @param props [Uniword::Wordprocessingml::RunProperties] run properties
|
|
522
|
+
# @return [Boolean] true if has formatting
|
|
523
|
+
def self.has_properties?(props)
|
|
524
|
+
props.bold || props.italic || props.underline || props.strike ||
|
|
525
|
+
props.color || props.size || props.font || props.vertical_align
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
# Extract body content from HTML document
|
|
529
|
+
#
|
|
530
|
+
# @param html [String] HTML content
|
|
531
|
+
# @return [String] Body content or full content if no body tag
|
|
532
|
+
def self.extract_body(html)
|
|
533
|
+
if html =~ %r{<body[^>]*>(.*?)</body>}im
|
|
534
|
+
Regexp.last_match(1)
|
|
535
|
+
else
|
|
536
|
+
html
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
end
|
|
540
|
+
end
|
|
541
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Uniword
|
|
4
|
+
module Transformation
|
|
5
|
+
# Transformation rule for Hyperlink elements.
|
|
6
|
+
#
|
|
7
|
+
# Responsibility: Transform Hyperlink objects between DOCX and MHTML formats.
|
|
8
|
+
# Single Responsibility - handles only Hyperlink transformations.
|
|
9
|
+
#
|
|
10
|
+
# Transforms hyperlinks including URL, anchor, tooltip, and contained runs.
|
|
11
|
+
#
|
|
12
|
+
# @example Transform DOCX hyperlink to MHTML
|
|
13
|
+
# rule = HyperlinkTransformationRule.new(source_format: :docx, target_format: :mhtml)
|
|
14
|
+
# mhtml_link = rule.transform(docx_link)
|
|
15
|
+
class HyperlinkTransformationRule < TransformationRule
|
|
16
|
+
# Check if this rule matches the transformation request
|
|
17
|
+
#
|
|
18
|
+
# @param element_type [Class] The element class
|
|
19
|
+
# @param source_format [Symbol] Source format
|
|
20
|
+
# @param target_format [Symbol] Target format
|
|
21
|
+
# @return [Boolean] true if matches
|
|
22
|
+
def matches?(element_type:, source_format:, target_format:)
|
|
23
|
+
element_type == Hyperlink &&
|
|
24
|
+
source_format == @source_format &&
|
|
25
|
+
target_format == @target_format
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Transform a hyperlink from source format to target format
|
|
29
|
+
#
|
|
30
|
+
# Creates new Hyperlink with same URL/anchor and transformed runs.
|
|
31
|
+
#
|
|
32
|
+
# @param source_link [Hyperlink] Source hyperlink
|
|
33
|
+
# @return [Hyperlink] Transformed hyperlink
|
|
34
|
+
# @raise [ArgumentError] if source_link is not a Hyperlink
|
|
35
|
+
def transform(source_link)
|
|
36
|
+
validate_element_type(source_link, Hyperlink)
|
|
37
|
+
|
|
38
|
+
# Create new hyperlink with core properties
|
|
39
|
+
target_link = Hyperlink.new(
|
|
40
|
+
url: source_link.url,
|
|
41
|
+
anchor: source_link.anchor,
|
|
42
|
+
text: source_link.text,
|
|
43
|
+
tooltip: source_link.tooltip,
|
|
44
|
+
relationship_id: source_link.relationship_id
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Transform runs within hyperlink
|
|
48
|
+
transform_runs(source_link, target_link)
|
|
49
|
+
|
|
50
|
+
target_link
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
# Transform runs within hyperlink
|
|
56
|
+
#
|
|
57
|
+
# @param source [Hyperlink] Source hyperlink
|
|
58
|
+
# @param target [Hyperlink] Target hyperlink
|
|
59
|
+
def transform_runs(source, target)
|
|
60
|
+
run_rule = RunTransformationRule.new(
|
|
61
|
+
source_format: @source_format,
|
|
62
|
+
target_format: @target_format
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
source.runs.each do |source_run|
|
|
66
|
+
target_run = run_rule.transform(source_run)
|
|
67
|
+
target.runs << target_run
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Uniword
|
|
4
|
+
module Transformation
|
|
5
|
+
# Transformation rule for Image elements.
|
|
6
|
+
#
|
|
7
|
+
# Responsibility: Transform Image objects between DOCX and MHTML formats.
|
|
8
|
+
# Single Responsibility - handles only Image transformations.
|
|
9
|
+
#
|
|
10
|
+
# Transforms image properties including positioning, dimensions, and metadata.
|
|
11
|
+
#
|
|
12
|
+
# @example Transform DOCX image to MHTML
|
|
13
|
+
# rule = ImageTransformationRule.new(source_format: :docx, target_format: :mhtml)
|
|
14
|
+
# mhtml_image = rule.transform(docx_image)
|
|
15
|
+
class ImageTransformationRule < TransformationRule
|
|
16
|
+
# Check if this rule matches the transformation request
|
|
17
|
+
#
|
|
18
|
+
# @param element_type [Class] The element class
|
|
19
|
+
# @param source_format [Symbol] Source format
|
|
20
|
+
# @param target_format [Symbol] Target format
|
|
21
|
+
# @return [Boolean] true if matches
|
|
22
|
+
def matches?(element_type:, source_format:, target_format:)
|
|
23
|
+
element_type == Image &&
|
|
24
|
+
source_format == @source_format &&
|
|
25
|
+
target_format == @target_format
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Transform an image from source format to target format
|
|
29
|
+
#
|
|
30
|
+
# Creates new Image with adapted properties.
|
|
31
|
+
#
|
|
32
|
+
# @param source_image [Image] Source image
|
|
33
|
+
# @return [Image] Transformed image
|
|
34
|
+
# @raise [ArgumentError] if source_image is not an Image
|
|
35
|
+
def transform(source_image)
|
|
36
|
+
validate_element_type(source_image, Image)
|
|
37
|
+
|
|
38
|
+
# Create new image with core properties
|
|
39
|
+
target_image = Image.new(
|
|
40
|
+
relationship_id: source_image.relationship_id,
|
|
41
|
+
width: source_image.width,
|
|
42
|
+
height: source_image.height,
|
|
43
|
+
filename: source_image.filename,
|
|
44
|
+
alt_text: source_image.alt_text,
|
|
45
|
+
title: source_image.title
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# Transform positioning properties
|
|
49
|
+
transform_positioning(source_image, target_image)
|
|
50
|
+
|
|
51
|
+
target_image
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
# Transform image positioning properties
|
|
57
|
+
#
|
|
58
|
+
# @param source [Image] Source image
|
|
59
|
+
# @param target [Image] Target image
|
|
60
|
+
def transform_positioning(source, target)
|
|
61
|
+
# Copy positioning properties (same across formats)
|
|
62
|
+
target.inline = source.inline
|
|
63
|
+
target.horizontal_alignment = source.horizontal_alignment
|
|
64
|
+
target.vertical_alignment = source.vertical_alignment
|
|
65
|
+
target.text_wrapping = source.text_wrapping
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|