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.
Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +77 -0
  3. data/LICENSE +7 -0
  4. data/README.md +244 -64
  5. data/Rakefile +9 -17
  6. data/lib/rodf/cell.rb +171 -0
  7. data/lib/rodf/column.rb +21 -0
  8. data/lib/rodf/container.rb +18 -0
  9. data/lib/rodf/data_style.rb +46 -0
  10. data/lib/rodf/document.rb +133 -0
  11. data/lib/rodf/hyperlink.rb +33 -0
  12. data/lib/rodf/master_page.rb +11 -0
  13. data/lib/rodf/page_layout.rb +41 -0
  14. data/lib/rodf/paragraph.rb +28 -0
  15. data/lib/rodf/paragraph_container.rb +30 -0
  16. data/lib/rodf/property.rb +138 -0
  17. data/lib/rodf/row.rb +56 -0
  18. data/lib/{odf → rodf}/skeleton/manifest.xml.erb +0 -0
  19. data/lib/{odf → rodf}/skeleton/styles.pxml +0 -0
  20. data/lib/rodf/skeleton.rb +17 -0
  21. data/lib/rodf/span.rb +45 -0
  22. data/lib/rodf/spreadsheet.rb +113 -0
  23. data/lib/rodf/style.rb +77 -0
  24. data/lib/rodf/style_section.rb +33 -0
  25. data/lib/rodf/tab.rb +17 -0
  26. data/lib/rodf/table.rb +95 -0
  27. data/lib/rodf/text.rb +126 -0
  28. data/lib/rodf/version.rb +3 -0
  29. data/lib/rodf.rb +31 -0
  30. metadata +76 -115
  31. data/CHANGELOG +0 -17
  32. data/Gemfile +0 -9
  33. data/LICENSE.LGPL +0 -166
  34. data/Manifest +0 -48
  35. data/lib/odf/cell.rb +0 -104
  36. data/lib/odf/column.rb +0 -33
  37. data/lib/odf/compatibility.rb +0 -25
  38. data/lib/odf/container.rb +0 -57
  39. data/lib/odf/data_style.rb +0 -45
  40. data/lib/odf/document.rb +0 -67
  41. data/lib/odf/hyperlink.rb +0 -51
  42. data/lib/odf/master_page.rb +0 -33
  43. data/lib/odf/page_layout.rb +0 -39
  44. data/lib/odf/paragraph.rb +0 -46
  45. data/lib/odf/paragraph_container.rb +0 -35
  46. data/lib/odf/property.rb +0 -131
  47. data/lib/odf/row.rb +0 -44
  48. data/lib/odf/skeleton.rb +0 -34
  49. data/lib/odf/span.rb +0 -70
  50. data/lib/odf/spreadsheet.rb +0 -64
  51. data/lib/odf/style.rb +0 -65
  52. data/lib/odf/style_section.rb +0 -42
  53. data/lib/odf/tab.rb +0 -38
  54. data/lib/odf/table.rb +0 -50
  55. data/lib/odf/text.rb +0 -66
  56. data/rodf.gemspec +0 -48
  57. data/spec/cell_spec.rb +0 -189
  58. data/spec/data_style_spec.rb +0 -61
  59. data/spec/file_storage_spec.rb +0 -47
  60. data/spec/hyperlink_spec.rb +0 -62
  61. data/spec/master_page_spec.rb +0 -35
  62. data/spec/page_layout_spec.rb +0 -45
  63. data/spec/paragraph_spec.rb +0 -75
  64. data/spec/property_spec.rb +0 -270
  65. data/spec/row_spec.rb +0 -59
  66. data/spec/skeleton_spec.rb +0 -33
  67. data/spec/span_spec.rb +0 -65
  68. data/spec/spec_helper.rb +0 -23
  69. data/spec/spreadsheet_spec.rb +0 -123
  70. data/spec/style_section_spec.rb +0 -42
  71. data/spec/style_spec.rb +0 -109
  72. data/spec/tab_spec.rb +0 -34
  73. data/spec/table_spec.rb +0 -90
  74. data/spec/text_spec.rb +0 -79
metadata CHANGED
@@ -1,211 +1,172 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Weston Ganger, Thiago Arrais, Foivos Zakkak
7
+ - Weston Ganger
8
+ - Thiago Arrais
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
12
+ date: 2021-12-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: builder
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - "~>"
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
20
  version: '3.0'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - "~>"
25
+ - - ">="
25
26
  - !ruby/object:Gem::Version
26
27
  version: '3.0'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rubyzip
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - "~>"
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '1.0'
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - "~>"
39
+ - - ">="
39
40
  - !ruby/object:Gem::Version
40
41
  version: '1.0'
41
42
  - !ruby/object:Gem::Dependency
42
- name: activesupport
43
+ name: rake
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - ">="
46
47
  - !ruby/object:Gem::Version
47
- version: '3.0'
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '6.0'
51
- type: :runtime
48
+ version: '0'
49
+ type: :development
52
50
  prerelease: false
53
51
  version_requirements: !ruby/object:Gem::Requirement
54
52
  requirements:
55
53
  - - ">="
56
54
  - !ruby/object:Gem::Version
57
- version: '3.0'
58
- - - "<"
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
59
61
  - !ruby/object:Gem::Version
60
- version: '6.0'
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
61
70
  - !ruby/object:Gem::Dependency
62
71
  name: rspec
63
72
  requirement: !ruby/object:Gem::Requirement
64
73
  requirements:
65
- - - "~>"
74
+ - - ">="
66
75
  - !ruby/object:Gem::Version
67
76
  version: '2.9'
68
77
  type: :development
69
78
  prerelease: false
70
79
  version_requirements: !ruby/object:Gem::Requirement
71
80
  requirements:
72
- - - "~>"
81
+ - - ">="
73
82
  - !ruby/object:Gem::Version
74
83
  version: '2.9'
75
84
  - !ruby/object:Gem::Dependency
76
- name: rspec_hpricot_matchers
85
+ name: hpricot
77
86
  requirement: !ruby/object:Gem::Requirement
78
87
  requirements:
79
- - - "~>"
88
+ - - ">="
80
89
  - !ruby/object:Gem::Version
81
- version: '1.0'
90
+ version: 0.8.6
82
91
  type: :development
83
92
  prerelease: false
84
93
  version_requirements: !ruby/object:Gem::Requirement
85
94
  requirements:
86
- - - "~>"
95
+ - - ">="
87
96
  - !ruby/object:Gem::Version
88
- version: '1.0'
97
+ version: 0.8.6
89
98
  - !ruby/object:Gem::Dependency
90
- name: echoe
99
+ name: rspec_hpricot_matchers
91
100
  requirement: !ruby/object:Gem::Requirement
92
101
  requirements:
93
- - - "~>"
102
+ - - ">="
94
103
  - !ruby/object:Gem::Version
95
- version: '4.6'
104
+ version: '1.0'
96
105
  type: :development
97
106
  prerelease: false
98
107
  version_requirements: !ruby/object:Gem::Requirement
99
108
  requirements:
100
- - - "~>"
109
+ - - ">="
101
110
  - !ruby/object:Gem::Version
102
- version: '4.6'
111
+ version: '1.0'
103
112
  description: ODF generation library for Ruby
104
- email: thiago.arrais@gmail.com
113
+ email:
114
+ - weston@westonganger.com
115
+ - thiago.arrais@gmail.com
105
116
  executables: []
106
117
  extensions: []
107
- extra_rdoc_files:
108
- - CHANGELOG
109
- - LICENSE.LGPL
110
- - README.md
111
- - lib/odf/cell.rb
112
- - lib/odf/column.rb
113
- - lib/odf/compatibility.rb
114
- - lib/odf/container.rb
115
- - lib/odf/data_style.rb
116
- - lib/odf/document.rb
117
- - lib/odf/hyperlink.rb
118
- - lib/odf/master_page.rb
119
- - lib/odf/page_layout.rb
120
- - lib/odf/paragraph.rb
121
- - lib/odf/paragraph_container.rb
122
- - lib/odf/property.rb
123
- - lib/odf/row.rb
124
- - lib/odf/skeleton.rb
125
- - lib/odf/skeleton/manifest.xml.erb
126
- - lib/odf/skeleton/styles.pxml
127
- - lib/odf/span.rb
128
- - lib/odf/spreadsheet.rb
129
- - lib/odf/style.rb
130
- - lib/odf/style_section.rb
131
- - lib/odf/tab.rb
132
- - lib/odf/table.rb
133
- - lib/odf/text.rb
118
+ extra_rdoc_files: []
134
119
  files:
135
- - CHANGELOG
136
- - Gemfile
137
- - LICENSE.LGPL
138
- - Manifest
120
+ - CHANGELOG.md
121
+ - LICENSE
139
122
  - README.md
140
123
  - Rakefile
141
- - lib/odf/cell.rb
142
- - lib/odf/column.rb
143
- - lib/odf/compatibility.rb
144
- - lib/odf/container.rb
145
- - lib/odf/data_style.rb
146
- - lib/odf/document.rb
147
- - lib/odf/hyperlink.rb
148
- - lib/odf/master_page.rb
149
- - lib/odf/page_layout.rb
150
- - lib/odf/paragraph.rb
151
- - lib/odf/paragraph_container.rb
152
- - lib/odf/property.rb
153
- - lib/odf/row.rb
154
- - lib/odf/skeleton.rb
155
- - lib/odf/skeleton/manifest.xml.erb
156
- - lib/odf/skeleton/styles.pxml
157
- - lib/odf/span.rb
158
- - lib/odf/spreadsheet.rb
159
- - lib/odf/style.rb
160
- - lib/odf/style_section.rb
161
- - lib/odf/tab.rb
162
- - lib/odf/table.rb
163
- - lib/odf/text.rb
164
- - rodf.gemspec
165
- - spec/cell_spec.rb
166
- - spec/data_style_spec.rb
167
- - spec/file_storage_spec.rb
168
- - spec/hyperlink_spec.rb
169
- - spec/master_page_spec.rb
170
- - spec/page_layout_spec.rb
171
- - spec/paragraph_spec.rb
172
- - spec/property_spec.rb
173
- - spec/row_spec.rb
174
- - spec/skeleton_spec.rb
175
- - spec/span_spec.rb
176
- - spec/spec_helper.rb
177
- - spec/spreadsheet_spec.rb
178
- - spec/style_section_spec.rb
179
- - spec/style_spec.rb
180
- - spec/tab_spec.rb
181
- - spec/table_spec.rb
182
- - spec/text_spec.rb
183
- homepage: http://github.com/thiagoarrais/rodf/tree
184
- licenses: []
124
+ - lib/rodf.rb
125
+ - lib/rodf/cell.rb
126
+ - lib/rodf/column.rb
127
+ - lib/rodf/container.rb
128
+ - lib/rodf/data_style.rb
129
+ - lib/rodf/document.rb
130
+ - lib/rodf/hyperlink.rb
131
+ - lib/rodf/master_page.rb
132
+ - lib/rodf/page_layout.rb
133
+ - lib/rodf/paragraph.rb
134
+ - lib/rodf/paragraph_container.rb
135
+ - lib/rodf/property.rb
136
+ - lib/rodf/row.rb
137
+ - lib/rodf/skeleton.rb
138
+ - lib/rodf/skeleton/manifest.xml.erb
139
+ - lib/rodf/skeleton/styles.pxml
140
+ - lib/rodf/span.rb
141
+ - lib/rodf/spreadsheet.rb
142
+ - lib/rodf/style.rb
143
+ - lib/rodf/style_section.rb
144
+ - lib/rodf/tab.rb
145
+ - lib/rodf/table.rb
146
+ - lib/rodf/text.rb
147
+ - lib/rodf/version.rb
148
+ homepage: https://github.com/thiagoarrais/rodf
149
+ licenses:
150
+ - MIT
185
151
  metadata: {}
186
152
  post_install_message:
187
- rdoc_options:
188
- - "--line-numbers"
189
- - "--title"
190
- - Rodf
191
- - "--main"
192
- - README.md
153
+ rdoc_options: []
193
154
  require_paths:
194
155
  - lib
195
156
  required_ruby_version: !ruby/object:Gem::Requirement
196
157
  requirements:
197
158
  - - ">="
198
159
  - !ruby/object:Gem::Version
199
- version: '0'
160
+ version: 1.9.3
200
161
  required_rubygems_version: !ruby/object:Gem::Requirement
201
162
  requirements:
202
163
  - - ">="
203
164
  - !ruby/object:Gem::Version
204
- version: '1.2'
165
+ version: '0'
205
166
  requirements: []
206
- rubyforge_project: rodf
207
- rubygems_version: 2.5.1
167
+ rubygems_version: 3.1.4
208
168
  signing_key:
209
169
  specification_version: 4
210
- summary: ODF generation library for Ruby
170
+ summary: This is a library for writing to ODF output from Ruby. It mainly focuses
171
+ creating ODS spreadsheets.
211
172
  test_files: []
data/CHANGELOG DELETED
@@ -1,17 +0,0 @@
1
- v0.3.7 Update dependencies for Rails 5
2
- v0.3.6. Resulting ODF files as bitstrings
3
- v0.3.5. Allows current libraries
4
- v0.3.4. Procedural cell styling
5
- v0.3.3. Documents can now write themselves to disk
6
- v0.3.2. Fixes broken styles.xml
7
- v0.3.1. Adds support for conditional formatting
8
- v0.3. Allow parameterless blocks
9
- v0.2.2. Reintroduce compatibility with Ruby 1.8
10
- v0.2.1. Update to newer libraries and Ruby 1.9
11
- v0.1.6. Fix date handling
12
- v0.1.5. Bug fix
13
- v0.1.4. Allow the setting of an entire cell's content to a hyperlink (by Merul Patel)
14
- v0.1.3. Dependency fix (by Merul Patel)
15
- v0.1.2. Cell span
16
- v0.1.1. Basic spreadsheet styling support
17
- v0.1. First version with very basic support for spreadsheet generation
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'http://rubygems.org/'
2
-
3
- gem "builder", "~> 3.0"
4
- gem "rubyzip", "~> 1.0"
5
- gem "activesupport", ">= 3.0", "< 6.0"
6
- gem "hpricot", "~> 0.8.6"
7
- gem "rspec", "~> 2.9"
8
- gem "rspec_hpricot_matchers" , "~> 1.0"
9
- gem "echoe" , "~> 4.6"
data/LICENSE.LGPL DELETED
@@ -1,166 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
166
-
data/Manifest DELETED
@@ -1,48 +0,0 @@
1
- CHANGELOG
2
- Gemfile
3
- LICENSE.LGPL
4
- Manifest
5
- README.md
6
- Rakefile
7
- lib/odf/cell.rb
8
- lib/odf/column.rb
9
- lib/odf/compatibility.rb
10
- lib/odf/container.rb
11
- lib/odf/data_style.rb
12
- lib/odf/document.rb
13
- lib/odf/hyperlink.rb
14
- lib/odf/master_page.rb
15
- lib/odf/page_layout.rb
16
- lib/odf/paragraph.rb
17
- lib/odf/paragraph_container.rb
18
- lib/odf/property.rb
19
- lib/odf/row.rb
20
- lib/odf/skeleton.rb
21
- lib/odf/skeleton/manifest.xml.erb
22
- lib/odf/skeleton/styles.pxml
23
- lib/odf/span.rb
24
- lib/odf/spreadsheet.rb
25
- lib/odf/style.rb
26
- lib/odf/style_section.rb
27
- lib/odf/tab.rb
28
- lib/odf/table.rb
29
- lib/odf/text.rb
30
- rodf.gemspec
31
- spec/cell_spec.rb
32
- spec/data_style_spec.rb
33
- spec/file_storage_spec.rb
34
- spec/hyperlink_spec.rb
35
- spec/master_page_spec.rb
36
- spec/page_layout_spec.rb
37
- spec/paragraph_spec.rb
38
- spec/property_spec.rb
39
- spec/row_spec.rb
40
- spec/skeleton_spec.rb
41
- spec/span_spec.rb
42
- spec/spec_helper.rb
43
- spec/spreadsheet_spec.rb
44
- spec/style_section_spec.rb
45
- spec/style_spec.rb
46
- spec/tab_spec.rb
47
- spec/table_spec.rb
48
- spec/text_spec.rb
data/lib/odf/cell.rb DELETED
@@ -1,104 +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 'rubygems'
19
- require 'builder'
20
-
21
- require 'odf/container'
22
- require 'odf/paragraph'
23
-
24
- module ODF
25
- class Cell < Container
26
- contains :paragraphs
27
-
28
- alias :p :paragraph
29
-
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
41
- end
42
- end
43
-
44
- @elem_attrs = make_element_attributes(@type, @value, opts)
45
- @mutiply = (opts[:span] || 1).to_i
46
-
47
- make_value_paragraph
48
- end
49
-
50
- def style=(style_name)
51
- @elem_attrs['table:style-name'] = style_name
52
- end
53
-
54
- def xml
55
- markup = Builder::XmlMarkup.new
56
- text = markup.tag! 'table:table-cell', @elem_attrs do |xml|
57
- xml << paragraphs_xml
58
- end
59
- (@mutiply - 1).times {text = markup.tag! 'table:table-cell'}
60
- text
61
- end
62
-
63
- def contains_url?
64
- !@url.nil? && !@url.empty?
65
- end
66
-
67
- private
68
-
69
- def contains_string?
70
- :string == @type && !@value.nil? && !@value.empty?
71
- end
72
-
73
- def make_element_attributes(type, value, opts)
74
- 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)
78
- attrs['table:formula'] = opts[:formula] unless opts[:formula].nil?
79
- attrs['table:style-name'] = opts[:style] unless opts[:style].nil?
80
- attrs['table:number-columns-spanned'] = opts[:span] unless opts[:span].nil?
81
- attrs['table:number-matrix-columns-spanned'] =
82
- attrs['table:number-matrix-rows-spanned'] = 1 if opts[:matrix_formula]
83
- attrs
84
- end
85
-
86
- def make_value_paragraph
87
- if contains_string?
88
- cell, value, url = self, @value, @url
89
- paragraph do
90
- if cell.contains_url?
91
- link value, :href => url
92
- else
93
- self << value
94
- end
95
- end
96
- end
97
- end
98
-
99
- def empty(value)
100
- value.nil? || value.empty?
101
- end
102
- end
103
- end
104
-
data/lib/odf/column.rb DELETED
@@ -1,33 +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 'rubygems'
19
- require 'builder'
20
-
21
- module ODF
22
- class Column
23
- def initialize(opts={})
24
- @elem_attrs = {}
25
- @elem_attrs['table:style-name'] = opts[:style] unless opts[:style].nil?
26
- end
27
-
28
- def xml
29
- Builder::XmlMarkup.new.tag! 'table:table-column', @elem_attrs
30
- end
31
- end
32
- end
33
-