goldendocx 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +8 -2
- data/Gemfile.lock +3 -1
- data/README.md +10 -2
- data/Rakefile +14 -3
- data/demo/tables/create_embed_image_table.rb +3 -3
- data/demo/templates/generate_codes.rb +10 -0
- data/demo/templates/xml_to_class.rb +97 -0
- data/demo/texts/append_plain_text.rb +1 -1
- data/demo/texts/append_styled_text.rb +1 -2
- data/demo/texts/create_text.rb +14 -0
- data/lib/extensions/active_support_extensions.rb +16 -0
- data/lib/extensions/nokogiri_extensions.rb +41 -0
- data/lib/extensions/ox_extensions.rb +35 -0
- data/lib/extensions/xml_serialize_extensions.rb +45 -0
- data/lib/goldendocx/charts/properties.rb +1 -1
- data/lib/goldendocx/charts/series.rb +2 -2
- data/lib/goldendocx/charts.rb +1 -1
- data/lib/goldendocx/components/bar_chart.rb +2 -2
- data/lib/goldendocx/components/chart.rb +6 -6
- data/lib/goldendocx/components/column_chart.rb +2 -2
- data/lib/goldendocx/components/doughnut_chart.rb +2 -2
- data/lib/goldendocx/components/line_chart.rb +2 -2
- data/lib/goldendocx/components/properties/font_property.rb +19 -0
- data/lib/goldendocx/components/properties/language_property.rb +18 -0
- data/lib/goldendocx/components/properties/run_property.rb +2 -0
- data/lib/goldendocx/components/properties.rb +1 -1
- data/lib/goldendocx/components/table.rb +2 -2
- data/lib/goldendocx/components.rb +1 -1
- data/lib/goldendocx/content_types/default.rb +2 -6
- data/lib/goldendocx/content_types/override.rb +2 -6
- data/lib/goldendocx/document.rb +9 -28
- data/lib/goldendocx/documents/body.rb +23 -14
- data/lib/goldendocx/documents/document.rb +2 -4
- data/lib/goldendocx/documents/latent_styles.rb +12 -0
- data/lib/goldendocx/documents/properties/default_style_property.rb +17 -0
- data/lib/goldendocx/documents/properties/page_margin_property.rb +37 -0
- data/lib/goldendocx/documents/properties/page_size_property.rb +17 -0
- data/lib/goldendocx/documents/properties/paragraph_default_style_property.rb +16 -0
- data/lib/goldendocx/documents/properties/run_default_style_property.rb +22 -0
- data/lib/goldendocx/documents/properties/section_property.rb +17 -0
- data/lib/goldendocx/documents/properties/style_name_property.rb +16 -0
- data/lib/goldendocx/documents/properties.rb +12 -0
- data/lib/goldendocx/documents/settings.rb +23 -0
- data/lib/goldendocx/documents/style.rb +10 -10
- data/lib/goldendocx/documents/styles.rb +9 -33
- data/lib/goldendocx/documents.rb +1 -1
- data/lib/goldendocx/docx.rb +55 -12
- data/lib/goldendocx/element.rb +33 -140
- data/lib/goldendocx/has_associations.rb +54 -0
- data/lib/goldendocx/has_attributes.rb +67 -0
- data/lib/goldendocx/has_children.rb +116 -0
- data/lib/goldendocx/images/picture.rb +1 -1
- data/lib/goldendocx/images/properties.rb +1 -1
- data/lib/goldendocx/images.rb +1 -1
- data/lib/goldendocx/{documents → models}/relationship.rb +1 -1
- data/lib/goldendocx/models/relationships.rb +31 -0
- data/lib/goldendocx/models.rb +10 -0
- data/lib/goldendocx/parts/app.rb +46 -0
- data/lib/goldendocx/parts/content_types.rb +16 -30
- data/lib/goldendocx/parts/core.rb +46 -0
- data/lib/goldendocx/parts/documents.rb +27 -14
- data/lib/goldendocx/parts/media.rb +1 -1
- data/lib/goldendocx/parts/properties/created_at_property.rb +17 -0
- data/lib/goldendocx/parts/properties/creator_property.rb +16 -0
- data/lib/goldendocx/parts/properties/revision_property.rb +16 -0
- data/lib/goldendocx/parts/properties/updated_at_property.rb +17 -0
- data/lib/goldendocx/parts/properties/updater_property.rb +16 -0
- data/lib/goldendocx/parts/properties.rb +12 -0
- data/lib/goldendocx/parts.rb +1 -1
- data/lib/goldendocx/tables/header_cell.rb +1 -1
- data/lib/goldendocx/tables/properties.rb +1 -1
- data/lib/goldendocx/tables/row.rb +1 -1
- data/lib/goldendocx/tables.rb +1 -1
- data/lib/goldendocx/version.rb +1 -1
- data/lib/goldendocx/xml_serializers/nokogiri.rb +32 -24
- data/lib/goldendocx/xml_serializers/ox.rb +15 -25
- data/lib/goldendocx.rb +14 -2
- metadata +54 -9
- data/lib/goldendocx/documents/element.rb +0 -23
- data/lib/goldendocx/documents/relationships.rb +0 -39
- data/lib/goldendocx/documents/unparsed_style.rb +0 -17
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Goldendocx
|
4
|
+
module Parts
|
5
|
+
class Core
|
6
|
+
include Goldendocx::Document
|
7
|
+
|
8
|
+
TYPE = 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties'
|
9
|
+
XML_PATH = 'docProps/core.xml'
|
10
|
+
NAMESPACE = 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'
|
11
|
+
CONTENT_TYPE = 'application/vnd.openxmlformats-package.core-properties+xml'
|
12
|
+
|
13
|
+
concern_namespaces :cp, :dc, :dcterms, :dcmitype, :xsi
|
14
|
+
|
15
|
+
namespace :cp
|
16
|
+
tag :coreProperties
|
17
|
+
|
18
|
+
embeds_one :creator, class_name: 'Goldendocx::Parts::Properties::CreatorProperty'
|
19
|
+
embeds_one :created_at, class_name: 'Goldendocx::Parts::Properties::CreatedAtProperty'
|
20
|
+
embeds_one :revision, class_name: 'Goldendocx::Parts::Properties::RevisionProperty'
|
21
|
+
embeds_one :updater, class_name: 'Goldendocx::Parts::Properties::UpdaterProperty'
|
22
|
+
embeds_one :updated_at, class_name: 'Goldendocx::Parts::Properties::UpdatedAtProperty'
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def read_from(xml_node)
|
26
|
+
core = super(xml_node)
|
27
|
+
revision = (core.revision || core.build_revision)
|
28
|
+
revision.value = revision.value.to_i + 1
|
29
|
+
core.build_updater(name: "Goldendocx_#{Goldendocx::VERSION}")
|
30
|
+
core.build_updated_at(timestamp: Time.now)
|
31
|
+
core
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
build_creator(name: "Goldendocx_#{Goldendocx::VERSION}")
|
37
|
+
build_created_at(timestamp: Time.now)
|
38
|
+
end
|
39
|
+
|
40
|
+
def write_to(zos)
|
41
|
+
zos.put_next_entry XML_PATH
|
42
|
+
zos.write to_document_xml
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -4,37 +4,50 @@
|
|
4
4
|
module Goldendocx
|
5
5
|
module Parts
|
6
6
|
class Documents
|
7
|
+
include Goldendocx::HasAssociations
|
8
|
+
|
7
9
|
XML_PATH = 'word/'
|
10
|
+
RELATIONSHIPS_XML_PATH = 'word/_rels/document.xml.rels'
|
8
11
|
|
9
12
|
attr_reader :document, # document.xml
|
10
|
-
:styles, # styles.xml
|
11
|
-
:relationships, # _rels/document.xml.rels
|
12
13
|
:charts, # charts/
|
13
14
|
:medias # New Medias to media/
|
14
15
|
|
15
16
|
attr_accessor :media_amount # Entries amount in directory media/ for generating relationship id
|
16
17
|
|
18
|
+
relationships_at RELATIONSHIPS_XML_PATH
|
19
|
+
associate :styles, class_name: 'Goldendocx::Documents::Styles'
|
20
|
+
associate :settings, class_name: 'Goldendocx::Documents::Settings'
|
21
|
+
associate :document, class_name: 'Goldendocx::Documents::Document', isolate: true
|
22
|
+
|
17
23
|
class << self
|
18
24
|
def read_from(docx_file)
|
19
25
|
parts = Goldendocx::Parts::Documents.new
|
20
|
-
parts.
|
21
|
-
parts.
|
22
|
-
parts.relationships.read_from(docx_file)
|
26
|
+
parts.read_relationships(docx_file)
|
27
|
+
parts.read_associations(docx_file)
|
23
28
|
parts.media_amount = docx_file.entries.count { |entry| entry.name.start_with?('word/media/') }
|
24
29
|
parts
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
28
33
|
def initialize
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
associations.each do |association, options|
|
35
|
+
association_class = options.class_name.constantize
|
36
|
+
instance_variable_set("@#{association}", association_class.new)
|
37
|
+
add_relationship association_class::TYPE, association_class::XML_PATH.gsub(XML_PATH, '') unless options.isolate
|
38
|
+
end
|
39
|
+
|
32
40
|
@medias = []
|
41
|
+
@media_amount = 0
|
33
42
|
end
|
34
43
|
|
35
44
|
def write_stream(zos)
|
36
|
-
|
37
|
-
|
45
|
+
write_relationships(zos)
|
46
|
+
|
47
|
+
associations.each_key do |association|
|
48
|
+
send(association).write_to(zos)
|
49
|
+
end
|
50
|
+
|
38
51
|
document.write_to(zos)
|
39
52
|
medias.each { |media| media.write_to(zos) }
|
40
53
|
document.body.charts.each { |chart| chart.write_to(zos) }
|
@@ -60,14 +73,14 @@ module Goldendocx
|
|
60
73
|
|
61
74
|
def create_image(image_data, options = {})
|
62
75
|
image_media = add_image_media(image_data, options)
|
63
|
-
relationship_id =
|
76
|
+
relationship_id = add_relationship(image_media.type, image_media.target)
|
64
77
|
|
65
78
|
document.body.create_image(relationship_id, options)
|
66
79
|
end
|
67
80
|
|
68
81
|
def create_embed_image(image_data, options = {})
|
69
82
|
image_media = add_image_media(image_data, options)
|
70
|
-
relationship_id =
|
83
|
+
relationship_id = add_relationship(image_media.type, image_media.target)
|
71
84
|
|
72
85
|
document.body.create_embed_image(relationship_id, options)
|
73
86
|
end
|
@@ -87,12 +100,12 @@ module Goldendocx
|
|
87
100
|
|
88
101
|
chart_id = document.body.charts.size + 1
|
89
102
|
|
90
|
-
relationship_id =
|
103
|
+
relationship_id = add_relationship(
|
91
104
|
Goldendocx::Charts::RELATIONSHIP_TYPE,
|
92
105
|
format(Goldendocx::Charts::RELATIONSHIP_NAME_PATTERN, id: chart_id)
|
93
106
|
)
|
94
107
|
|
95
|
-
document.body.create_chart(chart_type, chart_id, relationship_id, width
|
108
|
+
document.body.create_chart(chart_type, chart_id, relationship_id, width:, height:)
|
96
109
|
end
|
97
110
|
|
98
111
|
def add_style(fragment)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Goldendocx
|
4
|
+
module Parts
|
5
|
+
module Properties
|
6
|
+
class CreatedAtProperty
|
7
|
+
include Goldendocx::Element
|
8
|
+
|
9
|
+
namespace :dcterms
|
10
|
+
tag :created
|
11
|
+
|
12
|
+
attribute :type, namespace: :xsi, default: 'dcterms:W3CDTF'
|
13
|
+
embeds_one :timestamp, class_name: 'Time'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Goldendocx
|
4
|
+
module Parts
|
5
|
+
module Properties
|
6
|
+
class RevisionProperty
|
7
|
+
include Goldendocx::Element
|
8
|
+
|
9
|
+
namespace :cp
|
10
|
+
tag :revision
|
11
|
+
|
12
|
+
embeds_one :value, class_name: 'Integer'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Goldendocx
|
4
|
+
module Parts
|
5
|
+
module Properties
|
6
|
+
class UpdatedAtProperty
|
7
|
+
include Goldendocx::Element
|
8
|
+
|
9
|
+
namespace :dcterms
|
10
|
+
tag :modified
|
11
|
+
|
12
|
+
attribute :type, namespace: :xsi, default: 'dcterms:W3CDTF'
|
13
|
+
embeds_one :timestamp, class_name: 'Time'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Goldendocx
|
4
|
+
module Parts
|
5
|
+
module Properties
|
6
|
+
class UpdaterProperty
|
7
|
+
include Goldendocx::Element
|
8
|
+
|
9
|
+
namespace :cp
|
10
|
+
tag :lastModifiedBy
|
11
|
+
|
12
|
+
embeds_one :name, class_name: 'String'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/goldendocx/parts.rb
CHANGED
@@ -18,7 +18,7 @@ module Goldendocx
|
|
18
18
|
def add_cell(data)
|
19
19
|
cell = case data
|
20
20
|
when Goldendocx::Tables::Cell then data
|
21
|
-
when Hash then Goldendocx::Tables::Cell.new(data)
|
21
|
+
when Hash then Goldendocx::Tables::Cell.new(**data)
|
22
22
|
else Goldendocx::Tables::Cell.new(content: data.to_s)
|
23
23
|
end
|
24
24
|
cells << cell
|
data/lib/goldendocx/tables.rb
CHANGED
@@ -14,6 +14,6 @@ require 'goldendocx/tables/properties'
|
|
14
14
|
require 'goldendocx/tables/row'
|
15
15
|
require 'goldendocx/tables/cell'
|
16
16
|
|
17
|
-
Dir.glob(File.join(File.dirname(__FILE__), 'tables', '*.rb').to_s).
|
17
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'tables', '*.rb').to_s).each do |file|
|
18
18
|
require file
|
19
19
|
end
|
data/lib/goldendocx/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'extensions/nokogiri_extensions'
|
4
4
|
|
5
5
|
module Goldendocx
|
6
6
|
module XmlSerializers
|
@@ -11,19 +11,33 @@ module Goldendocx
|
|
11
11
|
options.no_declaration
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
# TODO: Nokogiri namespace is soooo strict....
|
15
|
+
# TODO: To read nokogiri source codes and try to understand how it works
|
16
|
+
def parse(xml)
|
17
|
+
document = ::Nokogiri::XML(xml)
|
18
|
+
|
19
|
+
missing_namespaces = document.errors.filter_map do |error|
|
20
|
+
error.str1 if error.message.match?('Namespace.*not defined')
|
21
|
+
end.uniq.compact
|
22
|
+
return document if missing_namespaces.blank?
|
23
|
+
|
24
|
+
wrap_document(document, missing_namespaces)
|
25
|
+
end
|
26
|
+
|
27
|
+
def search(node, paths)
|
28
|
+
return node if paths.blank?
|
29
|
+
|
30
|
+
search_paths = paths.map { |path| path.include?(':') || path == '*' ? path : ['xmlns', path].join(':') }
|
31
|
+
namespaces = node.namespaces.merge(node.document.namespaces)
|
32
|
+
node.xpath(search_paths.join('/'), namespaces)
|
19
33
|
end
|
20
34
|
|
21
|
-
def build_xml(tag, &
|
22
|
-
build_element(tag, &
|
35
|
+
def build_xml(tag, &)
|
36
|
+
CGI.unescapeHTML build_element(tag, &).to_xml(indent: 0, save_with: DEFAULT_BUILD_OPTIONS).delete("\n")
|
23
37
|
end
|
24
38
|
|
25
|
-
def build_document_xml(tag, namespaces = [], ignore_namespaces = [], &
|
26
|
-
build_document(tag, namespaces, ignore_namespaces, &
|
39
|
+
def build_document_xml(tag, namespaces = [], ignore_namespaces = [], &)
|
40
|
+
CGI.unescapeHTML build_document(tag, namespaces, ignore_namespaces, &).to_xml(indent: 0).delete("\n")
|
27
41
|
end
|
28
42
|
|
29
43
|
def build_document(tag, namespaces = [], ignore_namespaces = [])
|
@@ -41,25 +55,19 @@ module Goldendocx
|
|
41
55
|
|
42
56
|
def build_element(tag, parent: nil)
|
43
57
|
parent ||= ::Nokogiri::XML('<?xml version="1.0"')
|
44
|
-
::Nokogiri::XML::Node.new(tag, parent).tap do |element|
|
58
|
+
::Nokogiri::XML::Node.new(tag.to_s, parent).tap do |element|
|
45
59
|
yield(element) if block_given?
|
46
60
|
end
|
47
61
|
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
62
|
|
53
|
-
|
54
|
-
module Nokogiri
|
55
|
-
module XML
|
56
|
-
class Node
|
57
|
-
def <<(node_or_tags)
|
58
|
-
# FIXME: Add this line to transform element implicitly
|
59
|
-
node_or_tags = node_or_tags.public_send(:to_element, parent: self) if node_or_tags.respond_to?(:to_element)
|
63
|
+
private
|
60
64
|
|
61
|
-
|
62
|
-
|
65
|
+
def wrap_document(document, missing_namespaces)
|
66
|
+
missing_namespaces.each do |ns|
|
67
|
+
document.root.add_namespace ns, (Goldendocx::NAMESPACES[ns.to_sym] || "#{ns}:goldendocx")
|
68
|
+
end
|
69
|
+
::Nokogiri::XML(document.to_xml(indent: 0).delete("\n"))
|
70
|
+
end
|
63
71
|
end
|
64
72
|
end
|
65
73
|
end
|
@@ -1,24 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'extensions/ox_extensions'
|
4
4
|
|
5
5
|
module Goldendocx
|
6
6
|
module XmlSerializers
|
7
|
-
|
7
|
+
module Ox
|
8
8
|
class << self
|
9
9
|
def parse(xml, paths = [])
|
10
10
|
xml = ::Ox.parse(xml)
|
11
|
-
xml =
|
12
|
-
xml
|
11
|
+
xml = ::Ox::Document.new.tap { |document| document << xml } unless xml.is_a?(::Ox::Document)
|
12
|
+
search(xml, paths)
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
15
|
+
def search(node, paths)
|
16
|
+
return node if paths.blank?
|
17
|
+
|
18
|
+
node.locate(paths.join('/'))
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
-
xml =
|
21
|
+
def build_xml(tag, &)
|
22
|
+
xml = build_element(tag, &)
|
23
|
+
::Ox.dump(xml, indent: -1, with_xml: true, encoding: 'UTF-8')
|
24
|
+
end
|
25
|
+
|
26
|
+
def build_document_xml(tag, namespaces = [], ignore_namespaces = [], &)
|
27
|
+
xml = build_document(tag, namespaces, ignore_namespaces, &)
|
22
28
|
::Ox.dump(xml, indent: -1, with_xml: true)
|
23
29
|
end
|
24
30
|
|
@@ -45,19 +51,3 @@ module Goldendocx
|
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
48
|
-
|
49
|
-
# FIXME: Temporarily here to provider syntactic sugar
|
50
|
-
module Ox
|
51
|
-
class Element
|
52
|
-
def <<(node)
|
53
|
-
# FIXME: Add this line to transform element implicitly
|
54
|
-
node = node.public_send(:to_element) if node.respond_to?(:to_element)
|
55
|
-
|
56
|
-
raise 'argument to << must be a String or Ox::Node.' unless node.is_a?(String) || node.is_a?(Node)
|
57
|
-
|
58
|
-
@nodes = [] if !instance_variable_defined?(:@nodes) || @nodes.nil?
|
59
|
-
@nodes << node
|
60
|
-
self
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/lib/goldendocx.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'zip'
|
4
|
+
require 'extensions/active_support_extensions'
|
5
|
+
require 'extensions/xml_serialize_extensions'
|
4
6
|
|
5
7
|
require 'goldendocx/version'
|
6
|
-
require 'goldendocx/docx'
|
7
8
|
|
8
9
|
module Goldendocx
|
9
10
|
autoload :Configuration, 'goldendocx/configuration'
|
@@ -13,6 +14,7 @@ module Goldendocx
|
|
13
14
|
a14: 'http://schemas.microsoft.com/office/drawing/2010/main',
|
14
15
|
c: 'http://schemas.openxmlformats.org/drawingml/2006/chart',
|
15
16
|
c14: 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart',
|
17
|
+
cp: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties',
|
16
18
|
cx: 'http://schemas.microsoft.com/office/drawing/2014/chartex',
|
17
19
|
cx1: 'http://schemas.microsoft.com/office/drawing/2015/9/8/chartex',
|
18
20
|
cx2: 'http://schemas.microsoft.com/office/drawing/2015/10/21/chartex',
|
@@ -22,6 +24,9 @@ module Goldendocx
|
|
22
24
|
cx6: 'http://schemas.microsoft.com/office/drawing/2016/5/12/chartex',
|
23
25
|
cx7: 'http://schemas.microsoft.com/office/drawing/2016/5/13/chartex',
|
24
26
|
cx8: 'http://schemas.microsoft.com/office/drawing/2016/5/14/chartex',
|
27
|
+
dc: 'http://purl.org/dc/elements/1.1/',
|
28
|
+
dcmitype: 'http://purl.org/dc/dcmitype/',
|
29
|
+
dcterms: 'http://purl.org/dc/terms/',
|
25
30
|
m: 'http://schemas.openxmlformats.org/officeDocument/2006/math',
|
26
31
|
mc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',
|
27
32
|
mo: 'http://schemas.microsoft.com/office/mac/office/2008/main',
|
@@ -43,7 +48,8 @@ module Goldendocx
|
|
43
48
|
wpc: 'http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas',
|
44
49
|
wpg: 'http://schemas.microsoft.com/office/word/2010/wordprocessingGroup',
|
45
50
|
wpi: 'http://schemas.microsoft.com/office/word/2010/wordprocessingInk',
|
46
|
-
wps: 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape'
|
51
|
+
wps: 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape',
|
52
|
+
xsi: 'http://www.w3.org/2001/XMLSchema-instance'
|
47
53
|
}.freeze
|
48
54
|
|
49
55
|
class << self
|
@@ -70,3 +76,9 @@ module Goldendocx
|
|
70
76
|
end
|
71
77
|
end
|
72
78
|
end
|
79
|
+
|
80
|
+
require 'goldendocx/units'
|
81
|
+
require 'goldendocx/element'
|
82
|
+
require 'goldendocx/document'
|
83
|
+
require 'goldendocx/has_associations'
|
84
|
+
require 'goldendocx/docx'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goldendocx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WangYuechen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.8.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: timecop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.9.6
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.9.6
|
167
181
|
description: Ruby APIs for manipulating Microsoft Word based upon OOXML standards.
|
168
182
|
email:
|
169
183
|
- 291943739@qq.com
|
@@ -173,6 +187,7 @@ extra_rdoc_files: []
|
|
173
187
|
files:
|
174
188
|
- ".rspec"
|
175
189
|
- ".rubocop.yml"
|
190
|
+
- ".ruby-version"
|
176
191
|
- CHANGELOG.md
|
177
192
|
- Gemfile
|
178
193
|
- Gemfile.lock
|
@@ -190,13 +205,20 @@ files:
|
|
190
205
|
- demo/tables/create_styled_table.rb
|
191
206
|
- demo/templates/bg.png
|
192
207
|
- demo/templates/blankDocument.docx
|
208
|
+
- demo/templates/generate_codes.rb
|
193
209
|
- demo/templates/image_base64
|
194
210
|
- demo/templates/styles/reportLabel
|
195
211
|
- demo/templates/styles/reportSubTitle
|
196
212
|
- demo/templates/styles/reportTable
|
197
213
|
- demo/templates/styles/reportTitle
|
214
|
+
- demo/templates/xml_to_class.rb
|
198
215
|
- demo/texts/append_plain_text.rb
|
199
216
|
- demo/texts/append_styled_text.rb
|
217
|
+
- demo/texts/create_text.rb
|
218
|
+
- lib/extensions/active_support_extensions.rb
|
219
|
+
- lib/extensions/nokogiri_extensions.rb
|
220
|
+
- lib/extensions/ox_extensions.rb
|
221
|
+
- lib/extensions/xml_serialize_extensions.rb
|
200
222
|
- lib/goldendocx.rb
|
201
223
|
- lib/goldendocx/charts.rb
|
202
224
|
- lib/goldendocx/charts/category_axis.rb
|
@@ -247,11 +269,13 @@ files:
|
|
247
269
|
- lib/goldendocx/components/properties/color_property.rb
|
248
270
|
- lib/goldendocx/components/properties/drawing.rb
|
249
271
|
- lib/goldendocx/components/properties/extents_property.rb
|
272
|
+
- lib/goldendocx/components/properties/font_property.rb
|
250
273
|
- lib/goldendocx/components/properties/graphic_data_property.rb
|
251
274
|
- lib/goldendocx/components/properties/graphic_frame_locks_property.rb
|
252
275
|
- lib/goldendocx/components/properties/graphic_frame_property.rb
|
253
276
|
- lib/goldendocx/components/properties/graphic_property.rb
|
254
277
|
- lib/goldendocx/components/properties/inline.rb
|
278
|
+
- lib/goldendocx/components/properties/language_property.rb
|
255
279
|
- lib/goldendocx/components/properties/non_visual_property.rb
|
256
280
|
- lib/goldendocx/components/properties/padding_property.rb
|
257
281
|
- lib/goldendocx/components/properties/property.rb
|
@@ -268,14 +292,23 @@ files:
|
|
268
292
|
- lib/goldendocx/documents.rb
|
269
293
|
- lib/goldendocx/documents/body.rb
|
270
294
|
- lib/goldendocx/documents/document.rb
|
271
|
-
- lib/goldendocx/documents/
|
272
|
-
- lib/goldendocx/documents/
|
273
|
-
- lib/goldendocx/documents/
|
295
|
+
- lib/goldendocx/documents/latent_styles.rb
|
296
|
+
- lib/goldendocx/documents/properties.rb
|
297
|
+
- lib/goldendocx/documents/properties/default_style_property.rb
|
298
|
+
- lib/goldendocx/documents/properties/page_margin_property.rb
|
299
|
+
- lib/goldendocx/documents/properties/page_size_property.rb
|
300
|
+
- lib/goldendocx/documents/properties/paragraph_default_style_property.rb
|
301
|
+
- lib/goldendocx/documents/properties/run_default_style_property.rb
|
302
|
+
- lib/goldendocx/documents/properties/section_property.rb
|
303
|
+
- lib/goldendocx/documents/properties/style_name_property.rb
|
304
|
+
- lib/goldendocx/documents/settings.rb
|
274
305
|
- lib/goldendocx/documents/style.rb
|
275
306
|
- lib/goldendocx/documents/styles.rb
|
276
|
-
- lib/goldendocx/documents/unparsed_style.rb
|
277
307
|
- lib/goldendocx/docx.rb
|
278
308
|
- lib/goldendocx/element.rb
|
309
|
+
- lib/goldendocx/has_associations.rb
|
310
|
+
- lib/goldendocx/has_attributes.rb
|
311
|
+
- lib/goldendocx/has_children.rb
|
279
312
|
- lib/goldendocx/images.rb
|
280
313
|
- lib/goldendocx/images/picture.rb
|
281
314
|
- lib/goldendocx/images/properties.rb
|
@@ -292,10 +325,21 @@ files:
|
|
292
325
|
- lib/goldendocx/images/properties/stretch_property.rb
|
293
326
|
- lib/goldendocx/images/properties/transform_property.rb
|
294
327
|
- lib/goldendocx/images/shape.rb
|
328
|
+
- lib/goldendocx/models.rb
|
329
|
+
- lib/goldendocx/models/relationship.rb
|
330
|
+
- lib/goldendocx/models/relationships.rb
|
295
331
|
- lib/goldendocx/parts.rb
|
332
|
+
- lib/goldendocx/parts/app.rb
|
296
333
|
- lib/goldendocx/parts/content_types.rb
|
334
|
+
- lib/goldendocx/parts/core.rb
|
297
335
|
- lib/goldendocx/parts/documents.rb
|
298
336
|
- lib/goldendocx/parts/media.rb
|
337
|
+
- lib/goldendocx/parts/properties.rb
|
338
|
+
- lib/goldendocx/parts/properties/created_at_property.rb
|
339
|
+
- lib/goldendocx/parts/properties/creator_property.rb
|
340
|
+
- lib/goldendocx/parts/properties/revision_property.rb
|
341
|
+
- lib/goldendocx/parts/properties/updated_at_property.rb
|
342
|
+
- lib/goldendocx/parts/properties/updater_property.rb
|
299
343
|
- lib/goldendocx/tables.rb
|
300
344
|
- lib/goldendocx/tables/cell.rb
|
301
345
|
- lib/goldendocx/tables/header_cell.rb
|
@@ -324,7 +368,8 @@ files:
|
|
324
368
|
homepage: https://github.com/SheldonLeo/goldendocx
|
325
369
|
licenses:
|
326
370
|
- Nonstandard
|
327
|
-
metadata:
|
371
|
+
metadata:
|
372
|
+
rubygems_mfa_required: 'true'
|
328
373
|
post_install_message:
|
329
374
|
rdoc_options: []
|
330
375
|
require_paths:
|
@@ -333,14 +378,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
378
|
requirements:
|
334
379
|
- - ">="
|
335
380
|
- !ruby/object:Gem::Version
|
336
|
-
version: 2
|
381
|
+
version: '3.2'
|
337
382
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
383
|
requirements:
|
339
384
|
- - ">="
|
340
385
|
- !ruby/object:Gem::Version
|
341
386
|
version: '0'
|
342
387
|
requirements: []
|
343
|
-
rubygems_version: 3.
|
388
|
+
rubygems_version: 3.4.1
|
344
389
|
signing_key:
|
345
390
|
specification_version: 4
|
346
391
|
summary: The Ruby API for Microsoft Word
|