rodf 0.3.7 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +132 -62
- data/Rakefile +4 -19
- data/lib/{odf → rodf}/cell.rb +48 -27
- data/lib/{odf → rodf}/column.rb +1 -2
- data/lib/{odf → rodf}/compatibility.rb +0 -0
- data/lib/{odf → rodf}/container.rb +1 -4
- data/lib/{odf → rodf}/data_style.rb +3 -5
- data/lib/{odf → rodf}/document.rb +4 -6
- data/lib/{odf → rodf}/hyperlink.rb +2 -3
- data/lib/{odf → rodf}/master_page.rb +1 -2
- data/lib/{odf → rodf}/page_layout.rb +3 -4
- data/lib/{odf → rodf}/paragraph.rb +2 -3
- data/lib/{odf → rodf}/paragraph_container.rb +2 -3
- data/lib/{odf → rodf}/property.rb +9 -10
- data/lib/{odf → rodf}/row.rb +3 -4
- data/lib/{odf → rodf}/skeleton/manifest.xml.erb +0 -0
- data/lib/{odf → rodf}/skeleton/styles.pxml +0 -0
- data/lib/{odf → rodf}/skeleton.rb +1 -1
- data/lib/{odf → rodf}/span.rb +5 -4
- data/lib/{odf → rodf}/spreadsheet.rb +7 -12
- data/lib/{odf → rodf}/style.rb +4 -5
- data/lib/{odf → rodf}/style_section.rb +1 -3
- data/lib/{odf → rodf}/tab.rb +2 -3
- data/lib/{odf → rodf}/table.rb +4 -5
- data/lib/{odf → rodf}/text.rb +8 -10
- data/lib/rodf/version.rb +3 -0
- data/lib/rodf.rb +6 -0
- metadata +85 -108
- data/CHANGELOG +0 -17
- data/Gemfile +0 -9
- data/Manifest +0 -48
- data/rodf.gemspec +0 -48
- data/spec/cell_spec.rb +0 -189
- data/spec/data_style_spec.rb +0 -61
- data/spec/file_storage_spec.rb +0 -47
- data/spec/hyperlink_spec.rb +0 -62
- data/spec/master_page_spec.rb +0 -35
- data/spec/page_layout_spec.rb +0 -45
- data/spec/paragraph_spec.rb +0 -75
- data/spec/property_spec.rb +0 -270
- data/spec/row_spec.rb +0 -59
- data/spec/skeleton_spec.rb +0 -33
- data/spec/span_spec.rb +0 -65
- data/spec/spec_helper.rb +0 -23
- data/spec/spreadsheet_spec.rb +0 -123
- data/spec/style_section_spec.rb +0 -42
- data/spec/style_spec.rb +0 -109
- data/spec/tab_spec.rb +0 -34
- data/spec/table_spec.rb +0 -90
- data/spec/text_spec.rb +0 -79
data/spec/style_spec.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
# Copyright (c) 2008 Thiago Arrais
|
2
|
-
#
|
3
|
-
# This file is part of rODF.
|
4
|
-
#
|
5
|
-
# rODF is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Lesser General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of
|
8
|
-
# the License, or (at your option) any later version.
|
9
|
-
|
10
|
-
# rODF is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Lesser General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU Lesser General Public License
|
16
|
-
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
19
|
-
|
20
|
-
require 'odf/style'
|
21
|
-
|
22
|
-
describe ODF::Style do
|
23
|
-
it "should output properties when they're added" do
|
24
|
-
ODF::Style.create.should_not have_tag('//style:style/*')
|
25
|
-
|
26
|
-
output = ODF::Style.create 'odd-row-cell', :family => :cell do |s|
|
27
|
-
s.property :cell, 'background-color' => '#b3b3b3',
|
28
|
-
'border' => '0.002cm solid #000000'
|
29
|
-
s.property :text, 'color' => '#4c4c4c', 'font-weight' => 'bold'
|
30
|
-
end
|
31
|
-
|
32
|
-
output.should have_tag('//style:style/*', :count => 2)
|
33
|
-
output.should have_tag('//style:table-cell-properties')
|
34
|
-
output.should have_tag('//style:text-properties')
|
35
|
-
|
36
|
-
cell_elem = Hpricot(output).at('style:table-cell-properties')
|
37
|
-
cell_elem['fo:background-color'].should == '#b3b3b3'
|
38
|
-
cell_elem['fo:border'].should == '0.002cm solid #000000'
|
39
|
-
|
40
|
-
text_elem = Hpricot(output).at('style:text-properties')
|
41
|
-
text_elem['fo:color'].should == '#4c4c4c'
|
42
|
-
text_elem['fo:font-weight'].should == 'bold'
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should allow data styles" do
|
46
|
-
xml = ODF::Style.create 'my-style', :family => :cell,
|
47
|
-
:data_style => 'currency-grouped'
|
48
|
-
|
49
|
-
style = Hpricot(xml).at('//style:style')
|
50
|
-
style['style:data-style-name'].should == 'currency-grouped'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should allow parent styles" do
|
54
|
-
xml = ODF::Style.create 'child-style', :family => :cell,
|
55
|
-
:parent => 'cell-default'
|
56
|
-
|
57
|
-
style = Hpricot(xml).at('//style:style')
|
58
|
-
style['style:parent-style-name'].should == 'cell-default'
|
59
|
-
|
60
|
-
cell_style = ODF::Style.new('cell-default', :family => :cell)
|
61
|
-
xml = ODF::Style.create 'child-style', :family => :cell,
|
62
|
-
:parent => cell_style
|
63
|
-
|
64
|
-
style = Hpricot(xml).at('//style:style')
|
65
|
-
style['style:parent-style-name'].should == 'cell-default'
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should allow master pages" do
|
69
|
-
xml = ODF::Style.create 'standard',
|
70
|
-
:family => :paragraph,
|
71
|
-
:master_page => 'letter'
|
72
|
-
|
73
|
-
Hpricot(xml).at('//style:style')['style:master-page-name'].should == 'letter'
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should be able to describe column styles" do
|
77
|
-
xml = ODF::Style.create 'column-style', :family => :column do |style|
|
78
|
-
style.property :column, 'column-width' => '2cm'
|
79
|
-
end
|
80
|
-
|
81
|
-
Hpricot(xml).at('//style:style')['style:family'].should == 'table-column'
|
82
|
-
xml.should have_tag('//style:style/*', :count => 1)
|
83
|
-
xml.should have_tag('//style:table-column-properties')
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should be able to describe row styles" do
|
87
|
-
xml = ODF::Style.create 'column-style', :family => :row do |style|
|
88
|
-
end
|
89
|
-
|
90
|
-
Hpricot(xml).at('//style:style')['style:family'].should == 'table-row'
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should accept other families" do
|
94
|
-
Hpricot(ODF::Style.create('text-style', :family => :text)).
|
95
|
-
at('//style:style')['style:family'].should == 'text'
|
96
|
-
|
97
|
-
Hpricot(ODF::Style.create('text-style', :family => :paragraph)).
|
98
|
-
at('//style:style')['style:family'].should == 'paragraph'
|
99
|
-
end
|
100
|
-
|
101
|
-
it "should accept parameterless blocks" do
|
102
|
-
output = ODF::Style.create 'odd-row-cell', :family => :cell do
|
103
|
-
property :text, 'color' => '#4c4c4c', 'font-weight' => 'bold'
|
104
|
-
end
|
105
|
-
|
106
|
-
output.should have_tag('//style:style/*')
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
data/spec/tab_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# Copyright (c) 2010 Thiago Arrais
|
2
|
-
#
|
3
|
-
# This file is part of rODF.
|
4
|
-
#
|
5
|
-
# rODF is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Lesser General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of
|
8
|
-
# the License, or (at your option) any later version.
|
9
|
-
|
10
|
-
# rODF is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Lesser General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU Lesser General Public License
|
16
|
-
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
19
|
-
|
20
|
-
require 'odf/paragraph'
|
21
|
-
require 'odf/tab'
|
22
|
-
|
23
|
-
describe ODF::Tab do
|
24
|
-
it "should be placed inside paragraphs" do
|
25
|
-
output = ODF::Paragraph.create {|p|
|
26
|
-
p << "Tab"
|
27
|
-
p.tab
|
28
|
-
p << "test"
|
29
|
-
}
|
30
|
-
output.should have_tag("//text:p/*", :count => 3)
|
31
|
-
output.should have_tag("//text:tab")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
data/spec/table_spec.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# Copyright (c) 2008 Thiago Arrais
|
2
|
-
#
|
3
|
-
# This file is part of rODF.
|
4
|
-
#
|
5
|
-
# rODF is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Lesser General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of
|
8
|
-
# the License, or (at your option) any later version.
|
9
|
-
|
10
|
-
# rODF is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Lesser General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU Lesser General Public License
|
16
|
-
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
19
|
-
|
20
|
-
require 'odf/table'
|
21
|
-
|
22
|
-
describe ODF::Table do
|
23
|
-
it "should allow rows to be added" do
|
24
|
-
output = ODF::Table.create('Example') {|t| }
|
25
|
-
output.should have_tag('//table:table')
|
26
|
-
output.should_not have_tag('//table:table/*')
|
27
|
-
|
28
|
-
output = ODF::Table.create('MyTable') {|t| t.row }
|
29
|
-
output.should have_tag('//table:table/*', :count => 1)
|
30
|
-
output.should have_tag('//table:table-row')
|
31
|
-
|
32
|
-
output = ODF::Table.create('MyTable') {|t|
|
33
|
-
t.row
|
34
|
-
t.row
|
35
|
-
}
|
36
|
-
output.should have_tag('//table:table/*', :count => 2)
|
37
|
-
output.should have_tag('//table:table-row')
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should provide row numbers" do
|
41
|
-
output = ODF::Table.create('Row letter table') {|t|
|
42
|
-
t.row {|row| row.cell}
|
43
|
-
t.row {|row| row.cell(row.number)}
|
44
|
-
}
|
45
|
-
output.should have_tag('text:p')
|
46
|
-
Hpricot(output).at('text:p').innerHTML.should == '2'
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should allow column style specifications" do
|
50
|
-
xml = ODF::Table.create('Styles columns table') do |t|
|
51
|
-
t.column :style => 'wide'
|
52
|
-
end
|
53
|
-
|
54
|
-
xml.should have_tag('table:table-column')
|
55
|
-
column = Hpricot(xml).at('table:table-column')
|
56
|
-
column['table:style-name'].should == 'wide'
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should accept parameterless block" do
|
60
|
-
output = ODF::Table.create('MyTable') {
|
61
|
-
row
|
62
|
-
row
|
63
|
-
}
|
64
|
-
output.should have_tag('//table:table/*', :count => 2)
|
65
|
-
output.should have_tag('//table:table-row')
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should have children that accept parameterless blocks too" do
|
69
|
-
output = ODF::Table.create('MyTable') {
|
70
|
-
row {cell}
|
71
|
-
row
|
72
|
-
}
|
73
|
-
output.should have_tag('//table:table/*', :count => 2)
|
74
|
-
output.should have_tag('//table:table-row')
|
75
|
-
output.should have_tag('//table:table-cell')
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should have allow row styles" do
|
79
|
-
output = ODF::Table.create('MyTable') do
|
80
|
-
row style: :bold do
|
81
|
-
cell
|
82
|
-
end
|
83
|
-
row style: :underline do
|
84
|
-
cell
|
85
|
-
end
|
86
|
-
end
|
87
|
-
output.should include('table:table-row table:style-name="bold"')
|
88
|
-
output.should include('table:table-row table:style-name="underline"')
|
89
|
-
end
|
90
|
-
end
|
data/spec/text_spec.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
# Copyright (c) 2010 Thiago Arrais
|
2
|
-
#
|
3
|
-
# This file is part of rODF.
|
4
|
-
#
|
5
|
-
# rODF is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Lesser General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of
|
8
|
-
# the License, or (at your option) any later version.
|
9
|
-
|
10
|
-
# rODF is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Lesser General Public License for more details.
|
14
|
-
|
15
|
-
# You should have received a copy of the GNU Lesser General Public License
|
16
|
-
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
|
18
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
19
|
-
|
20
|
-
require 'odf/text'
|
21
|
-
|
22
|
-
describe ODF::Text do
|
23
|
-
it "should have the expected structure" do
|
24
|
-
output = ODF::Text.create
|
25
|
-
output.should have_tag('//office:document-content/*')
|
26
|
-
output.should have_tag('//office:body/*')
|
27
|
-
output.should have_tag('//office:text')
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have paragraphs" do
|
31
|
-
output = ODF::Text.create { |doc|
|
32
|
-
doc.paragraph "Hello"
|
33
|
-
doc.p "World!"
|
34
|
-
}
|
35
|
-
output.should have_tag('//office:text/*')
|
36
|
-
output.should have_tag('//text:p')
|
37
|
-
ps = Hpricot(output).search('text:p')
|
38
|
-
ps.size.should == 2
|
39
|
-
ps.first.innerHTML.should == 'Hello'
|
40
|
-
ps.last.innerHTML.should == 'World!'
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should allow styles" do
|
44
|
-
ODF::Text.create.should_not have_tag('//office:automatic-styles')
|
45
|
-
output = ODF::Text.create { |doc|
|
46
|
-
doc.style('bold', :family => 'text') {|s|
|
47
|
-
s.property(:text, 'font-weight' => 'bold') }
|
48
|
-
doc.style('italic', :family => 'text') {|s|
|
49
|
-
s.property(:text, 'font-weight' => 'italic') }
|
50
|
-
}
|
51
|
-
output.should have_tag('//office:automatic-styles/*', :count => 2)
|
52
|
-
output.should have_tag('//style:style')
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should support page layout as auto-style" do
|
56
|
-
output = ODF::Text.create { |doc|
|
57
|
-
doc.page_layout 'main-layout'
|
58
|
-
}
|
59
|
-
output.should have_tag('//office:automatic-styles/*', :count => 1)
|
60
|
-
output.should have_tag('//style:page-layout')
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should support master pages" do
|
64
|
-
output = ODF::Text.create do |doc|
|
65
|
-
doc.master_page 'standard', :layout => 'letter'
|
66
|
-
end
|
67
|
-
output.should have_tag('//office:master-styles/*', :count => 1)
|
68
|
-
output.should have_tag('//style:master-page')
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should support default styles" do
|
72
|
-
output = ODF::Text.create do |doc|
|
73
|
-
doc.default_style :family => 'paragraph'
|
74
|
-
end
|
75
|
-
output.should have_tag('//office:styles/*', :count => 1)
|
76
|
-
output.should have_tag('//style:default-style')
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|