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.
- checksums.yaml +4 -4
- data/data/themes/office_format_scheme.xml +137 -0
- data/data/themes/office_theme.xml +2 -0
- data/lib/uniword/builder/footnote_builder.rb +4 -2
- data/lib/uniword/builder/run_builder.rb +5 -0
- data/lib/uniword/document_factory.rb +1 -0
- data/lib/uniword/docx/package.rb +18 -0
- data/lib/uniword/docx/package_defaults.rb +1 -0
- data/lib/uniword/docx/package_serialization.rb +38 -0
- data/lib/uniword/docx/reconciler.rb +195 -13
- data/lib/uniword/lazy_loader.rb +1 -1
- data/lib/uniword/properties/boolean_element_factory.rb +8 -15
- data/lib/uniword/schema/schema_loader.rb +1 -1
- data/lib/uniword/transformation/mhtml_style_builder.rb +9 -2
- data/lib/uniword/transformation/ooxml_to_mhtml_converter.rb +7 -15
- data/lib/uniword/transformation/yaml_css_generator.rb +815 -0
- data/lib/uniword/transformation.rb +2 -0
- data/lib/uniword/version.rb +1 -1
- data/lib/uniword/wordprocessingml/attached_template.rb +18 -0
- data/lib/uniword/wordprocessingml/body.rb +34 -34
- data/lib/uniword/wordprocessingml/brk_bin.rb +17 -0
- data/lib/uniword/wordprocessingml/brk_bin_sub.rb +17 -0
- data/lib/uniword/wordprocessingml/character_spacing_control.rb +17 -0
- data/lib/uniword/wordprocessingml/clr_scheme_mapping.rb +39 -0
- data/lib/uniword/wordprocessingml/compat.rb +16 -0
- data/lib/uniword/wordprocessingml/decimal_symbol.rb +17 -0
- data/lib/uniword/wordprocessingml/def_jc.rb +17 -0
- data/lib/uniword/wordprocessingml/default_tab_stop.rb +17 -0
- data/lib/uniword/wordprocessingml/disp_def.rb +14 -0
- data/lib/uniword/wordprocessingml/do_not_display_page_boundaries.rb +14 -0
- data/lib/uniword/wordprocessingml/do_not_include_subdocs_in_stats.rb +17 -0
- data/lib/uniword/wordprocessingml/doc_vars.rb +36 -0
- data/lib/uniword/wordprocessingml/document_root.rb +8 -5
- data/lib/uniword/wordprocessingml/endnote_pr.rb +18 -0
- data/lib/uniword/wordprocessingml/endnotes.rb +18 -0
- data/lib/uniword/wordprocessingml/even_and_odd_headers.rb +17 -0
- data/lib/uniword/wordprocessingml/footnote_pos.rb +17 -0
- data/lib/uniword/wordprocessingml/footnote_pr.rb +20 -0
- data/lib/uniword/wordprocessingml/footnotes.rb +18 -0
- data/lib/uniword/wordprocessingml/hdr_shape_defaults.rb +19 -0
- data/lib/uniword/wordprocessingml/hyphenation_zone.rb +20 -0
- data/lib/uniword/wordprocessingml/int_lim.rb +17 -0
- data/lib/uniword/wordprocessingml/l_margin.rb +17 -0
- data/lib/uniword/wordprocessingml/list_separator.rb +17 -0
- data/lib/uniword/wordprocessingml/math_font.rb +17 -0
- data/lib/uniword/wordprocessingml/math_pr.rb +49 -0
- data/lib/uniword/wordprocessingml/mirror_margins.rb +17 -0
- data/lib/uniword/wordprocessingml/nary_lim.rb +17 -0
- data/lib/uniword/wordprocessingml/proof_state.rb +19 -0
- data/lib/uniword/wordprocessingml/r_margin.rb +17 -0
- data/lib/uniword/wordprocessingml/rsid.rb +17 -0
- data/lib/uniword/wordprocessingml/rsid_root.rb +17 -0
- data/lib/uniword/wordprocessingml/rsids.rb +22 -0
- data/lib/uniword/wordprocessingml/settings.rb +45 -511
- data/lib/uniword/wordprocessingml/shape_defaults.rb +21 -0
- data/lib/uniword/wordprocessingml/small_frac.rb +17 -0
- data/lib/uniword/wordprocessingml/style_pane_format_filter.rb +50 -0
- data/lib/uniword/wordprocessingml/style_pane_sort_method.rb +20 -0
- data/lib/uniword/wordprocessingml/table_cell.rb +6 -0
- data/lib/uniword/wordprocessingml/table_row_properties.rb +2 -0
- data/lib/uniword/wordprocessingml/theme_font_lang.rb +19 -0
- data/lib/uniword/wordprocessingml/w14_doc_id.rb +17 -0
- data/lib/uniword/wordprocessingml/w15_chart_tracking_ref_based.rb +14 -0
- data/lib/uniword/wordprocessingml/w15_doc_id.rb +17 -0
- data/lib/uniword/wordprocessingml/wrap_indent.rb +17 -0
- data/lib/uniword/wordprocessingml.rb +42 -56
- data/lib/uniword.rb +12 -5
- metadata +50 -2
data/lib/uniword/version.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
require_relative "../properties/relationship_id"
|
|
5
|
+
|
|
6
|
+
module Uniword
|
|
7
|
+
module Wordprocessingml
|
|
8
|
+
class AttachedTemplate < Lutaml::Model::Serializable
|
|
9
|
+
attribute :r_id, Properties::RelationshipIdValue
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "attachedTemplate"
|
|
13
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
14
|
+
map_attribute "id", to: :r_id
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -71,48 +71,48 @@ module Uniword
|
|
|
71
71
|
def sync_element_order
|
|
72
72
|
return if element_order.nil? || element_order.empty?
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
ordered_tbl_count = element_order.count { |e| e.name == "tbl" }
|
|
77
|
-
ordered_sdt_count = element_order.count { |e| e.name == "sdt" }
|
|
78
|
-
ordered_bookmark_start_count = element_order.count do |e|
|
|
79
|
-
e.name == "bookmarkStart"
|
|
80
|
-
end
|
|
81
|
-
ordered_bookmark_end_count = element_order.count do |e|
|
|
82
|
-
e.name == "bookmarkEnd"
|
|
74
|
+
counts = element_order.each_with_object(Hash.new(0)) do |e, h|
|
|
75
|
+
h[e.name] += 1
|
|
83
76
|
end
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
needed = false
|
|
79
|
+
needed = true if paragraphs.size > counts["p"]
|
|
80
|
+
needed = true if tables.size > counts["tbl"]
|
|
81
|
+
needed = true if structured_document_tags.size > counts["sdt"]
|
|
82
|
+
needed = true if bookmark_starts.size > counts["bookmarkStart"]
|
|
83
|
+
needed = true if bookmark_ends.size > counts["bookmarkEnd"]
|
|
84
|
+
needed = true if section_properties && counts["sectPr"].zero?
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
(tables.size - ordered_tbl_count).times do
|
|
92
|
-
element_order << Lutaml::Xml::Element.new("Element", "tbl")
|
|
93
|
-
end
|
|
86
|
+
return unless needed
|
|
94
87
|
|
|
95
|
-
|
|
96
|
-
(structured_document_tags.size - ordered_sdt_count).times do
|
|
97
|
-
element_order << Lutaml::Xml::Element.new("Element", "sdt")
|
|
98
|
-
end
|
|
88
|
+
dup_element_order_if_frozen
|
|
99
89
|
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
append_missing_elements("p", paragraphs.size - counts["p"])
|
|
91
|
+
append_missing_elements("tbl", tables.size - counts["tbl"])
|
|
92
|
+
append_missing_elements("sdt",
|
|
93
|
+
structured_document_tags.size - counts["sdt"])
|
|
94
|
+
append_missing_elements("bookmarkStart",
|
|
95
|
+
bookmark_starts.size - counts["bookmarkStart"])
|
|
96
|
+
append_missing_elements("bookmarkEnd",
|
|
97
|
+
bookmark_ends.size - counts["bookmarkEnd"])
|
|
104
98
|
|
|
105
|
-
|
|
106
|
-
(bookmark_ends.size - ordered_bookmark_end_count).times do
|
|
107
|
-
element_order << Lutaml::Xml::Element.new("Element", "bookmarkEnd")
|
|
108
|
-
end
|
|
99
|
+
return unless section_properties && counts["sectPr"].zero?
|
|
109
100
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
element_order << build_order_element("sectPr")
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def dup_element_order_if_frozen
|
|
105
|
+
return unless element_order.frozen?
|
|
106
|
+
|
|
107
|
+
self.element_order = element_order.dup
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def append_missing_elements(name, count)
|
|
111
|
+
count.times { element_order << build_order_element(name) }
|
|
112
|
+
end
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
def build_order_element(name)
|
|
115
|
+
Lutaml::Xml::Element.new("Element", name)
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class BrkBin < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "brkBin"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class BrkBinSub < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "brkBinSub"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class CharacterSpacingControl < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "characterSpacingControl"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class ClrSchemeMapping < Lutaml::Model::Serializable
|
|
8
|
+
attribute :bg1, :string
|
|
9
|
+
attribute :t1, :string
|
|
10
|
+
attribute :bg2, :string
|
|
11
|
+
attribute :t2, :string
|
|
12
|
+
attribute :accent1, :string
|
|
13
|
+
attribute :accent2, :string
|
|
14
|
+
attribute :accent3, :string
|
|
15
|
+
attribute :accent4, :string
|
|
16
|
+
attribute :accent5, :string
|
|
17
|
+
attribute :accent6, :string
|
|
18
|
+
attribute :hyperlink, :string
|
|
19
|
+
attribute :followed_hyperlink, :string
|
|
20
|
+
|
|
21
|
+
xml do
|
|
22
|
+
element "clrSchemeMapping"
|
|
23
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
24
|
+
map_attribute "bg1", to: :bg1
|
|
25
|
+
map_attribute "t1", to: :t1
|
|
26
|
+
map_attribute "bg2", to: :bg2
|
|
27
|
+
map_attribute "t2", to: :t2
|
|
28
|
+
map_attribute "accent1", to: :accent1
|
|
29
|
+
map_attribute "accent2", to: :accent2
|
|
30
|
+
map_attribute "accent3", to: :accent3
|
|
31
|
+
map_attribute "accent4", to: :accent4
|
|
32
|
+
map_attribute "accent5", to: :accent5
|
|
33
|
+
map_attribute "accent6", to: :accent6
|
|
34
|
+
map_attribute "hyperlink", to: :hyperlink
|
|
35
|
+
map_attribute "followedHyperlink", to: :followed_hyperlink
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -14,12 +14,25 @@ module Uniword
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Do not use HTML paragraph auto spacing (empty marker element)
|
|
18
|
+
#
|
|
19
|
+
# Element: <w:doNotUseHTMLParagraphAutoSpacing>
|
|
20
|
+
# Parent: <w:compat>
|
|
21
|
+
class DoNotUseHTMLParagraphAutoSpacing < Lutaml::Model::Serializable
|
|
22
|
+
xml do
|
|
23
|
+
element "doNotUseHTMLParagraphAutoSpacing"
|
|
24
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
17
28
|
# Compatibility settings
|
|
18
29
|
#
|
|
19
30
|
# Generated from OOXML schema: wordprocessingml.yml
|
|
20
31
|
# Element: <w:compat>
|
|
21
32
|
class Compat < Lutaml::Model::Serializable
|
|
22
33
|
attribute :use_fe_layout, UseFELayout
|
|
34
|
+
attribute :do_not_use_html_paragraph_auto_spacing,
|
|
35
|
+
DoNotUseHTMLParagraphAutoSpacing
|
|
23
36
|
attribute :compatSetting, CompatSetting, collection: true,
|
|
24
37
|
initialize_empty: true
|
|
25
38
|
|
|
@@ -29,6 +42,9 @@ module Uniword
|
|
|
29
42
|
mixed_content
|
|
30
43
|
|
|
31
44
|
map_element "useFELayout", to: :use_fe_layout, render_nil: false
|
|
45
|
+
map_element "doNotUseHTMLParagraphAutoSpacing",
|
|
46
|
+
to: :do_not_use_html_paragraph_auto_spacing,
|
|
47
|
+
render_nil: false
|
|
32
48
|
map_element "compatSetting", to: :compatSetting, render_nil: false
|
|
33
49
|
end
|
|
34
50
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class DecimalSymbol < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "decimalSymbol"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class DefJc < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "defJc"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class DefaultTabStop < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "defaultTabStop"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class DoNotDisplayPageBoundaries < Lutaml::Model::Serializable
|
|
8
|
+
xml do
|
|
9
|
+
element "doNotDisplayPageBoundaries"
|
|
10
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
# Do not include subdocs in statistics (empty marker)
|
|
8
|
+
#
|
|
9
|
+
# Element: <w:doNotIncludeSubdocsInStats>
|
|
10
|
+
class DoNotIncludeSubdocsInStats < Lutaml::Model::Serializable
|
|
11
|
+
xml do
|
|
12
|
+
element "doNotIncludeSubdocsInStats"
|
|
13
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
# Document variable entry
|
|
8
|
+
#
|
|
9
|
+
# Element: <w:docVar>
|
|
10
|
+
class DocVar < Lutaml::Model::Serializable
|
|
11
|
+
attribute :name, :string
|
|
12
|
+
attribute :val, :string
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
element "docVar"
|
|
16
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
17
|
+
map_attribute "name", to: :name
|
|
18
|
+
map_attribute "val", to: :val
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Document variables container
|
|
23
|
+
#
|
|
24
|
+
# Element: <w:docVars>
|
|
25
|
+
class DocVars < Lutaml::Model::Serializable
|
|
26
|
+
attribute :doc_var, DocVar, collection: true
|
|
27
|
+
|
|
28
|
+
xml do
|
|
29
|
+
element "docVars"
|
|
30
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
31
|
+
mixed_content
|
|
32
|
+
map_element "docVar", to: :doc_var, render_nil: false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -81,13 +81,14 @@ module Uniword
|
|
|
81
81
|
map_element "body", to: :body, render_default: true
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
# Override to_xml to sync
|
|
85
|
-
# lutaml-model's compiled serializer may
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
# and tables are included.
|
|
84
|
+
# Override to_xml to sync element_order on child collections
|
|
85
|
+
# before serialization. lutaml-model's compiled serializer may
|
|
86
|
+
# bypass child #to_xml when serializing nested elements, so we
|
|
87
|
+
# sync here at the DocumentRoot level.
|
|
89
88
|
def to_xml(options = {})
|
|
90
89
|
body&.sync_element_order_for_serialization
|
|
90
|
+
footnotes&.sync_element_order if footnotes
|
|
91
|
+
endnotes&.sync_element_order if endnotes
|
|
91
92
|
super
|
|
92
93
|
end
|
|
93
94
|
|
|
@@ -111,6 +112,8 @@ module Uniword
|
|
|
111
112
|
attr_accessor :chart_parts
|
|
112
113
|
# Bibliography sources for sources.xml
|
|
113
114
|
attr_accessor :bibliography_sources
|
|
115
|
+
# OLE/embedded object binaries (word/embeddings/*)
|
|
116
|
+
attr_accessor :embeddings
|
|
114
117
|
# Round-trip parts (copied from DocxPackage during load)
|
|
115
118
|
attr_accessor :settings, :font_table, :web_settings, :document_rels, :theme_rels,
|
|
116
119
|
:package_rels, :content_types, :custom_properties, :custom_xml_items
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class EndnotePr < Lutaml::Model::Serializable
|
|
8
|
+
attribute :endnotes, Endnote, collection: true
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "endnotePr"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
mixed_content
|
|
14
|
+
map_element "endnote", to: :endnotes, render_nil: false
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -19,6 +19,24 @@ module Uniword
|
|
|
19
19
|
|
|
20
20
|
map_element "endnote", to: :endnote_entries, render_nil: false
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def sync_element_order
|
|
24
|
+
return if element_order.nil? || element_order.empty?
|
|
25
|
+
|
|
26
|
+
counts = element_order.each_with_object(Hash.new(0)) do |e, h|
|
|
27
|
+
h[e.name] += 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
missing = endnote_entries.size - counts["endnote"]
|
|
31
|
+
missing.times do
|
|
32
|
+
element_order << Lutaml::Xml::Element.new("Element", "endnote")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_xml(options = {})
|
|
37
|
+
sync_element_order
|
|
38
|
+
super
|
|
39
|
+
end
|
|
22
40
|
end
|
|
23
41
|
end
|
|
24
42
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
# Even and odd page headers (empty marker)
|
|
8
|
+
#
|
|
9
|
+
# Element: <w:evenAndOddHeaders>
|
|
10
|
+
class EvenAndOddHeaders < Lutaml::Model::Serializable
|
|
11
|
+
xml do
|
|
12
|
+
element "evenAndOddHeaders"
|
|
13
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class FootnotePos < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "pos"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class FootnotePr < Lutaml::Model::Serializable
|
|
8
|
+
attribute :pos, FootnotePos
|
|
9
|
+
attribute :footnotes, Footnote, collection: true
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "footnotePr"
|
|
13
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
14
|
+
mixed_content
|
|
15
|
+
map_element "pos", to: :pos, render_nil: false
|
|
16
|
+
map_element "footnote", to: :footnotes, render_nil: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -19,6 +19,24 @@ module Uniword
|
|
|
19
19
|
|
|
20
20
|
map_element "footnote", to: :footnote_entries, render_nil: false
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def sync_element_order
|
|
24
|
+
return if element_order.nil? || element_order.empty?
|
|
25
|
+
|
|
26
|
+
counts = element_order.each_with_object(Hash.new(0)) do |e, h|
|
|
27
|
+
h[e.name] += 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
missing = footnote_entries.size - counts["footnote"]
|
|
31
|
+
missing.times do
|
|
32
|
+
element_order << Lutaml::Xml::Element.new("Element", "footnote")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_xml(options = {})
|
|
37
|
+
sync_element_order
|
|
38
|
+
super
|
|
39
|
+
end
|
|
22
40
|
end
|
|
23
41
|
end
|
|
24
42
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
require_relative "../vml_office"
|
|
5
|
+
|
|
6
|
+
module Uniword
|
|
7
|
+
module Wordprocessingml
|
|
8
|
+
class HdrShapeDefaults < Lutaml::Model::Serializable
|
|
9
|
+
attribute :shape_defaults, Uniword::VmlOffice::VmlShapeDefaults
|
|
10
|
+
|
|
11
|
+
xml do
|
|
12
|
+
element "hdrShapeDefaults"
|
|
13
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
14
|
+
mixed_content
|
|
15
|
+
map_element "shapedefaults", to: :shape_defaults, render_nil: false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
# Hyphenation zone width
|
|
8
|
+
#
|
|
9
|
+
# Element: <w:hyphenationZone>
|
|
10
|
+
class HyphenationZone < Lutaml::Model::Serializable
|
|
11
|
+
attribute :val, :string
|
|
12
|
+
|
|
13
|
+
xml do
|
|
14
|
+
element "hyphenationZone"
|
|
15
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
16
|
+
map_attribute "val", to: :val
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class IntLim < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "intLim"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class LMargin < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "lMargin"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class ListSeparator < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "listSeparator"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::WordProcessingML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Uniword
|
|
6
|
+
module Wordprocessingml
|
|
7
|
+
class MathFont < Lutaml::Model::Serializable
|
|
8
|
+
attribute :val, :string
|
|
9
|
+
|
|
10
|
+
xml do
|
|
11
|
+
element "mathFont"
|
|
12
|
+
namespace Uniword::Ooxml::Namespaces::MathML
|
|
13
|
+
map_attribute "val", to: :val
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|