rodf 0.3.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4baedf0ea44080eb12e4184c97e388dda1ad3174
|
4
|
+
data.tar.gz: 41f4048ce761bfc790c4e81f2b7e2f794b07e0fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f00589a65f0a1a77993c320ed7c7d39927c0bc1a609010f82c0f44119faa29e2de139e2c02fb303d8a1a9b7be0dc70b174fac58bc45a9d596eb4c704e21fb976
|
7
|
+
data.tar.gz: 9c9ea98eb21673b50eebb823c7c8b886bede10e3c86b14463c473f0b9eafca4bb24c0a4a5417d01e4cf242e5f379e252f5723a2314f10cfd7508c000429cdfed
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
v1.0.0 Rename main module ODF to RODF, Fix cell types
|
2
|
+
v0.3.7 Add Rails 5 support to gemspec
|
3
|
+
v0.3.6 Resulting ODF files as bitstrings
|
4
|
+
v0.3.5 Allows current libraries
|
5
|
+
v0.3.4 Procedural cell styling
|
6
|
+
v0.3.3 Documents can now write themselves to disk
|
7
|
+
v0.3.2 Fixes broken styles.xml
|
8
|
+
v0.3.1 Adds support for conditional formatting
|
9
|
+
v0.3.0 Allow parameterless blocks
|
10
|
+
v0.2.2 Reintroduce compatibility with Ruby 1.8
|
11
|
+
v0.2.1 Update to newer libraries and Ruby 1.9
|
12
|
+
v0.1.6 Fix date handling
|
13
|
+
v0.1.5 Bug fix
|
14
|
+
v0.1.4 Allow the setting of an entire cell's content to a hyperlink (by Merul Patel)
|
15
|
+
v0.1.3 Dependency fix (by Merul Patel)
|
16
|
+
v0.1.2 Cell span
|
17
|
+
v0.1.1 Basic spreadsheet styling support
|
18
|
+
v0.1.0 First version with very basic support for spreadsheet generation
|
data/README.md
CHANGED
@@ -1,100 +1,170 @@
|
|
1
|
-
|
1
|
+
<a href='https://ko-fi.com/A5071NK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
|
2
|
+
# RODF
|
2
3
|
|
3
|
-
This is a library for writing to ODF output from Ruby. It
|
4
|
-
supports creating spreadsheets (ODS) and text documents (ODT). Slide shows (ODP)
|
5
|
-
may be added some time in the future.
|
4
|
+
This is a library for writing to ODF output from Ruby. It mainly focuses creating ODS spreadsheets.
|
6
5
|
|
7
|
-
|
6
|
+
As well as writing ODS spreadsheets, this library also can write ODT text documents but it is undocumented and will require knowledge of the ODF spec. It currently does not support ODP Slide shows.
|
8
7
|
|
9
8
|
This is NOT an ODF reading library.
|
10
9
|
|
11
|
-
###
|
10
|
+
### v1.0.0 Breaking Changes
|
11
|
+
The main module `ODF` has changed to `RODF`
|
12
12
|
|
13
|
-
|
13
|
+
`require 'odf/spreadsheet'` must be changed to `require 'rodf'`
|
14
14
|
|
15
|
-
|
15
|
+
### Install
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install rodf
|
19
|
+
```
|
16
20
|
|
17
21
|
### How do I use it?
|
18
22
|
|
19
23
|
rODF works pretty much like Builder, but with ODF-aware constructs. Try this:
|
20
24
|
|
21
|
-
|
25
|
+
```ruby
|
26
|
+
require 'rodf'
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
RODF::Spreadsheet.file("my-spreadsheet.ods") do
|
29
|
+
table 'My first table from Ruby' do
|
30
|
+
row do
|
31
|
+
cell 'Hello, rODF world!'
|
27
32
|
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
28
36
|
|
29
|
-
|
37
|
+
Styling and formatting is also possible:
|
30
38
|
|
31
|
-
|
39
|
+
```ruby
|
40
|
+
require 'rodf'
|
32
41
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
table 'Red text table' do
|
38
|
-
row {cell 'Red', :style => 'red-cell' }
|
39
|
-
end
|
40
|
-
end
|
42
|
+
RODF::Spreadsheet.file("my-spreadsheet.ods") do
|
43
|
+
style 'red-cell', family: :cell do
|
44
|
+
property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
|
45
|
+
end
|
41
46
|
|
42
|
-
|
47
|
+
table 'Red text table' do
|
48
|
+
row do
|
49
|
+
cell 'Red', style: 'red-cell'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
```
|
43
54
|
|
44
|
-
|
55
|
+
Conditional formatting is also possible:
|
45
56
|
|
46
|
-
|
57
|
+
```ruby
|
58
|
+
require 'rodf'
|
47
59
|
|
48
|
-
|
49
|
-
property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
|
50
|
-
end
|
60
|
+
RODF::Spreadsheet.file("my-spreadsheet.ods") do
|
51
61
|
|
52
|
-
|
53
|
-
|
54
|
-
|
62
|
+
office_style 'red-cell', family: :cell do
|
63
|
+
property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
|
64
|
+
end
|
55
65
|
|
56
|
-
|
57
|
-
|
58
|
-
|
66
|
+
office_style 'green-cell', family: :cell do
|
67
|
+
property :text, 'font-weight' => 'bold', 'color' => '#00ff00'
|
68
|
+
end
|
59
69
|
|
60
|
-
|
61
|
-
|
62
|
-
|
70
|
+
# conditional formating must be defined as style and the value of
|
71
|
+
# apply-style-name must be an office_style
|
72
|
+
style 'cond1', family: :cell do
|
73
|
+
property :conditional, 'condition' => 'cell-content()<0', 'apply-style-name' => 'red-cell'
|
63
74
|
|
64
|
-
|
65
|
-
|
66
|
-
'apply-style-name' => 'green-cell'
|
67
|
-
end
|
75
|
+
property :conditional, 'condition' => 'cell-content()>0', 'apply-style-name' => 'green-cell'
|
76
|
+
end
|
68
77
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
78
|
+
table 'Red text table' do
|
79
|
+
row do
|
80
|
+
cell 'Red force', style: 'red-cell'
|
81
|
+
end
|
82
|
+
row do
|
83
|
+
cell '-4', type: :float, style: 'cond1'
|
84
|
+
end
|
85
|
+
row do
|
86
|
+
cell '0', type: :float, style: 'cond1'
|
75
87
|
end
|
88
|
+
row do
|
89
|
+
cell '5', type: :float, style: 'cond1'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
```
|
76
94
|
|
77
95
|
### Procedural style
|
78
96
|
|
79
97
|
The declarative style shown above is just syntatic sugar. A more procedural
|
80
98
|
style can also be used. Like so:
|
81
99
|
|
82
|
-
|
100
|
+
```ruby
|
101
|
+
require 'rodf'
|
83
102
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
103
|
+
ss = RODF::Spreadsheet.new
|
104
|
+
t = ss.table 'My first table from Ruby'
|
105
|
+
r = t.row
|
106
|
+
c = r.cell 'Hello, rODF world!'
|
88
107
|
|
89
|
-
|
108
|
+
# two methods to write to file
|
109
|
+
ss.write_to 'my-spreadsheet.ods'
|
110
|
+
# or
|
111
|
+
File.write('my-spreadsheet.ods') do |f|
|
112
|
+
f.write ss.bytes # you can send your data in Rails over HTTP using the bytes method
|
113
|
+
end
|
114
|
+
```
|
90
115
|
|
91
116
|
Both styles can be mixed and matched at will:
|
92
117
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
118
|
+
```ruby
|
119
|
+
require 'rodf'
|
120
|
+
|
121
|
+
ss = RODF::Spreadsheet.new
|
122
|
+
ss.table 'My first table from Ruby' do
|
123
|
+
row do
|
124
|
+
cell 'Hello, rODF world!'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
ss.write_to 'my-spreadsheet.ods'
|
129
|
+
```
|
130
|
+
|
131
|
+
### Style List
|
132
|
+
```ruby
|
133
|
+
property :text,
|
134
|
+
'font-weight' => :bold, #options are :bold, :thin
|
135
|
+
'font-size' => 12,
|
136
|
+
'font-name' => 'Arial',
|
137
|
+
'font-style' => 'italic',
|
138
|
+
'text-underline-style' => 'solid', # solid, dashed, dotted, double
|
139
|
+
'text-underline-type' => 'single',
|
140
|
+
'text-line-through-style' => 'solid',
|
141
|
+
align: true,
|
142
|
+
color: "#000000"
|
143
|
+
|
144
|
+
property :cell,
|
145
|
+
'background-color' => "#DDDDDD",
|
146
|
+
'wrap-option' => 'wrap',
|
147
|
+
'vertical_align' => 'automatic',
|
148
|
+
'border-top' => '0.75pt solid #999999',
|
149
|
+
'border-bottom' => '0.75pt solid #999999',
|
150
|
+
'border-left' => '0.75pt solid #999999',
|
151
|
+
'border-right' => '0.75pt solid #999999',
|
152
|
+
|
153
|
+
property :column,
|
154
|
+
'column-width' => '4.0cm'
|
155
|
+
|
156
|
+
property :row,
|
157
|
+
'row-height' => '18pt',
|
158
|
+
'use-optimal-row-height' => 'true'
|
159
|
+
|
160
|
+
property :table,
|
161
|
+
'writing-mode' => 'lr-tb',
|
162
|
+
```
|
163
|
+
|
164
|
+
|
165
|
+
### Credits
|
166
|
+
Created by [@thiagoarrais](https://github.com/thiagoarrais)
|
167
|
+
|
168
|
+
Currently maintained by [@westonganger](https://github.com/westonganger) to support simplified ODS spreadsheet making in the [spreadsheet_architect](https://github.com/westonganger/spreadsheet_architect) gem
|
169
|
+
|
170
|
+
<a href='https://ko-fi.com/A5071NK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
|
data/Rakefile
CHANGED
@@ -1,23 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/rodf/version.rb')
|
2
|
+
require 'bundler/gem_tasks'
|
2
3
|
require 'rspec/core/rake_task'
|
3
4
|
|
4
5
|
RSpec::Core::RakeTask.new
|
5
|
-
task :default => :spec
|
6
|
-
task :test => :spec
|
7
|
-
|
8
|
-
require 'echoe'
|
9
|
-
Echoe.new('rodf') do |gem|
|
10
|
-
gem.author = ["Weston Ganger", "Thiago Arrais", "Foivos Zakkak"]
|
11
|
-
gem.email = "thiago.arrais@gmail.com"
|
12
|
-
gem.url = "http://github.com/thiagoarrais/rodf/tree"
|
13
|
-
gem.summary = "ODF generation library for Ruby"
|
14
6
|
|
15
|
-
|
16
|
-
|
17
|
-
["rubyzip", "~> 1.0"],
|
18
|
-
["activesupport", ">= 3.0", "< 6.0"]]
|
19
|
-
gem.development_dependencies = [
|
20
|
-
["rspec", "~> 2.9"],
|
21
|
-
["rspec_hpricot_matchers" , "~> 1.0"],
|
22
|
-
["echoe" , "~> 4.6"]]
|
23
|
-
end
|
7
|
+
task :test => :spec
|
8
|
+
task :default => :test
|
data/lib/{odf → rodf}/cell.rb
RENAMED
@@ -15,34 +15,55 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
22
|
-
require '
|
20
|
+
require 'rodf/container'
|
21
|
+
require 'rodf/paragraph'
|
23
22
|
|
24
|
-
module
|
23
|
+
module RODF
|
25
24
|
class Cell < Container
|
26
25
|
contains :paragraphs
|
27
26
|
|
28
27
|
alias :p :paragraph
|
29
28
|
|
30
|
-
def initialize(
|
31
|
-
value
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
def initialize(value=nil, opts={})
|
30
|
+
if value.is_a?(Hash)
|
31
|
+
opts = value
|
32
|
+
value = ''
|
33
|
+
else
|
34
|
+
if value.is_a?(String)
|
35
|
+
value = value.strip
|
36
|
+
end
|
37
|
+
opts = {} unless opts.is_a?(Hash)
|
38
|
+
end
|
39
|
+
|
40
|
+
@value = value || ''
|
41
|
+
@type = opts[:type]
|
42
|
+
|
43
|
+
unless empty?(@value)
|
44
|
+
@url = opts[:url]
|
45
|
+
|
46
|
+
if !@type
|
47
|
+
if value.is_a?(Numeric)
|
48
|
+
@type = :float
|
49
|
+
elsif @value.respond_to?(:strftime)
|
50
|
+
@type = :date
|
51
|
+
@value = value.to_s
|
52
|
+
|
53
|
+
#if value.is_a?(Date)
|
54
|
+
# @value = value.strftime("%Y-%m-%d")
|
55
|
+
#else
|
56
|
+
# @value = value.strftime("%Y%m%dT%H%M%S")
|
57
|
+
#end
|
58
|
+
else
|
59
|
+
@type = :string
|
60
|
+
@value = value.to_s
|
61
|
+
end
|
41
62
|
end
|
42
63
|
end
|
43
64
|
|
44
65
|
@elem_attrs = make_element_attributes(@type, @value, opts)
|
45
|
-
@
|
66
|
+
@multiplier = (opts[:span] || 1).to_i
|
46
67
|
|
47
68
|
make_value_paragraph
|
48
69
|
end
|
@@ -56,31 +77,31 @@ module ODF
|
|
56
77
|
text = markup.tag! 'table:table-cell', @elem_attrs do |xml|
|
57
78
|
xml << paragraphs_xml
|
58
79
|
end
|
59
|
-
(@
|
80
|
+
(@multiplier - 1).times {text = markup.tag! 'table:table-cell'}
|
60
81
|
text
|
61
82
|
end
|
62
83
|
|
63
84
|
def contains_url?
|
64
|
-
|
85
|
+
!empty?(@url)
|
65
86
|
end
|
66
87
|
|
67
88
|
private
|
68
89
|
|
69
90
|
def contains_string?
|
70
|
-
:string == @type &&
|
91
|
+
:string == @type && !empty?(@value)
|
71
92
|
end
|
72
93
|
|
73
94
|
def make_element_attributes(type, value, opts)
|
74
95
|
attrs = {}
|
75
|
-
attrs['office:value-type'] = type if
|
76
|
-
attrs['office:date-value'] = value if
|
77
|
-
attrs['office:value'] = value if
|
96
|
+
attrs['office:value-type'] = type if type == :string || !empty?(value) || !opts[:formula].nil?
|
97
|
+
attrs['office:date-value'] = value if type == :date && !empty?(value)
|
98
|
+
attrs['office:value'] = value if type == :float && !empty?(value)
|
78
99
|
attrs['table:formula'] = opts[:formula] unless opts[:formula].nil?
|
79
100
|
attrs['table:style-name'] = opts[:style] unless opts[:style].nil?
|
80
101
|
attrs['table:number-columns-spanned'] = opts[:span] unless opts[:span].nil?
|
81
102
|
attrs['table:number-matrix-columns-spanned'] =
|
82
103
|
attrs['table:number-matrix-rows-spanned'] = 1 if opts[:matrix_formula]
|
83
|
-
attrs
|
104
|
+
return attrs
|
84
105
|
end
|
85
106
|
|
86
107
|
def make_value_paragraph
|
@@ -88,7 +109,7 @@ module ODF
|
|
88
109
|
cell, value, url = self, @value, @url
|
89
110
|
paragraph do
|
90
111
|
if cell.contains_url?
|
91
|
-
link value, :
|
112
|
+
link value, href: url
|
92
113
|
else
|
93
114
|
self << value
|
94
115
|
end
|
@@ -96,9 +117,9 @@ module ODF
|
|
96
117
|
end
|
97
118
|
end
|
98
119
|
|
99
|
-
def empty(value)
|
100
|
-
value.
|
120
|
+
def empty?(value)
|
121
|
+
value.respond_to?(:empty?) ? value.empty? : value.nil?
|
122
|
+
#respond_to?(:empty?) ? (value.empty? || value =~ /\A[[:space:]]*\z/) : value.nil?
|
101
123
|
end
|
102
124
|
end
|
103
125
|
end
|
104
|
-
|
data/lib/{odf → rodf}/column.rb
RENAMED
@@ -15,10 +15,9 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
module
|
20
|
+
module RODF
|
22
21
|
class Column
|
23
22
|
def initialize(opts={})
|
24
23
|
@elem_attrs = {}
|
File without changes
|
@@ -15,12 +15,9 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
|
-
gem 'activesupport', '>= 3.0', '< 6.0'
|
20
|
-
|
21
18
|
require 'active_support/inflector'
|
22
19
|
|
23
|
-
module
|
20
|
+
module RODF
|
24
21
|
class Container
|
25
22
|
def self.contains(*stuffs_array)
|
26
23
|
stuffs_array.map {|sym| sym.to_s}.each do |stuffs|
|
@@ -15,14 +15,12 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
|
-
|
20
18
|
require 'builder'
|
21
19
|
|
22
|
-
require '
|
23
|
-
require '
|
20
|
+
require 'rodf/container'
|
21
|
+
require 'rodf/style_section'
|
24
22
|
|
25
|
-
module
|
23
|
+
module RODF
|
26
24
|
class DataStyle < Container
|
27
25
|
contains :style_sections
|
28
26
|
|
@@ -15,15 +15,13 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
|
-
|
20
18
|
require 'zip'
|
21
19
|
|
22
|
-
require '
|
23
|
-
require '
|
24
|
-
require '
|
20
|
+
require 'rodf/container'
|
21
|
+
require 'rodf/skeleton'
|
22
|
+
require 'rodf/style'
|
25
23
|
|
26
|
-
module
|
24
|
+
module RODF
|
27
25
|
class Document < Container
|
28
26
|
contains :styles, :default_styles, :office_styles
|
29
27
|
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
20
|
+
require 'rodf/paragraph_container'
|
22
21
|
|
23
|
-
module
|
22
|
+
module RODF
|
24
23
|
class Hyperlink < ParagraphContainer
|
25
24
|
def initialize(first, second = {})
|
26
25
|
if second.instance_of?(Hash) && second.empty?
|
@@ -15,10 +15,9 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
module
|
20
|
+
module RODF
|
22
21
|
class MasterPage
|
23
22
|
def initialize(name, opts = {})
|
24
23
|
@name, @layout = name, opts[:layout]
|
@@ -15,13 +15,12 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
22
|
-
require '
|
20
|
+
require 'rodf/container'
|
21
|
+
require 'rodf/property'
|
23
22
|
|
24
|
-
module
|
23
|
+
module RODF
|
25
24
|
class PageLayout < Container
|
26
25
|
contains :properties
|
27
26
|
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
20
|
+
require 'rodf/paragraph_container'
|
22
21
|
|
23
|
-
module
|
22
|
+
module RODF
|
24
23
|
class Paragraph < ParagraphContainer
|
25
24
|
def initialize(fst = nil, snd = {})
|
26
25
|
first_is_hash = fst.instance_of? Hash
|
@@ -15,12 +15,11 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
20
|
+
require 'rodf/container'
|
22
21
|
|
23
|
-
module
|
22
|
+
module RODF
|
24
23
|
# Container for all kinds of paragraph content
|
25
24
|
class ParagraphContainer < Container
|
26
25
|
def content_parts
|
@@ -15,19 +15,18 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
module
|
20
|
+
module RODF
|
22
21
|
class Property
|
23
|
-
PROPERTY_NAMES = {:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
22
|
+
PROPERTY_NAMES = {cell: 'table-cell-properties',
|
23
|
+
text: 'text-properties',
|
24
|
+
column: 'table-column-properties',
|
25
|
+
row: 'table-row-properties',
|
26
|
+
page_layout: 'page-layout-properties',
|
27
|
+
header_footer: 'header-footer-properties',
|
28
|
+
list_level: 'list-level-properties',
|
29
|
+
conditional: 'map'}
|
31
30
|
TRANSLATED_SPECS = [:border_color, :border_style, :border_width]
|
32
31
|
|
33
32
|
ATTRIBUTES_TO_NAMESPACES = [[
|
data/lib/{odf → rodf}/row.rb
RENAMED
@@ -15,13 +15,12 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
22
|
-
require '
|
20
|
+
require 'rodf/container'
|
21
|
+
require 'rodf/cell'
|
23
22
|
|
24
|
-
module
|
23
|
+
module RODF
|
25
24
|
class Row < Container
|
26
25
|
contains :cells
|
27
26
|
attr_reader :number
|
File without changes
|
File without changes
|
data/lib/{odf → rodf}/span.rb
RENAMED
@@ -15,13 +15,12 @@
|
|
15
15
|
# You should have received a copy of the GNU Lesser General Public License
|
16
16
|
# along with rODF. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
|
18
|
-
require 'rubygems'
|
19
18
|
require 'builder'
|
20
19
|
|
21
|
-
require '
|
22
|
-
require '
|
20
|
+
require 'rodf/compatibility'
|
21
|
+
require 'rodf/paragraph_container'
|
23
22
|
|
24
|
-
module
|
23
|
+
module RODF
|
25
24
|
class TextNode
|
26
25
|
def initialize(content)
|
27
26
|
@content = content
|
@@ -34,6 +33,8 @@ module ODF
|
|
34
33
|
|
35
34
|
class Span < ParagraphContainer
|
36
35
|
def initialize(first, second = nil)
|
36
|
+
@style = nil
|
37
|
+
|
37
38
|
if first.instance_of?(Symbol)
|
38
39
|
@style = first
|
39
40
|
content_parts << TextNode.new(second) unless second.nil?
|