rodf 0.3.7 → 1.2.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 +5 -5
- data/CHANGELOG.md +77 -0
- data/LICENSE +7 -0
- data/README.md +244 -64
- data/Rakefile +9 -17
- data/lib/rodf/cell.rb +171 -0
- data/lib/rodf/column.rb +21 -0
- data/lib/rodf/container.rb +18 -0
- data/lib/rodf/data_style.rb +46 -0
- data/lib/rodf/document.rb +133 -0
- data/lib/rodf/hyperlink.rb +33 -0
- data/lib/rodf/master_page.rb +11 -0
- data/lib/rodf/page_layout.rb +41 -0
- data/lib/rodf/paragraph.rb +28 -0
- data/lib/rodf/paragraph_container.rb +30 -0
- data/lib/rodf/property.rb +138 -0
- data/lib/rodf/row.rb +56 -0
- data/lib/{odf → rodf}/skeleton/manifest.xml.erb +0 -0
- data/lib/{odf → rodf}/skeleton/styles.pxml +0 -0
- data/lib/rodf/skeleton.rb +17 -0
- data/lib/rodf/span.rb +45 -0
- data/lib/rodf/spreadsheet.rb +113 -0
- data/lib/rodf/style.rb +77 -0
- data/lib/rodf/style_section.rb +33 -0
- data/lib/rodf/tab.rb +17 -0
- data/lib/rodf/table.rb +95 -0
- data/lib/rodf/text.rb +126 -0
- data/lib/rodf/version.rb +3 -0
- data/lib/rodf.rb +31 -0
- metadata +76 -115
- data/CHANGELOG +0 -17
- data/Gemfile +0 -9
- data/LICENSE.LGPL +0 -166
- data/Manifest +0 -48
- data/lib/odf/cell.rb +0 -104
- data/lib/odf/column.rb +0 -33
- data/lib/odf/compatibility.rb +0 -25
- data/lib/odf/container.rb +0 -57
- data/lib/odf/data_style.rb +0 -45
- data/lib/odf/document.rb +0 -67
- data/lib/odf/hyperlink.rb +0 -51
- data/lib/odf/master_page.rb +0 -33
- data/lib/odf/page_layout.rb +0 -39
- data/lib/odf/paragraph.rb +0 -46
- data/lib/odf/paragraph_container.rb +0 -35
- data/lib/odf/property.rb +0 -131
- data/lib/odf/row.rb +0 -44
- data/lib/odf/skeleton.rb +0 -34
- data/lib/odf/span.rb +0 -70
- data/lib/odf/spreadsheet.rb +0 -64
- data/lib/odf/style.rb +0 -65
- data/lib/odf/style_section.rb +0 -42
- data/lib/odf/tab.rb +0 -38
- data/lib/odf/table.rb +0 -50
- data/lib/odf/text.rb +0 -66
- 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/hyperlink_spec.rb
DELETED
@@ -1,62 +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/hyperlink'
|
21
|
-
|
22
|
-
describe ODF::Hyperlink do
|
23
|
-
it "should receive content text in first argument" do
|
24
|
-
output = ODF::Hyperlink.new('link somewhere', :href => 'http://www.example.org/').xml
|
25
|
-
output.should have_tag('//text:a')
|
26
|
-
|
27
|
-
link = Hpricot(output).at('text:a')
|
28
|
-
link.innerHTML.should == 'link somewhere'
|
29
|
-
link['xlink:href'].should == 'http://www.example.org/'
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should accept ref both in second argument as in argument hash" do
|
33
|
-
Hpricot(ODF::Hyperlink.new('link somewhere', :href => 'http://www.example.org/').xml).
|
34
|
-
at('text:a')['xlink:href'].should == 'http://www.example.org/'
|
35
|
-
|
36
|
-
Hpricot(ODF::Hyperlink.new('link somewhere', 'http://www.example.org/').xml).
|
37
|
-
at('text:a')['xlink:href'].should == 'http://www.example.org/'
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should allow nested span elements" do
|
41
|
-
output = ODF::Hyperlink.create 'http://www.example.com/' do |link|
|
42
|
-
link.strong 'important link'
|
43
|
-
end
|
44
|
-
|
45
|
-
output.should have_tag('//text:a/*', :count => 1)
|
46
|
-
tree = Hpricot(output)
|
47
|
-
tree.at('//text:a')['xlink:href'].should == 'http://www.example.com/'
|
48
|
-
span = tree.at('//text:span')
|
49
|
-
span['text:style-name'].should == 'strong'
|
50
|
-
span.innerHTML.should == 'important link'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should accept parameterless blocks" do
|
54
|
-
output = ODF::Hyperlink.create 'http://www.example.com/' do
|
55
|
-
strong 'important link'
|
56
|
-
end
|
57
|
-
|
58
|
-
output.should have_tag('//text:a/*')
|
59
|
-
output.should have_tag('//text:span/*')
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
data/spec/master_page_spec.rb
DELETED
@@ -1,35 +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/master_page'
|
21
|
-
|
22
|
-
describe ODF::MasterPage do
|
23
|
-
it "should have a name" do
|
24
|
-
output = ODF::MasterPage.new('my-master-page').xml
|
25
|
-
output.should have_tag('//style:master-page')
|
26
|
-
|
27
|
-
Hpricot(output).at('style:master-page')['style:name'].should == 'my-master-page'
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should accept a layout reference" do
|
31
|
-
Hpricot(ODF::MasterPage.new('my-master-page', :layout => 'A4').xml).
|
32
|
-
at('style:master-page')['style:page-layout-name'].should == 'A4'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
data/spec/page_layout_spec.rb
DELETED
@@ -1,45 +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/page_layout'
|
21
|
-
|
22
|
-
describe ODF::PageLayout do
|
23
|
-
it "should have a name" do
|
24
|
-
output = ODF::PageLayout.new('main-layout').xml
|
25
|
-
output.should have_tag('style:page-layout')
|
26
|
-
Hpricot(output).at('style:page-layout')['style:name'].should == 'main-layout'
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have properties" do
|
30
|
-
output = ODF::PageLayout.create 'main-layout' do |l|
|
31
|
-
l.property 'page-layout'
|
32
|
-
end
|
33
|
-
output.should have_tag('//style:page-layout/*', :count => 1)
|
34
|
-
output.should have_tag('style:page-layout-properties')
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should accept parameterless blocks" do
|
38
|
-
output = ODF::PageLayout.create 'main-layout' do
|
39
|
-
property 'page-layout'
|
40
|
-
end
|
41
|
-
output.should have_tag('//style:page-layout/*', :count => 1)
|
42
|
-
output.should have_tag('style:page-layout-properties')
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
data/spec/paragraph_spec.rb
DELETED
@@ -1,75 +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
|
-
|
22
|
-
describe ODF::Paragraph do
|
23
|
-
it "should allow text content inside" do
|
24
|
-
output = ODF::Paragraph.new('Hello').xml
|
25
|
-
output.should have_tag('//text:p')
|
26
|
-
Hpricot(output).at('text:p').innerHTML.should == 'Hello'
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should accept an input sequence" do
|
30
|
-
output = ODF::Paragraph.create { |p|
|
31
|
-
p << "Hello, "
|
32
|
-
p << "world!"
|
33
|
-
}
|
34
|
-
output.should have_tag('//text:p')
|
35
|
-
Hpricot(output).at('text:p').innerHTML.should == 'Hello, world!'
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should accept styled spans" do
|
39
|
-
output = ODF::Paragraph.create { |p|
|
40
|
-
p << "Hello, "
|
41
|
-
p.span :bold, "world! "
|
42
|
-
p << "This is not bold. "
|
43
|
-
p.bold "But this is."
|
44
|
-
}
|
45
|
-
spans = Hpricot(output).at('text:p').search('text:span')
|
46
|
-
spans.first.innerHTML.should == 'world! '
|
47
|
-
spans.first['text:style-name'].should == 'bold'
|
48
|
-
spans.last.innerHTML.should == 'But this is.'
|
49
|
-
spans.last['text:style-name'].should == 'bold'
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should be able to hold hyperlinks" do
|
53
|
-
output = ODF::Paragraph.create {|p|
|
54
|
-
p << "please visit "
|
55
|
-
p.a "example.org", :href => "http://www.example.org/"
|
56
|
-
p << " for more details"
|
57
|
-
}
|
58
|
-
output.should have_tag("//text:p/*", :count => 3)
|
59
|
-
output.should have_tag("//text:a")
|
60
|
-
|
61
|
-
Hpricot(output).at('text:a').innerHTML.should == 'example.org'
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should support style attribute" do
|
65
|
-
Hpricot(ODF::Paragraph.create('styled paragraph', :style => 'highlight')).
|
66
|
-
at('text:p')['text:style-name'].should == 'highlight'
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should accept attributes in the first parameter too" do
|
70
|
-
para = Hpricot(ODF::Paragraph.create(:style => 'testing')).at('text:p')
|
71
|
-
para.innerHTML.should be_empty
|
72
|
-
para['text:style-name'].should == 'testing'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
data/spec/property_spec.rb
DELETED
@@ -1,270 +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/property'
|
21
|
-
|
22
|
-
describe ODF::Property do
|
23
|
-
it "should accept either strings or symbols as keys" do
|
24
|
-
property = ODF::Property.new :text, :color=>'#4c4c4c', 'font-weight'=>'bold'
|
25
|
-
elem = Hpricot(property.xml).at('style:text-properties')
|
26
|
-
elem['fo:color'].should == '#4c4c4c'
|
27
|
-
elem['fo:font-weight'].should == 'bold'
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should prefix style properties with looked up namespace" do
|
31
|
-
Hpricot(ODF::Property.new(:cell, 'rotation-angle' => '-90').xml).
|
32
|
-
at('//style:table-cell-properties')['style:rotation-angle'].should == '-90'
|
33
|
-
Hpricot(ODF::Property.new(:row, 'row-height' => '2cm').xml).
|
34
|
-
at('//style:table-row-properties')['style:row-height'].should == '2cm'
|
35
|
-
Hpricot(ODF::Property.new(:column, 'column-width' => '2cm').xml).
|
36
|
-
at('//style:table-column-properties')['style:column-width'].should == '2cm'
|
37
|
-
Hpricot(ODF::Property.new(:text, 'text-underline-type' => 'single').xml).
|
38
|
-
at('style:text-properties')['style:text-underline-type'].should == 'single'
|
39
|
-
Hpricot(ODF::Property.new(:paragraph, 'tab-stop-distance' => '0.4925in').xml).
|
40
|
-
at('style:paragraph-properties')['style:tab-stop-distance'].should == '0.4925in'
|
41
|
-
Hpricot(ODF::Property.new(:page_layout, 'border-line-width' => '2px').xml).
|
42
|
-
at('style:page-layout-properties')['style:border-line-width'].should == '2px'
|
43
|
-
Hpricot(ODF::Property.new(:header_footer, 'border-line-width' => '2px').xml).
|
44
|
-
at('style:header-footer-properties')['style:border-line-width'].should == '2px'
|
45
|
-
Hpricot(ODF::Property.new(:ruby, 'ruby-position' => 'above').xml).
|
46
|
-
at('style:ruby-properties')['style:ruby-position'].should == 'above'
|
47
|
-
Hpricot(ODF::Property.new(:section, 'editable' => true).xml).
|
48
|
-
at('style:section-properties')['style:editable'].should == 'true'
|
49
|
-
Hpricot(ODF::Property.new(:table, 'align' => 'left').xml).
|
50
|
-
at('style:table-properties')['table:align'].should == 'left'
|
51
|
-
Hpricot(ODF::Property.new(:list_level, 'space-before' => '2em').xml).
|
52
|
-
at('style:list-level-properties')['text:space-before'].should == '2em'
|
53
|
-
# style:graphic-properties
|
54
|
-
# style:chart-properties
|
55
|
-
# style:drawing-page-properties
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should generate row properties tag" do
|
59
|
-
property = ODF::Property.new :row, 'background-color' => '#f5f57a'
|
60
|
-
|
61
|
-
property.xml.should have_tag('//style:table-row-properties')
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should accept full perimeter border specs" do
|
65
|
-
property = ODF::Property.new :cell, :border => "0.025in solid #000000"
|
66
|
-
|
67
|
-
Hpricot(property.xml).at('//style:table-cell-properties')['fo:border'].
|
68
|
-
should == "0.025in solid #000000"
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should accept splited full perimeter border specs" do
|
72
|
-
property = ODF::Property.new :cell, :border_width => '0.025in',
|
73
|
-
:border_color => '#000000',
|
74
|
-
:border_style => 'solid'
|
75
|
-
|
76
|
-
Hpricot(property.xml).at('//style:table-cell-properties')['fo:border'].
|
77
|
-
should == "0.025in solid #000000"
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should use the first value for vertical and second for horizontal border side specs" do
|
81
|
-
property = ODF::Property.new :cell, :border_width => '0.025in 0.3in',
|
82
|
-
:border_color => '#ff0000 #0000ff',
|
83
|
-
:border_style => 'solid'
|
84
|
-
|
85
|
-
elem= Hpricot(property.xml).at('//style:table-cell-properties')
|
86
|
-
elem['fo:border-top'].should == "0.025in solid #ff0000"
|
87
|
-
elem['fo:border-right'].should == "0.3in solid #0000ff"
|
88
|
-
elem['fo:border-bottom'].should == "0.025in solid #ff0000"
|
89
|
-
elem['fo:border-left'].should == "0.3in solid #0000ff"
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should use the third value for bottom border specs when present" do
|
93
|
-
property = ODF::Property.new :cell, :border_width => '0.025in 0.3in 0.4in',
|
94
|
-
:border_color => '#ff0000 #0000ff',
|
95
|
-
:border_style => 'dotted solid solid'
|
96
|
-
|
97
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
98
|
-
elem['fo:border-bottom'].should == "0.4in solid #ff0000"
|
99
|
-
|
100
|
-
property = ODF::Property.new :cell, :border_width => '0.025in',
|
101
|
-
:border_color => '#ff0000 #0000ff #00ff00',
|
102
|
-
:border_style => 'dotted solid'
|
103
|
-
|
104
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
105
|
-
elem['fo:border-bottom'].should == "0.025in dotted #00ff00"
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should cascade left border specs from fourth to second to first" do
|
109
|
-
property = ODF::Property.new :cell, :border_width => '0.1in 0.2in 0.3in 0.4in',
|
110
|
-
:border_color => '#ff0000 #0000ff #00ff00',
|
111
|
-
:border_style => 'dotted solid'
|
112
|
-
|
113
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
114
|
-
elem['fo:border-left'].should == "0.4in solid #0000ff"
|
115
|
-
|
116
|
-
property = ODF::Property.new :cell, :border_width => '0.1in 0.2in 0.3in',
|
117
|
-
:border_color => '#ff0000 #0000ff',
|
118
|
-
:border_style => 'dotted'
|
119
|
-
|
120
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
121
|
-
elem['fo:border-left'].should == "0.2in dotted #0000ff"
|
122
|
-
|
123
|
-
property = ODF::Property.new :cell, :border_width => '0.1in 0.2in',
|
124
|
-
:border_color => '#ff0000',
|
125
|
-
:border_style => 'dotted solid dashed double'
|
126
|
-
|
127
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
128
|
-
elem['fo:border-left'].should == "0.2in double #ff0000"
|
129
|
-
|
130
|
-
property = ODF::Property.new :cell, :border_width => '0.1in',
|
131
|
-
:border_color => '#ff0000 #0000ff #00ff00 #ffff00',
|
132
|
-
:border_style => 'dotted solid dashed'
|
133
|
-
|
134
|
-
elem = Hpricot(property.xml).at('//style:table-cell-properties')
|
135
|
-
elem['fo:border-left'].should == "0.1in solid #ffff00"
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should support paragraph properties" do
|
139
|
-
ODF::Property.new(:paragraph).xml.
|
140
|
-
should have_tag('style:paragraph-properties')
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should know the namespace for style:text-properties style properties" do
|
144
|
-
#see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416402_253892949
|
145
|
-
['country-asian', 'country-complex', 'font-charset', 'font-charset-asian',
|
146
|
-
'font-charset-complex', 'font-family-asian', 'font-family-complex', 'font-family-generic',
|
147
|
-
'font-family-generic-asian', 'font-family-generic-complex', 'font-name', 'font-name-asian',
|
148
|
-
'font-name-complex', 'font-pitch', 'font-pitch-asian', 'font-pitch-complex', 'font-relief',
|
149
|
-
'font-size-asian', 'font-size-complex', 'font-size-rel', 'font-size-rel-asian',
|
150
|
-
'font-size-rel-complex', 'font-style-asian', 'font-style-complex', 'font-style-name',
|
151
|
-
'font-style-name-asian', 'font-style-name-complex', 'font-weight-asian', 'font-weight-complex',
|
152
|
-
'language-asian', 'language-complex', 'letter-kerning', 'rfc-language-tag',
|
153
|
-
'rfc-language-tag-asian', 'rfc-language-tag-complex', 'script-asian', 'script-complex',
|
154
|
-
'script-type', 'text-blinking', 'text-combine', 'text-combine-end-char',
|
155
|
-
'text-combine-start-char', 'text-emphasize', 'text-line-through-color',
|
156
|
-
'text-line-through-mode', 'text-line-through-style', 'text-line-through-text',
|
157
|
-
'text-line-through-text-style', 'text-line-through-type', 'text-line-through-width',
|
158
|
-
'text-outline', 'text-overline-color', 'text-overline-mode', 'text-overline-style',
|
159
|
-
'text-overline-type', 'text-overline-width', 'text-position', 'text-rotation-angle',
|
160
|
-
'text-rotation-scale', 'text-scale', 'text-underline-color', 'text-underline-mode',
|
161
|
-
'text-underline-style', 'text-underline-type', 'text-underline-width', 'use-window-font-color'].
|
162
|
-
each do |prop|
|
163
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should know the namespace for style:table-cell-properties style properties" do
|
168
|
-
#see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416518_253892949
|
169
|
-
['border-line-width', 'border-line-width-bottom', 'border-line-width-left',
|
170
|
-
'border-line-width-right', 'border-line-width-top', 'cell-protect', 'decimal-places',
|
171
|
-
'diagonal-bl-tr', 'diagonal-bl-tr-widths', 'diagonal-tl-br', 'diagonal-tl-br-widths',
|
172
|
-
'direction', 'glyph-orientation-vertical', 'print-content', 'repeat-content',
|
173
|
-
'rotation-align', 'rotation-angle', 'shadow', 'shrink-to-fit', 'text-align-source',
|
174
|
-
'vertical-align', 'writing-mode'].
|
175
|
-
each do |prop|
|
176
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
it "should know the namespace for style:table-cell-properties style properties" do
|
181
|
-
#see http://docs.oasis-open.org/office/v1.2/os/opendocument-v1.2-os-part1.html#__refheading__1416516_253892949
|
182
|
-
['min-row-height', 'row-height', 'use-optimal-row-height'].each do |prop|
|
183
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
it "should know the namespace for style:table-row-properties style properties" do
|
188
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416514_253892949
|
189
|
-
['column-width', 'rel-column-width', 'use-optimal-column-width'].each do |prop|
|
190
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should know the namespace for style:paragraph-properties style properties" do
|
195
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416494_253892949
|
196
|
-
['auto-text-indent', 'background-transparency', 'border-line-width', 'border-line-width-bottom',
|
197
|
-
'border-line-width-left', 'border-line-width-right', 'border-line-width-top',
|
198
|
-
'font-independent-line-spacing', 'join-border', 'justify-single-word', 'line-break',
|
199
|
-
'line-height-at-least', 'line-spacing', 'page-number', 'punctuation-wrap', 'register-true',
|
200
|
-
'shadow', 'snap-to-layout-grid', 'tab-stop-distance', 'text-autospace', 'vertical-align',
|
201
|
-
'writing-mode', 'writing-mode-automatic'].
|
202
|
-
each do |prop|
|
203
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
it "should know the namespace for style:page-layout-properties style properties" do
|
208
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416486_253892949
|
209
|
-
['border-line-width', 'border-line-width-bottom', 'border-line-width-left', 'border-line-width-right',
|
210
|
-
'border-line-width-top', 'first-page-number', 'footnote-max-height', 'layout-grid-base-height',
|
211
|
-
'layout-grid-base-width', 'layout-grid-color', 'layout-grid-display', 'layout-grid-lines',
|
212
|
-
'layout-grid-mode', 'layout-grid-print', 'layout-grid-ruby-below', 'layout-grid-ruby-height',
|
213
|
-
'layout-grid-snap-to', 'layout-grid-standard-mode', 'num-format', 'num-letter-sync',
|
214
|
-
'num-prefix', 'num-suffix', 'paper-tray-name', 'print', 'print-orientation', 'print-page-order',
|
215
|
-
'register-truth-ref-style-name', 'scale-to', 'scale-to-pages', 'shadow', 'table-centering',
|
216
|
-
'writing-mode'].
|
217
|
-
each do |prop|
|
218
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
it "should know the namespace for style:header-footer-properties style and svg properties" do
|
223
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416492_253892949
|
224
|
-
['border-line-width', 'border-line-width-bottom', 'border-line-width-left', 'border-line-width-right',
|
225
|
-
'border-line-width-top', 'dynamic-spacing', 'shadow'].
|
226
|
-
each do |prop|
|
227
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
228
|
-
end
|
229
|
-
ODF::Property.lookup_namespace_for('height').should == 'svg'
|
230
|
-
end
|
231
|
-
|
232
|
-
it "should know the namespace for style:ruby-properties style properties" do
|
233
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1416502_253892949
|
234
|
-
['ruby-align', 'ruby-position'].each do |prop|
|
235
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
it "should know the namespace for style:section-properties style and text properties" do
|
240
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-style_section-properties
|
241
|
-
['editable', 'protect', 'writing-mode'].each do |prop|
|
242
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
243
|
-
end
|
244
|
-
ODF::Property.lookup_namespace_for('dont-balance-text-columns').should == 'text'
|
245
|
-
end
|
246
|
-
|
247
|
-
it "should know the namespace for style:table-properties style and table properties" do
|
248
|
-
# see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#element-style_table-properties
|
249
|
-
['may-break-between-rows', 'page-number', 'rel-width', 'shadow', 'width', 'writing-mode'].
|
250
|
-
each do |prop|
|
251
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
252
|
-
end
|
253
|
-
['align', 'border-model', 'display'].each do |prop|
|
254
|
-
ODF::Property.lookup_namespace_for(prop).should == 'table'
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
it "should know the namespace for style:list-level-properties style, svg and text properties" do
|
259
|
-
['font-name', 'vertical-pos', 'vertical-rel'].each do |prop|
|
260
|
-
ODF::Property.lookup_namespace_for(prop).should == 'style'
|
261
|
-
end
|
262
|
-
ODF::Property.lookup_namespace_for('y').should == 'svg'
|
263
|
-
['list-level-position-and-space-mode', 'min-label-distance', 'min-label-width',
|
264
|
-
'space-before'].
|
265
|
-
each do |prop|
|
266
|
-
ODF::Property.lookup_namespace_for(prop).should == 'text'
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
data/spec/row_spec.rb
DELETED
@@ -1,59 +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/row'
|
21
|
-
|
22
|
-
describe ODF::Row do
|
23
|
-
it "should allow cells to be added" do
|
24
|
-
output = ODF::Row.create
|
25
|
-
output.should have_tag('//table:table-row')
|
26
|
-
output.should_not have_tag('//table:table-row/*')
|
27
|
-
|
28
|
-
output = ODF::Row.create {|r|
|
29
|
-
r.cell
|
30
|
-
r.cell
|
31
|
-
}
|
32
|
-
output.should have_tag('//table:table-row/*', :count => 2)
|
33
|
-
output.should have_tag('//table:table-cell')
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should accept parameterless blocks" do
|
37
|
-
output = ODF::Row.create do
|
38
|
-
cell
|
39
|
-
cell
|
40
|
-
end
|
41
|
-
output.should have_tag('//table:table-row/*', :count => 2)
|
42
|
-
output.should have_tag('//table:table-cell')
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be stylable in the initialization" do
|
46
|
-
output = ODF::Row.create 0, :style => 'dark' do
|
47
|
-
cell
|
48
|
-
end
|
49
|
-
Hpricot(output).at('table:table-row')['table:style-name'].
|
50
|
-
should == 'dark'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should be attr_writer stylable" do
|
54
|
-
row = ODF::Row.new
|
55
|
-
row.style = 'dark'
|
56
|
-
Hpricot(row.xml).at('table:table-row')['table:style-name'].
|
57
|
-
should == 'dark'
|
58
|
-
end
|
59
|
-
end
|
data/spec/skeleton_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Foivos Zakkak
|
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/skeleton'
|
21
|
-
|
22
|
-
describe ODF::Skeleton do
|
23
|
-
it "should have the expected structure" do
|
24
|
-
output = ODF::Skeleton.new.styles
|
25
|
-
output.should have_tag('//office:document-styles/*')
|
26
|
-
output.should have_tag('//office:font-face-decls')
|
27
|
-
output.should have_tag('//office:styles', :count => 1)
|
28
|
-
output.should have_tag('//style:style', :count => 1)
|
29
|
-
output.should have_tag('//number:number-style', :count => 2)
|
30
|
-
output.should have_tag('//number:date-style', :count => 1)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
data/spec/span_spec.rb
DELETED
@@ -1,65 +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/span'
|
21
|
-
|
22
|
-
describe ODF::Span do
|
23
|
-
it "should print non-styled spans in pure text" do
|
24
|
-
ODF::Span.new('no style').xml.should == 'no style'
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should wrap styled output in span tags" do
|
28
|
-
output = ODF::Span.new(:italics, 'styled text').xml
|
29
|
-
output.should have_tag('text:span')
|
30
|
-
span = Hpricot(output).at('text:span')
|
31
|
-
span['text:style-name'].should == 'italics'
|
32
|
-
span.innerHTML.should == 'styled text'
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should allow nesting" do
|
36
|
-
output = ODF::Span.create :bold do |s|
|
37
|
-
s.italics 'highlighted text'
|
38
|
-
end
|
39
|
-
|
40
|
-
output.should have_tag('//text:span/*', :count => 2)
|
41
|
-
Hpricot(output).search('//text:span')[1].
|
42
|
-
innerHTML.should == 'highlighted text'
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should allow links" do
|
46
|
-
output = ODF::Span.create :bold do |s|
|
47
|
-
s.link 'there', 'http://www.example.org/'
|
48
|
-
s << ' and '
|
49
|
-
s.a 'back again', 'http://www.example.com/'
|
50
|
-
end
|
51
|
-
|
52
|
-
output.should have_tag('//text:a', :count => 2)
|
53
|
-
elem = Hpricot(output)
|
54
|
-
|
55
|
-
links = elem.search('//text:a')
|
56
|
-
links.first.innerHTML.should == 'there'
|
57
|
-
links.last.innerHTML.should == 'back again'
|
58
|
-
|
59
|
-
elem.at('//text:span').children[1].to_plain_text.should == " and "
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should escape entities" do
|
63
|
-
ODF::Span.create('Fish & Chips').should == 'Fish & Chips'
|
64
|
-
end
|
65
|
-
end
|