rodf 0.3.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +132 -62
  4. data/Rakefile +4 -19
  5. data/lib/{odf → rodf}/cell.rb +48 -27
  6. data/lib/{odf → rodf}/column.rb +1 -2
  7. data/lib/{odf → rodf}/compatibility.rb +0 -0
  8. data/lib/{odf → rodf}/container.rb +1 -4
  9. data/lib/{odf → rodf}/data_style.rb +3 -5
  10. data/lib/{odf → rodf}/document.rb +4 -6
  11. data/lib/{odf → rodf}/hyperlink.rb +2 -3
  12. data/lib/{odf → rodf}/master_page.rb +1 -2
  13. data/lib/{odf → rodf}/page_layout.rb +3 -4
  14. data/lib/{odf → rodf}/paragraph.rb +2 -3
  15. data/lib/{odf → rodf}/paragraph_container.rb +2 -3
  16. data/lib/{odf → rodf}/property.rb +9 -10
  17. data/lib/{odf → rodf}/row.rb +3 -4
  18. data/lib/{odf → rodf}/skeleton/manifest.xml.erb +0 -0
  19. data/lib/{odf → rodf}/skeleton/styles.pxml +0 -0
  20. data/lib/{odf → rodf}/skeleton.rb +1 -1
  21. data/lib/{odf → rodf}/span.rb +5 -4
  22. data/lib/{odf → rodf}/spreadsheet.rb +7 -12
  23. data/lib/{odf → rodf}/style.rb +4 -5
  24. data/lib/{odf → rodf}/style_section.rb +1 -3
  25. data/lib/{odf → rodf}/tab.rb +2 -3
  26. data/lib/{odf → rodf}/table.rb +4 -5
  27. data/lib/{odf → rodf}/text.rb +8 -10
  28. data/lib/rodf/version.rb +3 -0
  29. data/lib/rodf.rb +6 -0
  30. metadata +85 -108
  31. data/CHANGELOG +0 -17
  32. data/Gemfile +0 -9
  33. data/Manifest +0 -48
  34. data/rodf.gemspec +0 -48
  35. data/spec/cell_spec.rb +0 -189
  36. data/spec/data_style_spec.rb +0 -61
  37. data/spec/file_storage_spec.rb +0 -47
  38. data/spec/hyperlink_spec.rb +0 -62
  39. data/spec/master_page_spec.rb +0 -35
  40. data/spec/page_layout_spec.rb +0 -45
  41. data/spec/paragraph_spec.rb +0 -75
  42. data/spec/property_spec.rb +0 -270
  43. data/spec/row_spec.rb +0 -59
  44. data/spec/skeleton_spec.rb +0 -33
  45. data/spec/span_spec.rb +0 -65
  46. data/spec/spec_helper.rb +0 -23
  47. data/spec/spreadsheet_spec.rb +0 -123
  48. data/spec/style_section_spec.rb +0 -42
  49. data/spec/style_spec.rb +0 -109
  50. data/spec/tab_spec.rb +0 -34
  51. data/spec/table_spec.rb +0 -90
  52. data/spec/text_spec.rb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6df39b5334145e202ec1e0994066867281ff199
4
- data.tar.gz: b3aa43af22b6ff114d617ac829ca8b6f666e2d1d
3
+ metadata.gz: 4baedf0ea44080eb12e4184c97e388dda1ad3174
4
+ data.tar.gz: 41f4048ce761bfc790c4e81f2b7e2f794b07e0fe
5
5
  SHA512:
6
- metadata.gz: c2e0fea2bb28a9b6255f2944b250a1e2e013edffdcdba0fd9626146ec9f4ad53b8b7e000657cb2eea967f4ee0bf77875535236215cf12c00671e5bba03191504
7
- data.tar.gz: d089d0a704c5339380b17827140a152ceff5c63dcdc9d00a4043e808f8b3c017cafd9fdba65f89325b43aaee2c13c95ae6d4d73c3249678b048622ca1ec3782c
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
- # rODF
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 currently only
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
- Some knowledge of the [ODF spec](http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html) is required.
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
- ### Installation
10
+ ### v1.0.0 Breaking Changes
11
+ The main module `ODF` has changed to `RODF`
12
12
 
13
- You should be able to install the latest stable version by saying something like
13
+ `require 'odf/spreadsheet'` must be changed to `require 'rodf'`
14
14
 
15
- gem install rodf
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
- require 'odf/spreadsheet'
25
+ ```ruby
26
+ require 'rodf'
22
27
 
23
- ODF::Spreadsheet.file("my-spreadsheet.ods") do
24
- table 'My first table from Ruby' do
25
- row {cell 'Hello, rODF world!' }
26
- end
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
- Some basic formatting is also possible:
37
+ Styling and formatting is also possible:
30
38
 
31
- require 'odf/spreadsheet'
39
+ ```ruby
40
+ require 'rodf'
32
41
 
33
- ODF::Spreadsheet.file("my-spreadsheet.ods") do
34
- style 'red-cell', :family => :cell do
35
- property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
36
- end
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
- Some basic conditional formatting is also possible:
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
- require 'odf/spreadsheet'
55
+ Conditional formatting is also possible:
45
56
 
46
- ODF::Spreadsheet.file("my-spreadsheet.ods") do
57
+ ```ruby
58
+ require 'rodf'
47
59
 
48
- office_style 'red-cell', :family => :cell do
49
- property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
50
- end
60
+ RODF::Spreadsheet.file("my-spreadsheet.ods") do
51
61
 
52
- office_style 'green-cell', :family => :cell do
53
- property :text, 'font-weight' => 'bold', 'color' => '#00ff00'
54
- end
62
+ office_style 'red-cell', family: :cell do
63
+ property :text, 'font-weight' => 'bold', 'color' => '#ff0000'
64
+ end
55
65
 
56
- # conditional formating must be defined as style and the value of
57
- # apply-style-name must be an office_style
58
- style 'cond1', :family => :cell do
66
+ office_style 'green-cell', family: :cell do
67
+ property :text, 'font-weight' => 'bold', 'color' => '#00ff00'
68
+ end
59
69
 
60
- property :conditional,
61
- 'condition' => 'cell-content()<0',
62
- 'apply-style-name' => 'red-cell'
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
- property :conditional,
65
- 'condition' => 'cell-content()>0',
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
- table 'Red text table' do
70
- row {cell 'Red force', :style => 'red-cell' }
71
- row {cell '-4', :type => :float, :style => 'cond1' }
72
- row {cell '0', :type => :float, :style => 'cond1' }
73
- row {cell '5', :type => :float, :style => 'cond1' }
74
- end
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
- require 'odf/spreadsheet'
100
+ ```ruby
101
+ require 'rodf'
83
102
 
84
- ss = ODF::Spreadsheet.new
85
- t = ss.table 'My first table from Ruby'
86
- r = t.row
87
- c = r.cell 'Hello, rODF world!'
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
- ss.write_to 'my-spreadsheet.ods'
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
- require 'odf/spreadsheet'
94
-
95
- ss = ODF::Spreadsheet.new
96
- ss.table 'My first table from Ruby' do
97
- row { cell 'Hello, rODF world!' }
98
- end
99
-
100
- ss.write_to 'my-spreadsheet.ods'
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 'rubygems'
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
- gem.runtime_dependencies = [
16
- ["builder", "~> 3.0"],
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
@@ -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 'odf/container'
22
- require 'odf/paragraph'
20
+ require 'rodf/container'
21
+ require 'rodf/paragraph'
23
22
 
24
- module ODF
23
+ module RODF
25
24
  class Cell < Container
26
25
  contains :paragraphs
27
26
 
28
27
  alias :p :paragraph
29
28
 
30
- def initialize(*args)
31
- value = args.first || ''
32
- opts = args.last.instance_of?(Hash) ? args.last : {}
33
-
34
- @url = opts[:url]
35
- @type = opts[:type] || :string
36
- unless value.instance_of?(Hash)
37
- if value.respond_to? :strftime
38
- @value = value.strftime("%Y-%m-%d")
39
- else
40
- @value = value.to_s.strip
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
- @mutiply = (opts[:span] || 1).to_i
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
- (@mutiply - 1).times {text = markup.tag! 'table:table-cell'}
80
+ (@multiplier - 1).times {text = markup.tag! 'table:table-cell'}
60
81
  text
61
82
  end
62
83
 
63
84
  def contains_url?
64
- !@url.nil? && !@url.empty?
85
+ !empty?(@url)
65
86
  end
66
87
 
67
88
  private
68
89
 
69
90
  def contains_string?
70
- :string == @type && !@value.nil? && !@value.empty?
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 :string == type || !empty(value) || !opts[:formula].nil?
76
- attrs['office:date-value'] = value if :date == type && !empty(value)
77
- attrs['office:value'] = value if :float == type && !empty(value)
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, :href => url
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.nil? || value.empty?
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
-
@@ -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 ODF
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 ODF
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 'odf/container'
23
- require 'odf/style_section'
20
+ require 'rodf/container'
21
+ require 'rodf/style_section'
24
22
 
25
- module ODF
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 'odf/container'
23
- require 'odf/skeleton'
24
- require 'odf/style'
20
+ require 'rodf/container'
21
+ require 'rodf/skeleton'
22
+ require 'rodf/style'
25
23
 
26
- module ODF
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 'odf/paragraph_container'
20
+ require 'rodf/paragraph_container'
22
21
 
23
- module ODF
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 ODF
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 'odf/container'
22
- require 'odf/property'
20
+ require 'rodf/container'
21
+ require 'rodf/property'
23
22
 
24
- module ODF
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 'odf/paragraph_container'
20
+ require 'rodf/paragraph_container'
22
21
 
23
- module ODF
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 'odf/container'
20
+ require 'rodf/container'
22
21
 
23
- module ODF
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 ODF
20
+ module RODF
22
21
  class Property
23
- PROPERTY_NAMES = {:cell => 'table-cell-properties',
24
- :text => 'text-properties',
25
- :column => 'table-column-properties',
26
- :row => 'table-row-properties',
27
- :page_layout => 'page-layout-properties',
28
- :header_footer => 'header-footer-properties',
29
- :list_level => 'list-level-properties',
30
- :conditional => 'map'}
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 = [[
@@ -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 'odf/container'
22
- require 'odf/cell'
20
+ require 'rodf/container'
21
+ require 'rodf/cell'
23
22
 
24
- module ODF
23
+ module RODF
25
24
  class Row < Container
26
25
  contains :cells
27
26
  attr_reader :number
File without changes
File without changes
@@ -17,7 +17,7 @@
17
17
 
18
18
  require 'erb'
19
19
 
20
- module ODF
20
+ module RODF
21
21
  class Skeleton
22
22
  def manifest(document_type)
23
23
  ERB.new(template('manifest.xml.erb')).result(binding)
@@ -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 'odf/compatibility'
22
- require 'odf/paragraph_container'
20
+ require 'rodf/compatibility'
21
+ require 'rodf/paragraph_container'
23
22
 
24
- module ODF
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?