documatic 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1 @@
1
+ All original material is (p) Public Domain, No Rights Reserved. Documatic comes with no warranty whatsoever.
data/README CHANGED
@@ -36,14 +36,8 @@ Rendering using an OpenDocument spreadsheet is done like this:
36
36
 
37
37
  Documatic creates the output path if required.
38
38
 
39
- The wiki (see below) has more documentation and examples, plus simple
40
- tutorials to illustrate how text and spreadsheet rendering works.
41
39
 
42
40
 
43
- == Version
44
-
45
- 0.2.0, released 26-APR-2008.
46
-
47
41
 
48
42
  == Licence
49
43
 
@@ -54,20 +48,9 @@ Documatic comes with no warranty whatsoever.
54
48
 
55
49
  == Support
56
50
 
57
- See the Documatic Trac page at
58
- http://stonecode.svnrepository.com/documatic/trac.cgi. The wiki is
59
- the main source of information for end-users. The tracking system is
60
- where bug reports should be filed.
61
-
62
- Users can discuss Documatic on the Ruby Reports mailing list at
51
+ Zachris note may 2010
52
+ Documatic seems to be unmaintained. Please read the sourcecode or discuss on
63
53
  http://groups.google.com/group/ruby-reports.
64
54
 
65
- The Subversion repository for Documatic is at
66
- http://stonecode.svnrepository.com/svn/documatic.
67
55
 
68
- The Rubyforge project page for Documatic is at
69
- http://rubyforge.org/projects/documatic. The Documatic rubygem is
70
- distributed from there.
71
56
 
72
- For any other enquiries please contact Dave Nelson (urbanus at 240gl
73
- dot org).
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ #from http://blog.101ideas.cz/post/353002256/the-truth-about-gemspecs
2
+ # encoding: utf-8
3
+ require "base64"
4
+
5
+ require 'rubygems'
6
+ require 'rake'
7
+ require 'rake/clean'
8
+ require 'rake/gempackagetask'
9
+ require 'rake/rdoctask'
10
+ require 'rake/testtask'
11
+
12
+ spec = Gem::Specification.new do |s|
13
+ s.name = 'documatic'
14
+ s.version = '0.2.2'
15
+ s.has_rdoc = true
16
+ s.extra_rdoc_files = ['README', 'LICENSE']
17
+ s.summary = 'Documatic is an OpenDocument extension for Ruby Reports (Ruport). It is a template-driven formatter that can be used to produce attractive printable documents such as database reports, invoices, letters, faxes and more.'
18
+ s.description = s.summary
19
+ s.author = %q{"urbanus" "Antonio Liccardo" "Zachris Trolin"}
20
+ #s.email = 'urbanus@240gl.org'
21
+ s.email = Base64.decode64("dHV4bWFsQHRpc2NhbGkuaXQK\n")
22
+ s.homepage = "http://github.com/tuxmal/documatic"
23
+ # s.executables = ['your_executable_here']
24
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
25
+ #s.files = FileList["lib/**/**", "tutorials/**/**/**"].to_a
26
+ #s.test_files = FileList["{test}/**/*test.rb"].to_a
27
+ s.require_path = "lib"
28
+ s.bindir = "bin"
29
+ s.platform = Gem::Platform::RUBY
30
+ s.autorequire = "documatic.rb"
31
+ s.add_dependency("ruport")
32
+ s.add_dependency("rubyzip")
33
+ end
34
+
35
+ Rake::GemPackageTask.new(spec) do |p|
36
+ p.gem_spec = spec
37
+ p.need_tar = true
38
+ p.need_zip = true
39
+ end
40
+
41
+ task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
42
+ puts "generated latest version"
43
+ end
44
+
45
+
46
+ Rake::RDocTask.new do |rdoc|
47
+ files =['README', 'LICENSE', 'lib/**/*.rb']
48
+ rdoc.rdoc_files.add(files)
49
+ rdoc.main = "README" # page to start on
50
+ rdoc.title = "testeach Docs"
51
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
52
+ rdoc.options << '--line-numbers'
53
+ end
54
+
55
+ Rake::TestTask.new do |t|
56
+ t.test_files = FileList['test/**/*.rb']
57
+ end
@@ -77,6 +77,10 @@ module Documatic::OpenDocumentSpreadsheet
77
77
  end
78
78
 
79
79
  def close
80
+ # To get rid of an annoying message about corrupted files in OOCalc 3.2.0
81
+ # we most remove the compiled content before we close our ODS file.
82
+ self.jar.remove('documatic/master/content.erb')
83
+ # Now we can safely close our document.
80
84
  self.jar.close
81
85
  end
82
86
 
@@ -105,6 +109,7 @@ module Documatic::OpenDocumentSpreadsheet
105
109
  return REXML::Text.unnormalize(code)
106
110
  end
107
111
 
112
+
108
113
  # Massage OpenDocument XML into ERb. (This is the heart of the compiler.)
109
114
  def erbify(code)
110
115
  # First gather all the ERb-related derived styles
@@ -146,32 +151,36 @@ module Documatic::OpenDocumentSpreadsheet
146
151
 
147
152
  result += md.pre_match
148
153
 
149
- match_code = false
150
- match_row = false
151
-
152
- if styles[md[TYPE]] == 'Code'
153
- match_code = true
154
- delim_start = '<% ' ; delim_end = ' %>'
155
- if md[ROW_START] and md[ROW_END]
156
- match_row = true
157
- end
158
- else # style is Value or Literal
159
- if styles[md[TYPE]] == 'Literal'
160
- delim_start = '<%= ' ; delim_end = ' %>'
161
- else
162
- delim_start = '<table:table-cell table:style-name="Default" office:value-type="string"><text:p><%= ERB::Util.h('
163
- delim_end = ') %></text:p></table:table-cell>'
164
- end
165
- end
154
+ #match_code = false
155
+ #match_row = false
156
+
157
+ # if md[ROW_START] and md[ROW_END]
158
+ # match_row=true
159
+ # end
160
+
161
+ skip_row=false
162
+ #create cells, but dont append
163
+ cells= case styles[md[TYPE]]
164
+ when "Code" then
165
+ skip_row=true
166
+ "<% #{self.unnormalize md[ERB_CODE]} %>"
167
+ when "Literal" then "<%= #{self.unnormalize md[ERB_CODE]} %>"
168
+ when "Value" then "<%=cell (#{self.unnormalize md[ERB_CODE] }) %>" #let helper build the correct "cell"
169
+ end
166
170
 
167
- if md[ROW_START] and not match_row
168
- result += md[ROW_START]
171
+ #fist see if we should open row tag
172
+ #
173
+ #N.B - this assumes that there should be NO CELL VALUS after this one on the same row (will create invalid document)...
174
+ if md[ROW_START] and not skip_row
175
+ result+= md[ROW_START]
169
176
  end
170
-
171
- result += "#{delim_start}#{self.unnormalize md[ERB_CODE]}#{delim_end}"
172
177
 
173
- if md[ROW_END] and not match_row
174
- result += md[ROW_END]
178
+ #then cell body
179
+ result+=cells
180
+
181
+ #then close
182
+ if md[ROW_END] and not skip_row
183
+ result += md[ROW_END]
175
184
  end
176
185
 
177
186
  remaining = md.post_match
metadata CHANGED
@@ -1,82 +1,110 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: documatic
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2008-04-26 00:00:00 +10:00
8
- summary: Documatic is an OpenDocument extension for Ruby Reports (Ruport). It is a template-driven formatter that can be used to produce attractive printable documents such as database reports, invoices, letters, faxes and more.
9
- require_paths:
10
- - lib
11
- email: urbanus@240gl.org
12
- homepage: http://stonecode.svnrepository.com/documatic/trac.cgi
13
- rubyforge_project: documatic
14
- description:
15
- autorequire: init.rb
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
25
11
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
- authors: []
30
-
31
- files:
32
- - lib/
33
- - lib/documatic.rb
34
- - lib/documatic/
35
- - lib/documatic/component.rb
36
- - lib/documatic/formatter/
37
- - lib/documatic/formatter/open_document.rb
38
- - lib/documatic/init.rb
39
- - lib/documatic/open_document_spreadsheet/
40
- - lib/documatic/open_document_spreadsheet/component.rb
41
- - lib/documatic/open_document_spreadsheet/helper.rb
42
- - lib/documatic/open_document_spreadsheet/template.rb
43
- - lib/documatic/open_document_text/
44
- - lib/documatic/open_document_text/component.rb
45
- - lib/documatic/open_document_text/helper.rb
46
- - lib/documatic/open_document_text/partial.rb
47
- - lib/documatic/open_document_text/template.rb
48
- - tests
49
- - README
50
- test_files: []
51
-
52
- rdoc_options:
53
- - --main
54
- - README
55
- - --inline-source
56
- extra_rdoc_files:
57
- - README
58
- executables: []
59
-
60
- extensions: []
61
-
62
- requirements: []
12
+ authors:
13
+ - "\"urbanus\" \"Antonio Liccardo\" \"Zachris Trolin\""
14
+ autorequire: documatic.rb
15
+ bindir: bin
16
+ cert_chain: []
63
17
 
18
+ date: 2010-07-30 00:00:00 +02:00
19
+ default_executable:
64
20
  dependencies:
65
21
  - !ruby/object:Gem::Dependency
66
- name: rubyzip
67
- version_requirement:
68
- version_requirements: !ruby/object:Gem::Version::Requirement
22
+ name: ruport
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
69
26
  requirements:
70
27
  - - ">="
71
28
  - !ruby/object:Gem::Version
72
- version: 0.9.1
73
- version:
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
74
35
  - !ruby/object:Gem::Dependency
75
- name: ruport
76
- version_requirement:
77
- version_requirements: !ruby/object:Gem::Version::Requirement
36
+ name: rubyzip
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
78
40
  requirements:
79
41
  - - ">="
80
42
  - !ruby/object:Gem::Version
81
- version: 1.6.0
82
- version:
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description: Documatic is an OpenDocument extension for Ruby Reports (Ruport). It is a template-driven formatter that can be used to produce attractive printable documents such as database reports, invoices, letters, faxes and more.
50
+ email: |
51
+ tuxmal@tiscali.it
52
+
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files:
58
+ - README
59
+ - LICENSE
60
+ files:
61
+ - LICENSE
62
+ - README
63
+ - Rakefile
64
+ - lib/documatic/open_document_text/template.rb
65
+ - lib/documatic/open_document_text/component.rb
66
+ - lib/documatic/open_document_text/partial.rb
67
+ - lib/documatic/open_document_text/helper.rb
68
+ - lib/documatic/formatter/open_document.rb
69
+ - lib/documatic/open_document_spreadsheet/template.rb
70
+ - lib/documatic/open_document_spreadsheet/component.rb
71
+ - lib/documatic/open_document_spreadsheet/helper.rb
72
+ - lib/documatic/component.rb
73
+ - lib/documatic/init.rb
74
+ - lib/documatic.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/tuxmal/documatic
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options: []
81
+
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project:
105
+ rubygems_version: 1.3.7
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: Documatic is an OpenDocument extension for Ruby Reports (Ruport). It is a template-driven formatter that can be used to produce attractive printable documents such as database reports, invoices, letters, faxes and more.
109
+ test_files: []
110
+