uniword 1.2.5 → 1.3.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.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +223 -0
  3. data/CONTRIBUTING.md +1 -1
  4. data/config/ooxml/schemas/shared_types.yml +5 -4
  5. data/data/schemas/ecma/dc.xsd +118 -0
  6. data/data/schemas/ecma/dcmitype.xsd +50 -0
  7. data/data/schemas/ecma/dcterms.xsd +331 -0
  8. data/data/schemas/ecma/opc-coreProperties.xsd +2 -2
  9. data/data/schemas/ecma/xml.xsd +117 -0
  10. data/lib/uniword/builder/bibliography_builder.rb +1 -1
  11. data/lib/uniword/builder/chart_builder.rb +19 -9
  12. data/lib/uniword/builder/comment_anchorer.rb +221 -0
  13. data/lib/uniword/builder/document_builder.rb +97 -6
  14. data/lib/uniword/builder/image_builder.rb +6 -5
  15. data/lib/uniword/builder/run_utils.rb +2 -0
  16. data/lib/uniword/builder.rb +1 -0
  17. data/lib/uniword/cli/fonts_cli.rb +52 -0
  18. data/lib/uniword/cli/main.rb +110 -11
  19. data/lib/uniword/cli/page_cli.rb +85 -0
  20. data/lib/uniword/cli/styles_cli.rb +204 -0
  21. data/lib/uniword/cli/theme_cli.rb +88 -0
  22. data/lib/uniword/cli/toc_cli.rb +22 -2
  23. data/lib/uniword/comment.rb +20 -15
  24. data/lib/uniword/comment_range.rb +3 -3
  25. data/lib/uniword/comments_part.rb +51 -19
  26. data/lib/uniword/configuration/configuration_loader.rb +5 -3
  27. data/lib/uniword/configuration.rb +93 -1
  28. data/lib/uniword/content_types.rb +19 -39
  29. data/lib/uniword/document_factory.rb +9 -1
  30. data/lib/uniword/document_writer.rb +16 -5
  31. data/lib/uniword/docx/chart_part.rb +34 -0
  32. data/lib/uniword/docx/custom_xml_item.rb +83 -0
  33. data/lib/uniword/docx/header_footer_part.rb +140 -0
  34. data/lib/uniword/docx/header_footer_part_collection.rb +135 -0
  35. data/lib/uniword/docx/header_footer_view.rb +225 -0
  36. data/lib/uniword/docx/id_allocator.rb +130 -36
  37. data/lib/uniword/docx/package.rb +223 -35
  38. data/lib/uniword/docx/package_defaults.rb +58 -78
  39. data/lib/uniword/docx/package_integrity_checker.rb +312 -0
  40. data/lib/uniword/docx/package_serialization.rb +103 -231
  41. data/lib/uniword/docx/part.rb +106 -0
  42. data/lib/uniword/docx/part_collection.rb +123 -0
  43. data/lib/uniword/docx/reconciler/body.rb +59 -68
  44. data/lib/uniword/docx/reconciler/fix.rb +46 -0
  45. data/lib/uniword/docx/reconciler/fix_codes.rb +37 -30
  46. data/lib/uniword/docx/reconciler/helpers.rb +9 -1
  47. data/lib/uniword/docx/reconciler/notes.rb +17 -8
  48. data/lib/uniword/docx/reconciler/package_structure.rb +169 -221
  49. data/lib/uniword/docx/reconciler/parts.rb +36 -13
  50. data/lib/uniword/docx/reconciler/referential_integrity.rb +297 -123
  51. data/lib/uniword/docx/reconciler/tables.rb +78 -16
  52. data/lib/uniword/docx/reconciler/theme.rb +7 -4
  53. data/lib/uniword/docx/reconciler.rb +36 -14
  54. data/lib/uniword/docx.rb +10 -0
  55. data/lib/uniword/drawingml/blip.rb +0 -1
  56. data/lib/uniword/drawingml/color_scheme.rb +5 -6
  57. data/lib/uniword/drawingml/font_scheme.rb +4 -8
  58. data/lib/uniword/drawingml/theme.rb +12 -6
  59. data/lib/uniword/errors.rb +8 -1
  60. data/lib/uniword/footer.rb +4 -0
  61. data/lib/uniword/header.rb +4 -0
  62. data/lib/uniword/hyperlink.rb +1 -1
  63. data/lib/uniword/image.rb +6 -6
  64. data/lib/uniword/lazy_loader.rb +1 -2
  65. data/lib/uniword/model_attribute_access.rb +20 -4
  66. data/lib/uniword/ooxml/dotx_package.rb +42 -2
  67. data/lib/uniword/ooxml/part_definition.rb +171 -0
  68. data/lib/uniword/ooxml/part_registry.rb +311 -0
  69. data/lib/uniword/ooxml/relationships/image_relationship.rb +1 -1
  70. data/lib/uniword/ooxml/relationships/package_relationships.rb +20 -22
  71. data/lib/uniword/ooxml/schema/element_serializer.rb +8 -7
  72. data/lib/uniword/ooxml/types/hex_color_value.rb +38 -0
  73. data/lib/uniword/ooxml/types/ooxml_boolean.rb +27 -14
  74. data/lib/uniword/ooxml/types/ooxml_boolean_optional.rb +21 -16
  75. data/lib/uniword/ooxml/types/theme_color_value.rb +22 -0
  76. data/lib/uniword/ooxml/types/unsigned_decimal_number.rb +30 -0
  77. data/lib/uniword/ooxml/types.rb +10 -0
  78. data/lib/uniword/ooxml.rb +2 -0
  79. data/lib/uniword/properties/alignment.rb +8 -3
  80. data/lib/uniword/properties/border.rb +52 -6
  81. data/lib/uniword/properties/cell_vertical_align.rb +4 -1
  82. data/lib/uniword/properties/color_value.rb +8 -3
  83. data/lib/uniword/properties/highlight.rb +9 -5
  84. data/lib/uniword/properties/shading.rb +4 -3
  85. data/lib/uniword/properties/tab_stop.rb +6 -1
  86. data/lib/uniword/properties/table_justification.rb +4 -1
  87. data/lib/uniword/properties/underline.rb +4 -2
  88. data/lib/uniword/properties/vertical_align.rb +6 -3
  89. data/lib/uniword/review/review_manager.rb +23 -9
  90. data/lib/uniword/revision.rb +9 -9
  91. data/lib/uniword/schema/model_generator.rb +31 -15
  92. data/lib/uniword/shared_types/hex_color.rb +4 -1
  93. data/lib/uniword/shared_types/pixel_measure.rb +4 -1
  94. data/lib/uniword/shared_types/point_measure.rb +4 -1
  95. data/lib/uniword/shared_types/text_alignment.rb +6 -1
  96. data/lib/uniword/shared_types/twips_measure.rb +4 -1
  97. data/lib/uniword/spreadsheetml/phonetic_pr.rb +1 -1
  98. data/lib/uniword/spreadsheetml/shared_string_table.rb +2 -2
  99. data/lib/uniword/spreadsheetml/table_formula.rb +1 -1
  100. data/lib/uniword/template/variable_resolver.rb +40 -7
  101. data/lib/uniword/themes/theme_transformation.rb +55 -41
  102. data/lib/uniword/toc/toc_generator.rb +2 -0
  103. data/lib/uniword/validation/engine.rb +35 -0
  104. data/lib/uniword/validation/link_checker.rb +1 -1
  105. data/lib/uniword/validation/opc_validator.rb +0 -1
  106. data/lib/uniword/validation/report/layer_result.rb +0 -1
  107. data/lib/uniword/validation/report/terminal_formatter.rb +0 -1
  108. data/lib/uniword/validation/report/verification_report.rb +0 -2
  109. data/lib/uniword/validation/report.rb +20 -0
  110. data/lib/uniword/validation/rules/base.rb +10 -2
  111. data/lib/uniword/validation/rules/bookmark_pairing_rule.rb +38 -0
  112. data/lib/uniword/validation/rules/bookmark_uniqueness_rule.rb +48 -0
  113. data/lib/uniword/validation/rules/bookmarks_rule.rb +0 -2
  114. data/lib/uniword/validation/rules/content_types_coverage_rule.rb +0 -2
  115. data/lib/uniword/validation/rules/core_properties_namespace_rule.rb +0 -2
  116. data/lib/uniword/validation/rules/document_body_rule.rb +25 -0
  117. data/lib/uniword/validation/rules/document_context.rb +7 -0
  118. data/lib/uniword/validation/rules/empty_paragraphs_rule.rb +27 -0
  119. data/lib/uniword/validation/rules/font_table_signature_rule.rb +0 -2
  120. data/lib/uniword/validation/rules/fonts_rule.rb +0 -2
  121. data/lib/uniword/validation/rules/footnotes_rule.rb +0 -2
  122. data/lib/uniword/validation/rules/headers_footers_rule.rb +0 -2
  123. data/lib/uniword/validation/rules/images_rule.rb +0 -2
  124. data/lib/uniword/validation/rules/mc_ignorable_namespace_rule.rb +0 -2
  125. data/lib/uniword/validation/rules/model_context.rb +32 -0
  126. data/lib/uniword/validation/rules/model_rule.rb +34 -0
  127. data/lib/uniword/validation/rules/numbering_preservation_rule.rb +0 -2
  128. data/lib/uniword/validation/rules/numbering_rule.rb +0 -2
  129. data/lib/uniword/validation/rules/relationship_integrity_rule.rb +0 -1
  130. data/lib/uniword/validation/rules/rsid_rule.rb +0 -2
  131. data/lib/uniword/validation/rules/section_properties_rule.rb +0 -2
  132. data/lib/uniword/validation/rules/settings_rule.rb +0 -2
  133. data/lib/uniword/validation/rules/settings_values_rule.rb +0 -2
  134. data/lib/uniword/validation/rules/style_references_rule.rb +0 -2
  135. data/lib/uniword/validation/rules/table_grid_rule.rb +27 -0
  136. data/lib/uniword/validation/rules/table_properties_rule.rb +27 -0
  137. data/lib/uniword/validation/rules/tables_rule.rb +0 -2
  138. data/lib/uniword/validation/rules/theme_completeness_rule.rb +0 -2
  139. data/lib/uniword/validation/rules/theme_rule.rb +0 -2
  140. data/lib/uniword/validation/rules.rb +61 -23
  141. data/lib/uniword/validation/schema_registry.rb +11 -0
  142. data/lib/uniword/validation/validators/document_semantics_validator.rb +1 -9
  143. data/lib/uniword/validation/validators/xml_schema_validator.rb +0 -2
  144. data/lib/uniword/validation/validators.rb +0 -9
  145. data/lib/uniword/validation/verify_orchestrator.rb +0 -7
  146. data/lib/uniword/validation.rb +7 -2
  147. data/lib/uniword/version.rb +1 -1
  148. data/lib/uniword/vml/imagedata.rb +0 -1
  149. data/lib/uniword/wordprocessingml/attached_template.rb +0 -1
  150. data/lib/uniword/wordprocessingml/deleted_text.rb +1 -1
  151. data/lib/uniword/wordprocessingml/document_root.rb +211 -21
  152. data/lib/uniword/wordprocessingml/endnotes.rb +4 -0
  153. data/lib/uniword/wordprocessingml/font_replacer.rb +147 -0
  154. data/lib/uniword/wordprocessingml/footnotes.rb +4 -0
  155. data/lib/uniword/wordprocessingml/hdr_shape_defaults.rb +0 -1
  156. data/lib/uniword/wordprocessingml/hyperlink.rb +0 -1
  157. data/lib/uniword/wordprocessingml/level.rb +6 -20
  158. data/lib/uniword/wordprocessingml/math_pr.rb +0 -11
  159. data/lib/uniword/wordprocessingml/numbering_definition.rb +16 -8
  160. data/lib/uniword/wordprocessingml/page_setup.rb +181 -0
  161. data/lib/uniword/wordprocessingml/paragraph_properties.rb +33 -28
  162. data/lib/uniword/wordprocessingml/rsids.rb +0 -2
  163. data/lib/uniword/wordprocessingml/run.rb +3 -0
  164. data/lib/uniword/wordprocessingml/section_properties.rb +2 -2
  165. data/lib/uniword/wordprocessingml/settings.rb +8 -34
  166. data/lib/uniword/wordprocessingml/shape_defaults.rb +0 -1
  167. data/lib/uniword/wordprocessingml/style.rb +2 -1
  168. data/lib/uniword/wordprocessingml/style_cleanup.rb +198 -0
  169. data/lib/uniword/wordprocessingml/table_cell_properties.rb +6 -6
  170. data/lib/uniword/wordprocessingml/update_fields.rb +27 -0
  171. data/lib/uniword/wordprocessingml/w14_attributes.rb +30 -2
  172. data/lib/uniword/wordprocessingml.rb +4 -0
  173. data/lib/uniword.rb +27 -2
  174. metadata +38 -19
  175. data/config/validation_rules.yml +0 -60
  176. data/config/warning_rules.yml +0 -57
  177. data/lib/uniword/validation/document_validator.rb +0 -272
  178. data/lib/uniword/validation/structural_validator.rb +0 -116
  179. data/lib/uniword/validation/validators/content_type_validator.rb +0 -165
  180. data/lib/uniword/validation/validators/file_structure_validator.rb +0 -104
  181. data/lib/uniword/validation/validators/ooxml_part_validator.rb +0 -128
  182. data/lib/uniword/validation/validators/relationship_validator.rb +0 -147
  183. data/lib/uniword/validation/validators/zip_integrity_validator.rb +0 -110
  184. data/lib/uniword/validators/element_validator.rb +0 -93
  185. data/lib/uniword/validators/paragraph_validator.rb +0 -116
  186. data/lib/uniword/validators/table_validator.rb +0 -134
  187. data/lib/uniword/validators.rb +0 -9
  188. data/lib/uniword/warnings/warning.rb +0 -130
  189. data/lib/uniword/warnings/warning_collector.rb +0 -234
  190. data/lib/uniword/warnings/warning_report.rb +0 -159
  191. data/lib/uniword/warnings.rb +0 -9
@@ -0,0 +1,331 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:dcmitype="http://purl.org/dc/dcmitype/"
5
+ targetNamespace="http://purl.org/dc/terms/"
6
+ xmlns="http://purl.org/dc/terms/"
7
+ elementFormDefault="qualified"
8
+ attributeFormDefault="unqualified">
9
+
10
+ <xs:annotation>
11
+ <xs:documentation xml:lang="en">
12
+ DCterms XML Schema
13
+ XML Schema for http://purl.org/dc/terms/ namespace
14
+
15
+ Created 2003-04-02
16
+
17
+ Created by
18
+
19
+ Tim Cole (t-cole3@uiuc.edu)
20
+ Tom Habing (thabing@uiuc.edu)
21
+ Jane Hunter (jane@dstc.edu.au)
22
+ Pete Johnston (p.johnston@ukoln.ac.uk),
23
+ Carl Lagoze (lagoze@cs.cornell.edu)
24
+
25
+ This schema declares XML elements for the DC elements and
26
+ DC element refinements from the http://purl.org/dc/terms/ namespace.
27
+
28
+ It reuses the complexType dc:SimpleLiteral, imported from the dc.xsd
29
+ schema, which permits simple element content, and makes the xml:lang
30
+ attribute available.
31
+
32
+ This complexType permits the derivation of other complexTypes
33
+ which would permit child elements.
34
+
35
+ DC elements are declared as substitutable for the abstract element dc:any, and
36
+ DC element refinements are defined as substitutable for the base elements
37
+ which they refine.
38
+
39
+ This means that the default type for all XML elements (i.e. all DC elements and
40
+ element refinements) is dc:SimpleLiteral.
41
+
42
+ Encoding schemes are defined as complexTypes which are restrictions
43
+ of the dc:SimpleLiteral complexType. These complexTypes restrict
44
+ values to an appropriates syntax or format using data typing,
45
+ regular expressions, or enumerated lists.
46
+
47
+ In order to specify one of these encodings an xsi:type attribute must
48
+ be used in the instance document.
49
+
50
+ Also, note that one shortcoming of this approach is that any type can be
51
+ applied to any of the elements or refinements. There is no convenient way
52
+ to restrict types to specific elements using this approach.
53
+
54
+ </xs:documentation>
55
+
56
+ </xs:annotation>
57
+
58
+
59
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"
60
+ schemaLocation="xml.xsd">
61
+ </xs:import>
62
+
63
+ <xs:import namespace="http://purl.org/dc/elements/1.1/"
64
+ schemaLocation="dc.xsd"/>
65
+
66
+ <xs:import namespace="http://purl.org/dc/dcmitype/"
67
+ schemaLocation="dcmitype.xsd"/>
68
+
69
+ <xs:element name="alternative" substitutionGroup="dc:title"/>
70
+
71
+ <xs:element name="tableOfContents" substitutionGroup="dc:description"/>
72
+ <xs:element name="abstract" substitutionGroup="dc:description"/>
73
+
74
+ <xs:element name="created" substitutionGroup="dc:date"/>
75
+ <xs:element name="valid" substitutionGroup="dc:date"/>
76
+ <xs:element name="available" substitutionGroup="dc:date"/>
77
+ <xs:element name="issued" substitutionGroup="dc:date"/>
78
+ <xs:element name="modified" substitutionGroup="dc:date"/>
79
+ <xs:element name="dateAccepted" substitutionGroup="dc:date"/>
80
+ <xs:element name="dateCopyrighted" substitutionGroup="dc:date"/>
81
+ <xs:element name="dateSubmitted" substitutionGroup="dc:date"/>
82
+
83
+ <xs:element name="extent" substitutionGroup="dc:format"/>
84
+ <xs:element name="medium" substitutionGroup="dc:format"/>
85
+
86
+ <xs:element name="isVersionOf" substitutionGroup="dc:relation"/>
87
+ <xs:element name="hasVersion" substitutionGroup="dc:relation"/>
88
+ <xs:element name="isReplacedBy" substitutionGroup="dc:relation"/>
89
+ <xs:element name="replaces" substitutionGroup="dc:relation"/>
90
+ <xs:element name="isRequiredBy" substitutionGroup="dc:relation"/>
91
+ <xs:element name="requires" substitutionGroup="dc:relation"/>
92
+ <xs:element name="isPartOf" substitutionGroup="dc:relation"/>
93
+ <xs:element name="hasPart" substitutionGroup="dc:relation"/>
94
+ <xs:element name="isReferencedBy" substitutionGroup="dc:relation"/>
95
+ <xs:element name="references" substitutionGroup="dc:relation"/>
96
+ <xs:element name="isFormatOf" substitutionGroup="dc:relation"/>
97
+ <xs:element name="hasFormat" substitutionGroup="dc:relation"/>
98
+ <xs:element name="conformsTo" substitutionGroup="dc:relation"/>
99
+
100
+ <xs:element name="spatial" substitutionGroup="dc:coverage"/>
101
+ <xs:element name="temporal" substitutionGroup="dc:coverage"/>
102
+
103
+ <xs:element name="audience" substitutionGroup="dc:any"/>
104
+
105
+ <xs:element name="mediator" substitutionGroup="audience"/>
106
+ <xs:element name="educationLevel" substitutionGroup="audience"/>
107
+
108
+ <xs:element name="accessRights" substitutionGroup="dc:rights"/>
109
+
110
+ <xs:element name="bibliographicCitation" substitutionGroup="dc:identifier"/>
111
+
112
+ <xs:complexType name="LCSH">
113
+ <xs:simpleContent>
114
+ <xs:restriction base="dc:SimpleLiteral">
115
+ <xs:simpleType>
116
+ <xs:restriction base="xs:string"/>
117
+ </xs:simpleType>
118
+ <xs:attribute ref="xml:lang" use="prohibited"/>
119
+ </xs:restriction>
120
+ </xs:simpleContent>
121
+ </xs:complexType>
122
+
123
+ <xs:complexType name="MESH">
124
+ <xs:simpleContent>
125
+ <xs:restriction base="dc:SimpleLiteral">
126
+ <xs:simpleType>
127
+ <xs:restriction base="xs:string"/>
128
+ </xs:simpleType>
129
+ <xs:attribute ref="xml:lang" use="prohibited"/>
130
+ </xs:restriction>
131
+ </xs:simpleContent>
132
+ </xs:complexType>
133
+
134
+ <xs:complexType name="DDC">
135
+ <xs:simpleContent>
136
+ <xs:restriction base="dc:SimpleLiteral">
137
+ <xs:simpleType>
138
+ <xs:restriction base="xs:string"/>
139
+ </xs:simpleType>
140
+ <xs:attribute ref="xml:lang" use="prohibited"/>
141
+ </xs:restriction>
142
+ </xs:simpleContent>
143
+ </xs:complexType>
144
+
145
+ <xs:complexType name="LCC">
146
+ <xs:simpleContent>
147
+ <xs:restriction base="dc:SimpleLiteral">
148
+ <xs:simpleType>
149
+ <xs:restriction base="xs:string"/>
150
+ </xs:simpleType>
151
+ <xs:attribute ref="xml:lang" use="prohibited"/>
152
+ </xs:restriction>
153
+ </xs:simpleContent>
154
+ </xs:complexType>
155
+
156
+ <xs:complexType name="UDC">
157
+ <xs:simpleContent>
158
+ <xs:restriction base="dc:SimpleLiteral">
159
+ <xs:simpleType>
160
+ <xs:restriction base="xs:string"/>
161
+ </xs:simpleType>
162
+ <xs:attribute ref="xml:lang" use="prohibited"/>
163
+ </xs:restriction>
164
+ </xs:simpleContent>
165
+ </xs:complexType>
166
+
167
+ <xs:complexType name="Period">
168
+ <xs:simpleContent>
169
+ <xs:restriction base="dc:SimpleLiteral">
170
+ <xs:simpleType>
171
+ <xs:restriction base="xs:string"/>
172
+ </xs:simpleType>
173
+ <xs:attribute ref="xml:lang" use="prohibited"/>
174
+ </xs:restriction>
175
+ </xs:simpleContent>
176
+ </xs:complexType>
177
+
178
+ <xs:complexType name="W3CDTF">
179
+ <xs:simpleContent>
180
+ <xs:restriction base="dc:SimpleLiteral">
181
+ <xs:simpleType>
182
+ <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
183
+ </xs:simpleType>
184
+ <xs:attribute ref="xml:lang" use="prohibited"/>
185
+ </xs:restriction>
186
+ </xs:simpleContent>
187
+ </xs:complexType>
188
+
189
+ <xs:complexType name="DCMIType">
190
+ <xs:simpleContent>
191
+ <xs:restriction base="dc:SimpleLiteral">
192
+ <xs:simpleType>
193
+ <xs:restriction base="dcmitype:DCMIType"/>
194
+ </xs:simpleType>
195
+ <xs:attribute ref="xml:lang" use="prohibited"/>
196
+ </xs:restriction>
197
+ </xs:simpleContent>
198
+ </xs:complexType>
199
+
200
+ <xs:complexType name="IMT">
201
+ <xs:simpleContent>
202
+ <xs:restriction base="dc:SimpleLiteral">
203
+ <xs:simpleType>
204
+ <xs:restriction base="xs:string"/>
205
+ </xs:simpleType>
206
+ <xs:attribute ref="xml:lang" use="prohibited"/>
207
+ </xs:restriction>
208
+ </xs:simpleContent>
209
+ </xs:complexType>
210
+
211
+ <xs:complexType name="URI">
212
+ <xs:simpleContent>
213
+ <xs:restriction base="dc:SimpleLiteral">
214
+ <xs:simpleType>
215
+ <xs:restriction base="xs:anyURI"/>
216
+ </xs:simpleType>
217
+ <xs:attribute ref="xml:lang" use="prohibited"/>
218
+ </xs:restriction>
219
+ </xs:simpleContent>
220
+ </xs:complexType>
221
+
222
+ <xs:complexType name="ISO639-2">
223
+ <xs:simpleContent>
224
+ <xs:restriction base="dc:SimpleLiteral">
225
+ <xs:simpleType>
226
+ <xs:restriction base="xs:string"/>
227
+ </xs:simpleType>
228
+ <xs:attribute ref="xml:lang" use="prohibited"/>
229
+ </xs:restriction>
230
+ </xs:simpleContent>
231
+ </xs:complexType>
232
+
233
+ <xs:complexType name="RFC1766">
234
+ <xs:simpleContent>
235
+ <xs:restriction base="dc:SimpleLiteral">
236
+ <xs:simpleType>
237
+ <xs:restriction base="xs:language"/>
238
+ </xs:simpleType>
239
+ <xs:attribute ref="xml:lang" use="prohibited"/>
240
+ </xs:restriction>
241
+ </xs:simpleContent>
242
+ </xs:complexType>
243
+
244
+ <xs:complexType name="RFC3066">
245
+ <xs:simpleContent>
246
+ <xs:restriction base="dc:SimpleLiteral">
247
+ <xs:simpleType>
248
+ <xs:restriction base="xs:language"/>
249
+ </xs:simpleType>
250
+ <xs:attribute ref="xml:lang" use="prohibited"/>
251
+ </xs:restriction>
252
+ </xs:simpleContent>
253
+ </xs:complexType>
254
+
255
+ <xs:complexType name="Point">
256
+ <xs:simpleContent>
257
+ <xs:restriction base="dc:SimpleLiteral">
258
+ <xs:simpleType>
259
+ <xs:restriction base="xs:string"/>
260
+ </xs:simpleType>
261
+ <xs:attribute ref="xml:lang" use="prohibited"/>
262
+ </xs:restriction>
263
+ </xs:simpleContent>
264
+ </xs:complexType>
265
+
266
+ <xs:complexType name="ISO3166">
267
+ <xs:simpleContent>
268
+ <xs:restriction base="dc:SimpleLiteral">
269
+ <xs:simpleType>
270
+ <xs:restriction base="xs:string"/>
271
+ </xs:simpleType>
272
+ <xs:attribute ref="xml:lang" use="prohibited"/>
273
+ </xs:restriction>
274
+ </xs:simpleContent>
275
+ </xs:complexType>
276
+
277
+ <xs:complexType name="Box">
278
+ <xs:simpleContent>
279
+ <xs:restriction base="dc:SimpleLiteral">
280
+ <xs:simpleType>
281
+ <xs:restriction base="xs:string"/>
282
+ </xs:simpleType>
283
+ <xs:attribute ref="xml:lang" use="prohibited"/>
284
+ </xs:restriction>
285
+ </xs:simpleContent>
286
+ </xs:complexType>
287
+
288
+ <xs:complexType name="TGN">
289
+ <xs:simpleContent>
290
+ <xs:restriction base="dc:SimpleLiteral">
291
+ <xs:simpleType>
292
+ <xs:restriction base="xs:string"/>
293
+ </xs:simpleType>
294
+ <xs:attribute ref="xml:lang" use="prohibited"/>
295
+ </xs:restriction>
296
+ </xs:simpleContent>
297
+ </xs:complexType>
298
+
299
+ <xs:group name="elementsAndRefinementsGroup">
300
+ <xs:annotation>
301
+ <xs:documentation xml:lang="en">
302
+ This group is included as a convenience for schema authors
303
+ who need to refer to all the DC elements and element refinements
304
+ in the http://purl.org/dc/elements/1.1/ and
305
+ http://purl.org/dc/terms namespaces.
306
+ N.B. Refinements available via substitution groups.
307
+ </xs:documentation>
308
+ </xs:annotation>
309
+
310
+ <xs:sequence>
311
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
312
+ <xs:element ref="dc:any" />
313
+ </xs:choice>
314
+ </xs:sequence>
315
+ </xs:group>
316
+
317
+ <xs:complexType name="elementOrRefinementContainer">
318
+ <xs:annotation>
319
+ <xs:documentation xml:lang="en">
320
+ This is included as a convenience for schema authors who need to define a root
321
+ or container element for all of the DC elements and element refinements.
322
+ </xs:documentation>
323
+ </xs:annotation>
324
+
325
+ <xs:choice>
326
+ <xs:group ref="elementsAndRefinementsGroup"/>
327
+ </xs:choice>
328
+ </xs:complexType>
329
+
330
+
331
+ </xs:schema>
@@ -5,9 +5,9 @@
5
5
  xmlns:dcterms="http://purl.org/dc/terms/" elementFormDefault="qualified" blockDefault="#all">
6
6
 
7
7
  <xs:import namespace="http://purl.org/dc/elements/1.1/"
8
- schemaLocation="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd"/>
8
+ schemaLocation="dc.xsd"/>
9
9
  <xs:import namespace="http://purl.org/dc/terms/"
10
- schemaLocation="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd"/>
10
+ schemaLocation="dcterms.xsd"/>
11
11
  <xs:import id="xml" namespace="http://www.w3.org/XML/1998/namespace"/>
12
12
 
13
13
  <xs:element name="coreProperties" type="CT_CoreProperties"/>
@@ -0,0 +1,117 @@
1
+ <?xml version='1.0'?>
2
+ <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >
3
+ <xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">
4
+
5
+ <xs:annotation>
6
+ <xs:documentation>
7
+ See http://www.w3.org/XML/1998/namespace.html and
8
+ http://www.w3.org/TR/REC-xml for information about this namespace.
9
+
10
+ This schema document describes the XML namespace, in a form
11
+ suitable for import by other schema documents.
12
+
13
+ Note that local names in this namespace are intended to be defined
14
+ only by the World Wide Web Consortium or its subgroups. The
15
+ following names are currently defined in this namespace and should
16
+ not be used with conflicting semantics by any Working Group,
17
+ specification, or document instance:
18
+
19
+ base (as an attribute name): denotes an attribute whose value
20
+ provides a URI to be used as the base for interpreting any
21
+ relative URIs in the scope of the element on which it
22
+ appears; its value is inherited. This name is reserved
23
+ by virtue of its definition in the XML Base specification.
24
+
25
+ lang (as an attribute name): denotes an attribute whose value
26
+ is a language code for the natural language of the content of
27
+ any element; its value is inherited. This name is reserved
28
+ by virtue of its definition in the XML specification.
29
+
30
+ space (as an attribute name): denotes an attribute whose
31
+ value is a keyword indicating what whitespace processing
32
+ discipline is intended for the content of the element; its
33
+ value is inherited. This name is reserved by virtue of its
34
+ definition in the XML specification.
35
+
36
+ Father (in any context at all): denotes Jon Bosak, the chair of
37
+ the original XML Working Group. This name is reserved by
38
+ the following decision of the W3C XML Plenary and
39
+ XML Coordination groups:
40
+
41
+ In appreciation for his vision, leadership and dedication
42
+ the W3C XML Plenary on this 10th day of February, 2000
43
+ reserves for Jon Bosak in perpetuity the XML name
44
+ xml:Father
45
+ </xs:documentation>
46
+ </xs:annotation>
47
+
48
+ <xs:annotation>
49
+ <xs:documentation>This schema defines attributes and an attribute group
50
+ suitable for use by
51
+ schemas wishing to allow xml:base, xml:lang or xml:space attributes
52
+ on elements they define.
53
+
54
+ To enable this, such a schema must import this schema
55
+ for the XML namespace, e.g. as follows:
56
+ &lt;schema . . .>
57
+ . . .
58
+ &lt;import namespace="http://www.w3.org/XML/1998/namespace"
59
+ schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
60
+
61
+ Subsequently, qualified reference to any of the attributes
62
+ or the group defined below will have the desired effect, e.g.
63
+
64
+ &lt;type . . .>
65
+ . . .
66
+ &lt;attributeGroup ref="xml:specialAttrs"/>
67
+
68
+ will define a type which will schema-validate an instance
69
+ element with any of those attributes</xs:documentation>
70
+ </xs:annotation>
71
+
72
+ <xs:annotation>
73
+ <xs:documentation>In keeping with the XML Schema WG's standard versioning
74
+ policy, this schema document will persist at
75
+ http://www.w3.org/2001/03/xml.xsd.
76
+ At the date of issue it can also be found at
77
+ http://www.w3.org/2001/xml.xsd.
78
+ The schema document at that URI may however change in the future,
79
+ in order to remain compatible with the latest version of XML Schema
80
+ itself. In other words, if the XML Schema namespace changes, the version
81
+ of this document at
82
+ http://www.w3.org/2001/xml.xsd will change
83
+ accordingly; the version at
84
+ http://www.w3.org/2001/03/xml.xsd will not change.
85
+ </xs:documentation>
86
+ </xs:annotation>
87
+
88
+ <xs:attribute name="lang" type="xs:language">
89
+ <xs:annotation>
90
+ <xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter
91
+ codes as the enumerated possible values . . .</xs:documentation>
92
+ </xs:annotation>
93
+ </xs:attribute>
94
+
95
+ <xs:attribute name="space" default="preserve">
96
+ <xs:simpleType>
97
+ <xs:restriction base="xs:NCName">
98
+ <xs:enumeration value="default"/>
99
+ <xs:enumeration value="preserve"/>
100
+ </xs:restriction>
101
+ </xs:simpleType>
102
+ </xs:attribute>
103
+
104
+ <xs:attribute name="base" type="xs:anyURI">
105
+ <xs:annotation>
106
+ <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
107
+ information about this attribute.</xs:documentation>
108
+ </xs:annotation>
109
+ </xs:attribute>
110
+
111
+ <xs:attributeGroup name="specialAttrs">
112
+ <xs:attribute ref="xml:base"/>
113
+ <xs:attribute ref="xml:lang"/>
114
+ <xs:attribute ref="xml:space"/>
115
+ </xs:attributeGroup>
116
+
117
+ </xs:schema>
@@ -20,7 +20,7 @@ module Uniword
20
20
  # doc.paragraph { |p| p << SdtBuilder.bibliography.build }
21
21
  class BibliographyBuilder
22
22
  CHART_REL_TYPE =
23
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography"
23
+ Ooxml::PartRegistry.find_by_key(:bibliography).rel_type
24
24
 
25
25
  attr_reader :sources
26
26
 
@@ -28,11 +28,9 @@ module Uniword
28
28
  # end
29
29
  class ChartBuilder
30
30
  CHART_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart"
31
- CHART_REL_TYPE =
32
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
31
+ CHART_REL_TYPE = Ooxml::PartRegistry.find_by_key(:chart).rel_type
33
32
  CHART_CONTENT_TYPE =
34
- "application/vnd.openxmlformats-officedocument." \
35
- "drawingml.chart+xml"
33
+ Ooxml::PartRegistry.find_by_key(:chart).content_type
36
34
 
37
35
  attr_reader :chart_type, :title_text, :series_list
38
36
 
@@ -117,25 +115,37 @@ module Uniword
117
115
 
118
116
  # Register chart on a document and create the Drawing element
119
117
  #
118
+ # The relationship id comes from the document's IdAllocator
119
+ # (single authority), so the c:chart reference and the assembled
120
+ # document relationship always agree.
121
+ #
120
122
  # @param document [DocumentBuilder, DocumentRoot] Target document
121
123
  # @return [Wordprocessingml::Drawing]
122
124
  def build_drawing(document)
123
125
  root = document.is_a?(Uniword::Builder::DocumentBuilder) ? document.model : document
126
+ create_drawing(register_chart_part(root))
127
+ end
128
+
129
+ private
130
+
131
+ # Store the chart XML as a chart part keyed by its allocated rId.
132
+ #
133
+ # @param root [Wordprocessingml::DocumentRoot] target document
134
+ # @return [String] relationship id of the chart part
135
+ def register_chart_part(root)
124
136
  root.chart_parts ||= {}
137
+ root.allocator ||= Docx::IdAllocator.new
125
138
 
126
- r_id = "rIdChart#{root.chart_parts.size + 1}"
127
139
  target = "charts/chart#{root.chart_parts.size + 1}.xml"
140
+ r_id = root.allocator.alloc_rid(target: target, type: CHART_REL_TYPE)
128
141
 
129
142
  root.chart_parts[r_id] = {
130
143
  xml: build_xml,
131
144
  target: target,
132
145
  }
133
-
134
- create_drawing(r_id)
146
+ r_id
135
147
  end
136
148
 
137
- private
138
-
139
149
  include DeterministicId
140
150
 
141
151
  # Build the inner chart XML