malt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/History.rdoc +13 -0
  2. data/License.txt +204 -0
  3. data/README.rdoc +68 -0
  4. data/bin/malt +4 -0
  5. data/features/consistent_rendering.feature +36 -0
  6. data/features/samples/sample.erb +1 -0
  7. data/features/samples/sample.erubis +1 -0
  8. data/features/samples/sample.liquid +1 -0
  9. data/features/samples/sample.mustache +1 -0
  10. data/features/samples/sample.radius +1 -0
  11. data/features/step_definitions/engine_steps.rb +49 -0
  12. data/features/support/loadpath.rb +1 -0
  13. data/features/support/sample_class.rb +8 -0
  14. data/lib/malt.rb +79 -0
  15. data/lib/malt/core_ext.rb +31 -0
  16. data/lib/malt/engines.rb +10 -0
  17. data/lib/malt/engines/abstract.rb +151 -0
  18. data/lib/malt/engines/bluecloth.rb +39 -0
  19. data/lib/malt/engines/erb.rb +84 -0
  20. data/lib/malt/engines/erubis.rb +65 -0
  21. data/lib/malt/engines/haml.rb +68 -0
  22. data/lib/malt/engines/kramdown.rb +48 -0
  23. data/lib/malt/engines/less.rb +49 -0
  24. data/lib/malt/engines/liquid.rb +40 -0
  25. data/lib/malt/engines/radius.rb +90 -0
  26. data/lib/malt/engines/rdiscount.rb +49 -0
  27. data/lib/malt/engines/rdoc.rb +46 -0
  28. data/lib/malt/engines/redcloth.rb +42 -0
  29. data/lib/malt/engines/rtals.rb +46 -0
  30. data/lib/malt/engines/ruby.rb +36 -0
  31. data/lib/malt/engines/sass.rb +50 -0
  32. data/lib/malt/engines/tenjin.rb +61 -0
  33. data/lib/malt/formats.rb +10 -0
  34. data/lib/malt/formats/abstract.rb +195 -0
  35. data/lib/malt/formats/css.rb +34 -0
  36. data/lib/malt/formats/erb.rb +102 -0
  37. data/lib/malt/formats/haml.rb +53 -0
  38. data/lib/malt/formats/html.rb +29 -0
  39. data/lib/malt/formats/latex.rb +47 -0
  40. data/lib/malt/formats/less.rb +51 -0
  41. data/lib/malt/formats/liquid.rb +53 -0
  42. data/lib/malt/formats/markdown.rb +83 -0
  43. data/lib/malt/formats/pdf.rb +29 -0
  44. data/lib/malt/formats/radius.rb +47 -0
  45. data/lib/malt/formats/rdoc.rb +43 -0
  46. data/lib/malt/formats/rtals.rb +46 -0
  47. data/lib/malt/formats/ruby.rb +71 -0
  48. data/lib/malt/formats/sass.rb +56 -0
  49. data/lib/malt/formats/tenjin.rb +50 -0
  50. data/lib/malt/formats/text.rb +54 -0
  51. data/lib/malt/formats/textile.rb +59 -0
  52. data/lib/malt/formats/yaml.rb +50 -0
  53. data/lib/malt/kernel.rb +31 -0
  54. data/lib/malt/meta/data.rb +26 -0
  55. data/lib/malt/meta/gemfile +17 -0
  56. data/lib/malt/meta/profile +21 -0
  57. data/meta/data.rb +26 -0
  58. data/meta/gemfile +17 -0
  59. data/meta/profile +21 -0
  60. data/qed/01_overview.rdoc +44 -0
  61. data/qed/applique/malt.rb +12 -0
  62. metadata +283 -0
@@ -0,0 +1,26 @@
1
+ Object.__send__(:remove_const, :VERSION) if Object.const_defined?(:VERSION) # becuase Ruby 1.8~ gets in the way
2
+
3
+ module Malt
4
+
5
+ DIRECTORY = File.dirname(__FILE__)
6
+
7
+ def self.gemfile
8
+ @gemfile ||= (
9
+ require 'yaml'
10
+ YAML.load(File.new(DIRECTORY + '/gemfile'))
11
+ )
12
+ end
13
+
14
+ def self.profile
15
+ @profile ||= (
16
+ require 'yaml'
17
+ YAML.load(File.new(DIRECTORY + '/profile'))
18
+ )
19
+ end
20
+
21
+ def self.const_missing(name)
22
+ key = name.to_s.downcase
23
+ gemfile[key] || profile[key] || super(name)
24
+ end
25
+
26
+ end
@@ -0,0 +1,17 @@
1
+ name : malt
2
+ date : 2010-09-07
3
+ version : 0.1.0
4
+
5
+ requires:
6
+ - syckle (build)
7
+ - qed (test)
8
+ - rdoc (test)
9
+ - redcloth (test)
10
+ - bluecloth (test)
11
+ - kramdown (test)
12
+ - haml (test)
13
+ - tenjin (test)
14
+ - rtals (test)
15
+ - liquid (test)
16
+ - erubis (test)
17
+
@@ -0,0 +1,21 @@
1
+ title : Malt
2
+ summary: Multi-template/multi-markup rendering engine
3
+ contact: trans <transfire@gmail.com>
4
+ created: 2010-06-22
5
+
6
+ authors:
7
+ - Thomas Sawyer
8
+
9
+ description:
10
+ Malt provides a factory framework for rendering
11
+ a variety of template and markup document formats.
12
+
13
+ resources:
14
+ home: http://rubyworks.github.com/malt
15
+ code: http://github.com/rubyworks/malt
16
+ wiki: http://wiki.github.com/rubyworks/malt
17
+ docs: http://rubyworks.github.com/malt/docs/api
18
+ bugs: http://github.com/rubyworks/malt/issues
19
+
20
+ copyright:
21
+ Copyright (c) 2010 Thomas Sawyer
@@ -0,0 +1,44 @@
1
+ = Malt
2
+
3
+ Malt is a multi-template rendering framework.
4
+
5
+ require 'malt'
6
+
7
+ For example lets say we have a document called 'test.rdoc' containing ...
8
+
9
+ = Example
10
+
11
+ This is an example of RDOC rendering.
12
+
13
+ We can convert RDoc documents to html using the universal, functional
14
+ interface easily enough.
15
+
16
+ html = Malt.render(:file=>'tmp/test.rdoc')
17
+
18
+ In this example, Malt recognizes the type of file by the '.rdoc' extension
19
+ and renders it using the default redering engine (in this case RDoc itself).
20
+ By default the engine renders to HTML, so we did not need to specify
21
+ the output :format option to the +render+ method.
22
+
23
+ Alternately we can use the object-oriented interface.
24
+
25
+ rdoc = Malt.file('tmp/test.rdoc')
26
+
27
+ First we will notice that the output is an instance of Malt::Formats::HTML.
28
+
29
+ rdoc.class.assert == Malt::Formats::RDoc
30
+
31
+ While we could have used `Malt::Formats::RDoc.new` to create the object directly,
32
+ Malt provides the #file, as well as #text, methods for convience. We can convert
33
+ the rdoc to html with the #to_html method.
34
+
35
+ html = rdoc.to_html
36
+
37
+ Again notice that the output is an instance of Malt::Formats::HTML.
38
+
39
+ html.class.assert == Malt::Formats::HTML
40
+
41
+ And that by calling #to_s we can get the rendered HTML document.
42
+
43
+ html.to_s.assert.include?('<h1>Example</h1>')
44
+
@@ -0,0 +1,12 @@
1
+ require 'malt'
2
+
3
+ When "say we have a (((\\w+))) document called '(((\\S+)))' containing" do |type, fname, text|
4
+ file = File.join('tmp',fname)
5
+ File.open(file, 'w'){ |f| f << text }
6
+ end
7
+
8
+ When "verify that (((.*?))) is" do |var, text|
9
+ out = instance_variable_get(var)
10
+ out.strip.assert == text.strip
11
+ end
12
+
metadata ADDED
@@ -0,0 +1,283 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: malt
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Thomas Sawyer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-09 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: syckle
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: qed
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rdoc
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :development
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: redcloth
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: bluecloth
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :development
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: kramdown
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ name: haml
107
+ prerelease: false
108
+ requirement: &id007 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ type: :development
118
+ version_requirements: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ name: tenjin
121
+ prerelease: false
122
+ requirement: &id008 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ type: :development
132
+ version_requirements: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ name: rtals
135
+ prerelease: false
136
+ requirement: &id009 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ type: :development
146
+ version_requirements: *id009
147
+ - !ruby/object:Gem::Dependency
148
+ name: liquid
149
+ prerelease: false
150
+ requirement: &id010 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ hash: 3
156
+ segments:
157
+ - 0
158
+ version: "0"
159
+ type: :development
160
+ version_requirements: *id010
161
+ - !ruby/object:Gem::Dependency
162
+ name: erubis
163
+ prerelease: false
164
+ requirement: &id011 !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ hash: 3
170
+ segments:
171
+ - 0
172
+ version: "0"
173
+ type: :development
174
+ version_requirements: *id011
175
+ description: Malt provides a factory framework for rendering a variety of template and markup document formats.
176
+ email: transfire@gmail.com
177
+ executables:
178
+ - malt
179
+ extensions: []
180
+
181
+ extra_rdoc_files:
182
+ - README.rdoc
183
+ files:
184
+ - bin/malt
185
+ - features/consistent_rendering.feature
186
+ - features/samples/sample.erb
187
+ - features/samples/sample.erubis
188
+ - features/samples/sample.liquid
189
+ - features/samples/sample.mustache
190
+ - features/samples/sample.radius
191
+ - features/step_definitions/engine_steps.rb
192
+ - features/support/loadpath.rb
193
+ - features/support/sample_class.rb
194
+ - lib/malt/core_ext.rb
195
+ - lib/malt/engines/abstract.rb
196
+ - lib/malt/engines/bluecloth.rb
197
+ - lib/malt/engines/erb.rb
198
+ - lib/malt/engines/erubis.rb
199
+ - lib/malt/engines/haml.rb
200
+ - lib/malt/engines/kramdown.rb
201
+ - lib/malt/engines/less.rb
202
+ - lib/malt/engines/liquid.rb
203
+ - lib/malt/engines/radius.rb
204
+ - lib/malt/engines/rdiscount.rb
205
+ - lib/malt/engines/rdoc.rb
206
+ - lib/malt/engines/redcloth.rb
207
+ - lib/malt/engines/rtals.rb
208
+ - lib/malt/engines/ruby.rb
209
+ - lib/malt/engines/sass.rb
210
+ - lib/malt/engines/tenjin.rb
211
+ - lib/malt/engines.rb
212
+ - lib/malt/formats/abstract.rb
213
+ - lib/malt/formats/css.rb
214
+ - lib/malt/formats/erb.rb
215
+ - lib/malt/formats/haml.rb
216
+ - lib/malt/formats/html.rb
217
+ - lib/malt/formats/latex.rb
218
+ - lib/malt/formats/less.rb
219
+ - lib/malt/formats/liquid.rb
220
+ - lib/malt/formats/markdown.rb
221
+ - lib/malt/formats/pdf.rb
222
+ - lib/malt/formats/radius.rb
223
+ - lib/malt/formats/rdoc.rb
224
+ - lib/malt/formats/rtals.rb
225
+ - lib/malt/formats/ruby.rb
226
+ - lib/malt/formats/sass.rb
227
+ - lib/malt/formats/tenjin.rb
228
+ - lib/malt/formats/text.rb
229
+ - lib/malt/formats/textile.rb
230
+ - lib/malt/formats/yaml.rb
231
+ - lib/malt/formats.rb
232
+ - lib/malt/kernel.rb
233
+ - lib/malt/meta/data.rb
234
+ - lib/malt/meta/gemfile
235
+ - lib/malt/meta/profile
236
+ - lib/malt.rb
237
+ - meta/data.rb
238
+ - meta/gemfile
239
+ - meta/profile
240
+ - qed/01_overview.rdoc
241
+ - qed/applique/malt.rb
242
+ - README.rdoc
243
+ - History.rdoc
244
+ - License.txt
245
+ has_rdoc: true
246
+ homepage: http://rubyworks.github.com/malt
247
+ licenses:
248
+ - ""
249
+ post_install_message:
250
+ rdoc_options:
251
+ - --title
252
+ - Malt API
253
+ - --main
254
+ - README.rdoc
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ hash: 3
263
+ segments:
264
+ - 0
265
+ version: "0"
266
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
+ none: false
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ hash: 3
272
+ segments:
273
+ - 0
274
+ version: "0"
275
+ requirements: []
276
+
277
+ rubyforge_project: malt
278
+ rubygems_version: 1.3.7
279
+ signing_key:
280
+ specification_version: 3
281
+ summary: Multi-template/multi-markup rendering engine
282
+ test_files: []
283
+