paper_docx_templater 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +176 -0
- data/README.rdoc +40 -0
- data/Rakefile +16 -0
- data/docx_templater.gemspec +42 -0
- data/lib/VERSION +1 -0
- data/lib/docx_templater/docx_creator.rb +72 -0
- data/lib/docx_templater/image.rb +16 -0
- data/lib/docx_templater/template_processor.rb +230 -0
- data/lib/docx_templater.rb +18 -0
- data/script/ci.sh +48 -0
- data/spec/example_input/2.docx +0 -0
- data/spec/example_input/3.docx +0 -0
- data/spec/example_input/9/[Content_Types].xml +2 -0
- data/spec/example_input/9/docProps/app.xml +2 -0
- data/spec/example_input/9/docProps/core.xml +2 -0
- data/spec/example_input/9/word/_rels/document.xml.rels +2 -0
- data/spec/example_input/9/word/document.xml +2 -0
- data/spec/example_input/9/word/endnotes.xml +2 -0
- data/spec/example_input/9/word/fontTable.xml +2 -0
- data/spec/example_input/9/word/footnotes.xml +2 -0
- data/spec/example_input/9/word/media/image1.jpeg +0 -0
- data/spec/example_input/9/word/media/image2.jpeg +0 -0
- data/spec/example_input/9/word/media/image3.jpeg +0 -0
- data/spec/example_input/9/word/settings.xml +2 -0
- data/spec/example_input/9/word/styles.xml +2 -0
- data/spec/example_input/9/word/theme/theme1.xml +2 -0
- data/spec/example_input/9/word/webSettings.xml +2 -0
- data/spec/example_input/ExampleTemplate.docx +0 -0
- data/spec/example_input/tmp/IntegrationTestOutput.docx +0 -0
- data/spec/example_input/word/document.xml +1122 -0
- data/spec/example_input/~$3.docx +0 -0
- data/spec/example_input/~$/351/253/230/350/200/203/346/250/241/346/213/237/345/215/267.doc +0 -0
- data/spec/example_input//351/253/230/350/200/203/346/250/241/346/213/237/345/215/267.doc +0 -0
- data/spec/integration_spec.rb +49 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/template_processor_spec.rb +269 -0
- metadata +177 -0
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'template_processor_spec'
|
4
|
+
|
5
|
+
describe "integration test", :integration => true do
|
6
|
+
let(:data) { DocxTemplater::TestData::DATA }
|
7
|
+
let(:base_path) { SPEC_BASE_PATH.join("example_input") }
|
8
|
+
let(:input_file) { "#{base_path}/3.docx" }
|
9
|
+
#let(:input_file) { "#{base_path}/ExampleTemplate.docx" }
|
10
|
+
let(:output_dir) { "#{base_path}/tmp" }
|
11
|
+
let(:output_file) { "#{output_dir}/IntegrationTestOutput.docx" }
|
12
|
+
before do
|
13
|
+
FileUtils.rm_rf(output_dir) if File.exists?(output_dir)
|
14
|
+
Dir.mkdir(output_dir)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "should process in incoming docx" do
|
18
|
+
it "generates a valid zip file (.docx)" do
|
19
|
+
|
20
|
+
cached_images = {
|
21
|
+
:image0 => DocxTemplater::Image.new('test1.jpeg', Base64.encode64(File.open('/Users/sam/Pictures/test1.png'){|f| f.read})),
|
22
|
+
#:image1 => DocxTemplater::Image.new('test2.jpeg', Base64.encode64(File.open('/Users/sam/Pictures/test2.png'){|f| f.read})),
|
23
|
+
:image2 => DocxTemplater::Image.new('test3.jpeg', Base64.encode64(File.open('/Users/sam/Pictures/test3.png'){|f| f.read}))
|
24
|
+
#:image3 => DocxTemplater::Image.new('test4.jpeg', Base64.encode64(File.open('/Users/sam/Pictures/test4.png'){|f| f.read}))
|
25
|
+
}
|
26
|
+
DocxTemplater::DocxCreator.new(input_file, data, cached_images).generate_docx_file(output_file)
|
27
|
+
|
28
|
+
archive = ZipRuby::Archive.open(output_file)
|
29
|
+
archive.close
|
30
|
+
|
31
|
+
puts "\n************************************"
|
32
|
+
puts " >>> Only will work on mac <<<"
|
33
|
+
puts "NOW attempting to open created file in Word."
|
34
|
+
cmd = "open #{output_file}"
|
35
|
+
puts " will run '#{cmd}'"
|
36
|
+
puts "************************************"
|
37
|
+
|
38
|
+
system cmd
|
39
|
+
end
|
40
|
+
|
41
|
+
#it "generates a file with the same contents as the input docx" do
|
42
|
+
#input_entries = ZipRuby::Archive.open(input_file) { |z| z.map(&:name) }
|
43
|
+
#DocxTemplater::DocxCreator.new(input_file, data).generate_docx_file(output_file)
|
44
|
+
#output_entries = ZipRuby::Archive.open(output_file) { |z| z.map(&:name) }
|
45
|
+
|
46
|
+
#input_entries.should == output_entries
|
47
|
+
#end
|
48
|
+
end
|
49
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
module DocxTemplater
|
5
|
+
module TestData
|
6
|
+
DATA = {
|
7
|
+
:subject => '高考模拟卷一',
|
8
|
+
#:teacher => '土豪金',
|
9
|
+
:teacher => '土豪金高端大气上档次哈哈',
|
10
|
+
:questions => [
|
11
|
+
{
|
12
|
+
:title => '一、选择题(本题包括21小题,每小题给出的四个选项中,有的只有一个选项正确,有的有多个选项正确,全部选对的得6分,选对但不全的得3分,有选错的得0分)',
|
13
|
+
:items => [
|
14
|
+
{
|
15
|
+
:content => '1. 人在恐惧、紧张时,在内脏神经的支配下,肾上腺髓质释放的肾上腺素增多,该激素可用于心脏,使心率加快。下列叙述错误的是${image2}( )',
|
16
|
+
:choice => [
|
17
|
+
' A.该肾上腺素作用的靶器官包括心脏',
|
18
|
+
' B.该实例包含神经调节和体液调节',
|
19
|
+
' C.该肾上腺素通过神经纤维运输到心脏',
|
20
|
+
' D.该实例中反射弧是实现神经调节的结构基础'
|
21
|
+
]
|
22
|
+
},
|
23
|
+
{
|
24
|
+
:content => '2. 番茄幼苗在缺镁的培养液中培养一段时间后,与对照组相比,其叶片光合作用强度下降,原因是( )',
|
25
|
+
:choice => [
|
26
|
+
' A.光反应强度升高,暗反应强度降低',
|
27
|
+
' B.光反应强度降低,暗反应强度降低',
|
28
|
+
' C.反应强度不变,暗反应强度降低',
|
29
|
+
' D.反应强度降低,暗反应强度不变'
|
30
|
+
]
|
31
|
+
}
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
:title => '二、问答题',
|
36
|
+
:items => [
|
37
|
+
{
|
38
|
+
:content => '1. 图中左边有一对平行金属板,两板相距为d,电压为V;两板之间有匀强磁场,磁感应强度大小为B0,方向平行于板面并垂直于纸面朝里。图中右边有一边长为a的正三角形区域EFG(EF边与金属板垂直),在此区域内及其边界上也有匀强磁场,磁感应强度大小为B,方向垂直于纸面朝里。假设一系列电荷量为q的正离子沿平行于金属板面,垂直于磁场的方向射入金属板之间,沿同一方向射出金属板之间的区域,并经EF边中点H射入磁场区域。不计重力\n
|
39
|
+
(1)已知这些离子中的离子${image0}甲到达磁场边界EG后,从边界EF穿出磁场,求离子甲的质量。\n
|
40
|
+
(2)已知这些离子中的离子乙从EG边上的I点(图中未画出)穿出磁场,且GI长为 ,求离 子乙的质量。\n
|
41
|
+
(3)若这些离子中的最轻离子的质量等于离子甲质量的一半,而离子乙的质量是最大的,问磁场边界上什么区域内可能有离子到达。
|
42
|
+
'
|
43
|
+
},{
|
44
|
+
:content => '2.【生物——选修1:生物技术实践】(8分) 为了探究6―BA和IAA对某些菊花品种茎尖外植物再生丛芽的影响,某研究小组在MS培养基中加入6―BA和IAA,配制成四种培养基(见下表),灭菌后分别接种数量相同、生长状态一致、消毒后地的尖外植体,在适宜条件下培养一段时间后,统计再生丛芽外植体的比率(m),以及再生丛芽外植体上的丛芽平均数(n),结果如下表。\n
|
45
|
+
(2)在该实验中,自变量是 ,因变量是 ,自变量的取值范围是 。\n
|
46
|
+
(3)从实验结果可知,诱导从芽总数量少的培养基是 号培养基。\n
|
47
|
+
(4)为了诱导该菊花试管菌生根,培养基中一般不加入 。(填“6―BA”或“IAA”)。'
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
#DATA = {
|
54
|
+
#:teacher => "Priya Vora",
|
55
|
+
#:building => "Building #14",
|
56
|
+
#:classroom => :'Rm 202',
|
57
|
+
#:district => "Washington County Public Schools",
|
58
|
+
#:senority => 12.25,
|
59
|
+
#:roster => [
|
60
|
+
#{:name => 'Sally', :age => 12, :attendence => '100%'},
|
61
|
+
#{:name => :Xiao, :age => 10, :attendence => '94%'},
|
62
|
+
#{:name => 'Bryan', :age => 13, :attendence => '100%'},
|
63
|
+
#{:name => 'Larry', :age => 11, :attendence => '90%'},
|
64
|
+
#{:name => 'Kumar', :age => 12, :attendence => '76%'},
|
65
|
+
#{:name => 'Amber', :age => 11, :attendence => '100%'},
|
66
|
+
#{:name => 'Isaiah', :age => 12, :attendence => '89%'},
|
67
|
+
#{:name => 'Omar', :age => 12, :attendence => '99%'},
|
68
|
+
#{:name => 'Xi', :age => 11, :attendence => '20%'},
|
69
|
+
#{:name => 'Noushin', :age => 12, :attendence => '100%'}
|
70
|
+
#],
|
71
|
+
#:event_reports => [
|
72
|
+
#{:name => 'Science Museum Field Trip', :notes => 'PTA sponsored event. Spoke to Astronaut with HAM radio.'},
|
73
|
+
#{:name => 'Wilderness Center Retreat', :notes => '2 days hiking for charity:water fundraiser, $10,200 raised.'}
|
74
|
+
#],
|
75
|
+
#:created_at => "11-12-03 02:01"
|
76
|
+
#}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
#describe DocxTemplater::TemplateProcessor do
|
81
|
+
#let(:data) { Marshal.load(Marshal.dump(DocxTemplater::TestData::DATA)) } # deep copy
|
82
|
+
#let(:base_path) { SPEC_BASE_PATH.join("example_input") }
|
83
|
+
#let(:xml) { File.read("#{base_path}/word/document.xml") }
|
84
|
+
#let(:parser) { DocxTemplater::TemplateProcessor.new(data) }
|
85
|
+
|
86
|
+
#context "valid xml" do
|
87
|
+
#it "should render and still be valid XML" do
|
88
|
+
#Nokogiri::XML.parse(xml).should be_xml
|
89
|
+
#out = parser.render(xml)
|
90
|
+
#Nokogiri::XML.parse(out).should be_xml
|
91
|
+
#end
|
92
|
+
|
93
|
+
#it "should accept non-ascii characters" do
|
94
|
+
#data[:teacher] = "老师"
|
95
|
+
#out = parser.render(xml)
|
96
|
+
#out.index("老师").should >= 0
|
97
|
+
#Nokogiri::XML.parse(out).should be_xml
|
98
|
+
#end
|
99
|
+
|
100
|
+
#it "should escape as necessary invalid xml characters, if told to" do
|
101
|
+
#data[:building] = "23rd & A #1 floor"
|
102
|
+
#data[:classroom] = "--> 201 <!--"
|
103
|
+
#data[:roster][0][:name] = "<#Ai & Bo>"
|
104
|
+
#out = parser.render(xml)
|
105
|
+
|
106
|
+
#Nokogiri::XML.parse(out).should be_xml
|
107
|
+
#out.index("23rd & A #1 floor").should >= 0
|
108
|
+
#out.index("--> 201 <!--").should >= 0
|
109
|
+
#out.index("<#Ai & Bo>").should >= 0
|
110
|
+
#end
|
111
|
+
|
112
|
+
#context "not escape xml" do
|
113
|
+
#let(:parser) { DocxTemplater::TemplateProcessor.new(data, false) }
|
114
|
+
#it "does not escape the xml attributes" do
|
115
|
+
#data[:building] = "23rd <p>&</p> #1 floor"
|
116
|
+
#out = parser.render(xml)
|
117
|
+
#Nokogiri::XML.parse(out).should be_xml
|
118
|
+
#out.index("23rd <p>&</p> #1 floor").should >= 0
|
119
|
+
#end
|
120
|
+
#end
|
121
|
+
#end
|
122
|
+
|
123
|
+
#context "unmatched begin and end row templates" do
|
124
|
+
#it "should not raise" do
|
125
|
+
#xml = <<EOF
|
126
|
+
#<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
127
|
+
#<w:body>
|
128
|
+
#<w:tbl>
|
129
|
+
#<w:tr><w:tc>
|
130
|
+
#<w:p>
|
131
|
+
#<w:r><w:t>#BEGIN_ROW:#{:roster.to_s.upcase}#</w:t></w:r>
|
132
|
+
#</w:p>
|
133
|
+
#</w:tc></w:tr>
|
134
|
+
#<w:tr><w:tc>
|
135
|
+
#<w:p>
|
136
|
+
#<w:r><w:t>#END_ROW:#{:roster.to_s.upcase}#</w:t></w:r>
|
137
|
+
#</w:p>
|
138
|
+
#</w:tc></w:tr>
|
139
|
+
#<w:tr><w:tc>
|
140
|
+
#<w:p>
|
141
|
+
#<w:r><w:t>#BEGIN_ROW:#{:event_reports.to_s.upcase}#</w:t></w:r>
|
142
|
+
#</w:p>
|
143
|
+
#</w:tc></w:tr>
|
144
|
+
#<w:tr><w:tc>
|
145
|
+
#<w:p>
|
146
|
+
#<w:r><w:t>#END_ROW:#{:event_reports.to_s.upcase}#</w:t></w:r>
|
147
|
+
#</w:p>
|
148
|
+
#</w:tc></w:tr>
|
149
|
+
#</w:tbl>
|
150
|
+
#</w:body>
|
151
|
+
#</xml>
|
152
|
+
#EOF
|
153
|
+
#expect { parser.render(xml) }.to_not raise_error
|
154
|
+
#end
|
155
|
+
|
156
|
+
#it "should raise an exception" do
|
157
|
+
#xml = <<EOF
|
158
|
+
#<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
159
|
+
#<w:body>
|
160
|
+
#<w:tbl>
|
161
|
+
#<w:tr><w:tc>
|
162
|
+
#<w:p>
|
163
|
+
#<w:r><w:t>#BEGIN_ROW:#{:roster.to_s.upcase}#</w:t></w:r>
|
164
|
+
#</w:p>
|
165
|
+
#</w:tc></w:tr>
|
166
|
+
#<w:tr><w:tc>
|
167
|
+
#<w:p>
|
168
|
+
#<w:r><w:t>#END_ROW:#{:roster.to_s.upcase}#</w:t></w:r>
|
169
|
+
#</w:p>
|
170
|
+
#</w:tc></w:tr>
|
171
|
+
#<w:tr><w:tc>
|
172
|
+
#<w:p>
|
173
|
+
#<w:r><w:t>#BEGIN_ROW:#{:event_reports.to_s.upcase}#</w:t></w:r>
|
174
|
+
#</w:p>
|
175
|
+
#</w:tc></w:tr>
|
176
|
+
#</w:tbl>
|
177
|
+
#</w:body>
|
178
|
+
#</xml>
|
179
|
+
#EOF
|
180
|
+
#expect { parser.render(xml) }.to raise_error(/#END_ROW:EVENT_REPORTS# nil: true/)
|
181
|
+
#end
|
182
|
+
#end
|
183
|
+
|
184
|
+
#it "should enter no text for a nil value" do
|
185
|
+
#xml = <<EOF
|
186
|
+
#<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
187
|
+
#<w:body>
|
188
|
+
#<w:p>Before.$KEY$After</w:p>
|
189
|
+
#</w:body>
|
190
|
+
#</xml>
|
191
|
+
#EOF
|
192
|
+
#actual = DocxTemplater::TemplateProcessor.new(:key => nil).render(xml)
|
193
|
+
#expected_xml = <<EOF
|
194
|
+
#<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
195
|
+
#<w:body>
|
196
|
+
#<w:p>Before.After</w:p>
|
197
|
+
#</w:body>
|
198
|
+
#</xml>
|
199
|
+
#EOF
|
200
|
+
#actual.should == expected_xml
|
201
|
+
#end
|
202
|
+
|
203
|
+
#it "should replace all simple keys with values" do
|
204
|
+
#non_array_keys = data.reject { |k, v| v.class == Array }
|
205
|
+
#non_array_keys.keys.each do |key|
|
206
|
+
#xml.index("$#{key.to_s.upcase}$").should >= 0
|
207
|
+
#xml.index(data[key].to_s).should be_nil
|
208
|
+
#end
|
209
|
+
#out = parser.render(xml)
|
210
|
+
|
211
|
+
#non_array_keys.each do |key|
|
212
|
+
#out.index("$#{key}$").should be_nil
|
213
|
+
#out.index(data[key].to_s).should >= 0
|
214
|
+
#end
|
215
|
+
#end
|
216
|
+
|
217
|
+
#it "should replace all array keys with values" do
|
218
|
+
#xml.index("#BEGIN_ROW:").should >= 0
|
219
|
+
#xml.index("#END_ROW:").should >= 0
|
220
|
+
#xml.index("$EACH:").should >= 0
|
221
|
+
|
222
|
+
#out = parser.render(xml)
|
223
|
+
|
224
|
+
#out.index("#BEGIN_ROW:").should be_nil
|
225
|
+
#out.index("#END_ROW:").should be_nil
|
226
|
+
#out.index("$EACH:").should be_nil
|
227
|
+
|
228
|
+
#[:roster, :event_reports].each do |key|
|
229
|
+
#data[key].each do |row|
|
230
|
+
#row.values.map(&:to_s).each do |row_value|
|
231
|
+
#out.index(row_value).should >= 0
|
232
|
+
#end
|
233
|
+
#end
|
234
|
+
#end
|
235
|
+
#end
|
236
|
+
|
237
|
+
#it "shold render students names in the same order as the data" do
|
238
|
+
#out = parser.render(xml)
|
239
|
+
#out.index('Sally').should >= 0
|
240
|
+
#out.index('Kumar').should >= 0
|
241
|
+
#out.index('Kumar').should > out.index('Sally')
|
242
|
+
#end
|
243
|
+
|
244
|
+
#it "shold render event reports names in the same order as the data" do
|
245
|
+
#out = parser.render(xml)
|
246
|
+
#out.index('Science Museum Field Trip').should >= 0
|
247
|
+
#out.index('Wilderness Center Retreat').should >= 0
|
248
|
+
#out.index('Wilderness Center Retreat').should > out.index('Science Museum Field Trip')
|
249
|
+
#end
|
250
|
+
|
251
|
+
#it "should render 2-line event reports in same order as docx" do
|
252
|
+
#event_reports_starting_at = xml.index("#BEGIN_ROW:EVENT_REPORTS#")
|
253
|
+
#event_reports_starting_at.should >= 0
|
254
|
+
#xml.index("$EACH:NAME$", event_reports_starting_at).should > event_reports_starting_at
|
255
|
+
#xml.index("$EACH:NOTES$", event_reports_starting_at).should > event_reports_starting_at
|
256
|
+
#xml.index("$EACH:NOTES$", event_reports_starting_at).should > xml.index("$EACH:NAME$", event_reports_starting_at)
|
257
|
+
|
258
|
+
#out = parser.render(xml)
|
259
|
+
#out.index('PTA sponsored event. Spoke to Astronaut with HAM radio.').should > out.index('Science Museum Field Trip')
|
260
|
+
#end
|
261
|
+
|
262
|
+
#it "should render sums of input data" do
|
263
|
+
#xml.index("#SUM").should >= 0
|
264
|
+
#out = parser.render(xml)
|
265
|
+
#out.index("#SUM").should be_nil
|
266
|
+
#out.index("#{data[:roster].count} Students").should >= 0
|
267
|
+
#out.index("#{data[:event_reports].count} Events").should >= 0
|
268
|
+
#end
|
269
|
+
#end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paper_docx_templater
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tim Lang
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: zipruby-compat
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.3.7
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.3.7
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.7.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.7.0
|
78
|
+
description: A Ruby library to template Microsoft Word .docx files.
|
79
|
+
email: langyong135@gmail.com
|
80
|
+
executables: []
|
81
|
+
extensions: []
|
82
|
+
extra_rdoc_files:
|
83
|
+
- README.rdoc
|
84
|
+
files:
|
85
|
+
- lib/docx_templater/docx_creator.rb
|
86
|
+
- lib/docx_templater/image.rb
|
87
|
+
- lib/docx_templater/template_processor.rb
|
88
|
+
- lib/docx_templater.rb
|
89
|
+
- lib/VERSION
|
90
|
+
- script/ci.sh
|
91
|
+
- spec/example_input/2.docx
|
92
|
+
- spec/example_input/3.docx
|
93
|
+
- spec/example_input/9/[Content_Types].xml
|
94
|
+
- spec/example_input/9/docProps/app.xml
|
95
|
+
- spec/example_input/9/docProps/core.xml
|
96
|
+
- spec/example_input/9/word/_rels/document.xml.rels
|
97
|
+
- spec/example_input/9/word/document.xml
|
98
|
+
- spec/example_input/9/word/endnotes.xml
|
99
|
+
- spec/example_input/9/word/fontTable.xml
|
100
|
+
- spec/example_input/9/word/footnotes.xml
|
101
|
+
- spec/example_input/9/word/media/image1.jpeg
|
102
|
+
- spec/example_input/9/word/media/image2.jpeg
|
103
|
+
- spec/example_input/9/word/media/image3.jpeg
|
104
|
+
- spec/example_input/9/word/settings.xml
|
105
|
+
- spec/example_input/9/word/styles.xml
|
106
|
+
- spec/example_input/9/word/theme/theme1.xml
|
107
|
+
- spec/example_input/9/word/webSettings.xml
|
108
|
+
- spec/example_input/ExampleTemplate.docx
|
109
|
+
- spec/example_input/tmp/IntegrationTestOutput.docx
|
110
|
+
- spec/example_input/word/document.xml
|
111
|
+
- spec/example_input/~$3.docx
|
112
|
+
- spec/example_input/~$高考模拟卷.doc
|
113
|
+
- spec/example_input/高考模拟卷.doc
|
114
|
+
- spec/integration_spec.rb
|
115
|
+
- spec/spec.opts
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- spec/template_processor_spec.rb
|
118
|
+
- docx_templater.gemspec
|
119
|
+
- LICENSE.txt
|
120
|
+
- Rakefile
|
121
|
+
- README.rdoc
|
122
|
+
- .gitignore
|
123
|
+
- Gemfile
|
124
|
+
homepage: https://github.com/TimLang/ruby-docx-templater
|
125
|
+
licenses: []
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options:
|
128
|
+
- --charset=UTF-8
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.8.25
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: Generates new Word .docx files based on a template file.
|
149
|
+
test_files:
|
150
|
+
- spec/example_input/2.docx
|
151
|
+
- spec/example_input/3.docx
|
152
|
+
- spec/example_input/9/[Content_Types].xml
|
153
|
+
- spec/example_input/9/docProps/app.xml
|
154
|
+
- spec/example_input/9/docProps/core.xml
|
155
|
+
- spec/example_input/9/word/_rels/document.xml.rels
|
156
|
+
- spec/example_input/9/word/document.xml
|
157
|
+
- spec/example_input/9/word/endnotes.xml
|
158
|
+
- spec/example_input/9/word/fontTable.xml
|
159
|
+
- spec/example_input/9/word/footnotes.xml
|
160
|
+
- spec/example_input/9/word/media/image1.jpeg
|
161
|
+
- spec/example_input/9/word/media/image2.jpeg
|
162
|
+
- spec/example_input/9/word/media/image3.jpeg
|
163
|
+
- spec/example_input/9/word/settings.xml
|
164
|
+
- spec/example_input/9/word/styles.xml
|
165
|
+
- spec/example_input/9/word/theme/theme1.xml
|
166
|
+
- spec/example_input/9/word/webSettings.xml
|
167
|
+
- spec/example_input/ExampleTemplate.docx
|
168
|
+
- spec/example_input/tmp/IntegrationTestOutput.docx
|
169
|
+
- spec/example_input/word/document.xml
|
170
|
+
- spec/example_input/~$3.docx
|
171
|
+
- spec/example_input/~$高考模拟卷.doc
|
172
|
+
- spec/example_input/高考模拟卷.doc
|
173
|
+
- spec/integration_spec.rb
|
174
|
+
- spec/spec.opts
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- spec/template_processor_spec.rb
|
177
|
+
has_rdoc:
|