uniword 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/data/themes/office_format_scheme.xml +137 -0
  3. data/data/themes/office_theme.xml +2 -0
  4. data/lib/uniword/builder/footnote_builder.rb +4 -2
  5. data/lib/uniword/builder/run_builder.rb +5 -0
  6. data/lib/uniword/document_factory.rb +1 -0
  7. data/lib/uniword/docx/package.rb +18 -0
  8. data/lib/uniword/docx/package_defaults.rb +1 -0
  9. data/lib/uniword/docx/package_serialization.rb +38 -0
  10. data/lib/uniword/docx/reconciler.rb +195 -13
  11. data/lib/uniword/lazy_loader.rb +1 -1
  12. data/lib/uniword/properties/boolean_element_factory.rb +8 -15
  13. data/lib/uniword/schema/schema_loader.rb +1 -1
  14. data/lib/uniword/transformation/mhtml_style_builder.rb +9 -2
  15. data/lib/uniword/transformation/ooxml_to_mhtml_converter.rb +7 -15
  16. data/lib/uniword/transformation/yaml_css_generator.rb +815 -0
  17. data/lib/uniword/transformation.rb +2 -0
  18. data/lib/uniword/version.rb +1 -1
  19. data/lib/uniword/wordprocessingml/attached_template.rb +18 -0
  20. data/lib/uniword/wordprocessingml/body.rb +34 -34
  21. data/lib/uniword/wordprocessingml/brk_bin.rb +17 -0
  22. data/lib/uniword/wordprocessingml/brk_bin_sub.rb +17 -0
  23. data/lib/uniword/wordprocessingml/character_spacing_control.rb +17 -0
  24. data/lib/uniword/wordprocessingml/clr_scheme_mapping.rb +39 -0
  25. data/lib/uniword/wordprocessingml/compat.rb +16 -0
  26. data/lib/uniword/wordprocessingml/decimal_symbol.rb +17 -0
  27. data/lib/uniword/wordprocessingml/def_jc.rb +17 -0
  28. data/lib/uniword/wordprocessingml/default_tab_stop.rb +17 -0
  29. data/lib/uniword/wordprocessingml/disp_def.rb +14 -0
  30. data/lib/uniword/wordprocessingml/do_not_display_page_boundaries.rb +14 -0
  31. data/lib/uniword/wordprocessingml/do_not_include_subdocs_in_stats.rb +17 -0
  32. data/lib/uniword/wordprocessingml/doc_vars.rb +36 -0
  33. data/lib/uniword/wordprocessingml/document_root.rb +8 -5
  34. data/lib/uniword/wordprocessingml/endnote_pr.rb +18 -0
  35. data/lib/uniword/wordprocessingml/endnotes.rb +18 -0
  36. data/lib/uniword/wordprocessingml/even_and_odd_headers.rb +17 -0
  37. data/lib/uniword/wordprocessingml/footnote_pos.rb +17 -0
  38. data/lib/uniword/wordprocessingml/footnote_pr.rb +20 -0
  39. data/lib/uniword/wordprocessingml/footnotes.rb +18 -0
  40. data/lib/uniword/wordprocessingml/hdr_shape_defaults.rb +19 -0
  41. data/lib/uniword/wordprocessingml/hyphenation_zone.rb +20 -0
  42. data/lib/uniword/wordprocessingml/int_lim.rb +17 -0
  43. data/lib/uniword/wordprocessingml/l_margin.rb +17 -0
  44. data/lib/uniword/wordprocessingml/list_separator.rb +17 -0
  45. data/lib/uniword/wordprocessingml/math_font.rb +17 -0
  46. data/lib/uniword/wordprocessingml/math_pr.rb +49 -0
  47. data/lib/uniword/wordprocessingml/mirror_margins.rb +17 -0
  48. data/lib/uniword/wordprocessingml/nary_lim.rb +17 -0
  49. data/lib/uniword/wordprocessingml/proof_state.rb +19 -0
  50. data/lib/uniword/wordprocessingml/r_margin.rb +17 -0
  51. data/lib/uniword/wordprocessingml/rsid.rb +17 -0
  52. data/lib/uniword/wordprocessingml/rsid_root.rb +17 -0
  53. data/lib/uniword/wordprocessingml/rsids.rb +22 -0
  54. data/lib/uniword/wordprocessingml/settings.rb +45 -511
  55. data/lib/uniword/wordprocessingml/shape_defaults.rb +21 -0
  56. data/lib/uniword/wordprocessingml/small_frac.rb +17 -0
  57. data/lib/uniword/wordprocessingml/style_pane_format_filter.rb +50 -0
  58. data/lib/uniword/wordprocessingml/style_pane_sort_method.rb +20 -0
  59. data/lib/uniword/wordprocessingml/table_cell.rb +6 -0
  60. data/lib/uniword/wordprocessingml/table_row_properties.rb +2 -0
  61. data/lib/uniword/wordprocessingml/theme_font_lang.rb +19 -0
  62. data/lib/uniword/wordprocessingml/w14_doc_id.rb +17 -0
  63. data/lib/uniword/wordprocessingml/w15_chart_tracking_ref_based.rb +14 -0
  64. data/lib/uniword/wordprocessingml/w15_doc_id.rb +17 -0
  65. data/lib/uniword/wordprocessingml/wrap_indent.rb +17 -0
  66. data/lib/uniword/wordprocessingml.rb +42 -56
  67. data/lib/uniword.rb +12 -5
  68. metadata +50 -2
@@ -14,23 +14,16 @@ module Uniword
14
14
  end
15
15
 
16
16
  # Helper to define val= override after attribute declaration.
17
- # Uses alias_method to save the generated setter, then overrides it.
18
17
  module BooleanValSetter
19
18
  def self.included(base)
20
- base.class_eval do
21
- alias_method :__original_val_setter=, :val= if method_defined?(:val=)
22
- define_method(:val=) do |v|
23
- @val = if v.nil?
24
- nil
25
- elsif v == false || v.to_s == "false"
26
- "false"
27
- elsif v == true || v.to_s == "true"
28
- nil
29
- else
30
- v
31
- end
32
- value_set_for(:val)
33
- end
19
+ base.define_method(:val=) do |v|
20
+ @val = case v
21
+ when nil then nil
22
+ when false, "false" then "false"
23
+ when true, "true" then nil
24
+ else v
25
+ end
26
+ value_set_for(:val)
34
27
  end
35
28
  end
36
29
  end
@@ -85,6 +85,6 @@ module Uniword
85
85
  end
86
86
 
87
87
  # Raised when a schema file cannot be found
88
- class SchemaNotFoundError < StandardError; end
88
+ class SchemaNotFoundError < Uniword::Error; end
89
89
  end
90
90
  end
@@ -697,6 +697,12 @@ module Uniword
697
697
  </style>
698
698
  LSB_STYLE
699
699
 
700
+ class << self
701
+ # Custom CSS override set by callers (e.g., ISO adapter).
702
+ # When set, #style_block returns this instead of the default.
703
+ attr_accessor :custom_style_block
704
+ end
705
+
700
706
  # Build the w:LatentStyles block.
701
707
  # @return [String] Static latent styles XML
702
708
  def self.latent_styles
@@ -704,9 +710,10 @@ module Uniword
704
710
  end
705
711
 
706
712
  # Build the CSS style block.
707
- # @return [String] Static CSS style block
713
+ # Returns custom CSS if set via custom_style_block=, otherwise default.
714
+ # @return [String] CSS style block
708
715
  def self.style_block
709
- STYLE_BLOCK
716
+ custom_style_block || STYLE_BLOCK
710
717
  end
711
718
  end
712
719
  end
@@ -18,7 +18,8 @@ module Uniword
18
18
  # output = Uniword::Infrastructure::MimePackager.new(mhtml_doc).build_mime_content
19
19
  #
20
20
  class OoxmlToMhtmlConverter
21
- # Static MsoNormalTable CSS (used in wrap_html_document head)
21
+ # Static MsoNormalTable CSS (used in wrap_html_document head).
22
+ # Only used when MhtmlStyleBuilder does not provide custom CSS.
22
23
  MSO_NORMAL_TABLE_STYLE = <<~CSS
23
24
  <!--[if gte mso 10]>
24
25
  <style>
@@ -30,21 +31,12 @@ module Uniword
30
31
  mso-style-noshow:yes;
31
32
  mso-style-priority:99;
32
33
  mso-style-parent:"";
33
- mso-padding-alt:0in 5.4pt 0in 5.4pt;
34
- mso-para-margin-top:0in;
35
- mso-para-margin-right:0in;
36
- mso-para-margin-bottom:8.0pt;
37
- mso-para-margin-left:0in;
38
- line-height:115%;
34
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
35
+ mso-para-margin:0cm;
36
+ mso-para-margin-bottom:.0001pt;
39
37
  mso-pagination:widow-orphan;
40
- font-size:12.0pt;
41
- font-family:"Aptos",sans-serif;
42
- mso-ascii-font-family:Aptos;
43
- mso-ascii-theme-font:minor-latin;
44
- mso-hansi-font-family:Aptos;
45
- mso-hansi-theme-font:minor-latin;
46
- mso-font-kerning:1.0pt;
47
- mso-ligatures:standardcontextual;}
38
+ font-size:10pt;
39
+ font-family:"Cambria",serif;}
48
40
  </style>
49
41
  <![endif]-->
50
42
  CSS