malt 0.1.1 → 0.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.
- data/History.rdoc +18 -0
- data/README.rdoc +6 -2
- data/lib/malt.rb +9 -0
- data/lib/malt/engines/abstract.rb +7 -7
- data/lib/malt/engines/bluecloth.rb +3 -3
- data/lib/malt/engines/builder.rb +72 -0
- data/lib/malt/engines/erb.rb +2 -0
- data/lib/malt/engines/erector.rb +59 -0
- data/lib/malt/engines/haml.rb +2 -2
- data/lib/malt/engines/kramdown.rb +6 -4
- data/lib/malt/engines/less.rb +8 -8
- data/lib/malt/engines/markaby.rb +51 -0
- data/lib/malt/engines/mustache.rb +44 -0
- data/lib/malt/engines/radius.rb +4 -4
- data/lib/malt/engines/ragtag.rb +49 -0
- data/lib/malt/engines/rdiscount.rb +1 -1
- data/lib/malt/engines/rdoc.rb +3 -3
- data/lib/malt/engines/redcloth.rb +1 -1
- data/lib/malt/engines/sass.rb +8 -8
- data/lib/malt/engines/tenjin.rb +6 -6
- data/lib/malt/formats/abstract.rb +8 -2
- data/lib/malt/formats/builder.rb +56 -0
- data/lib/malt/formats/css.rb +8 -8
- data/lib/malt/formats/erector.rb +53 -0
- data/lib/malt/formats/haml.rb +2 -2
- data/lib/malt/formats/html.rb +3 -3
- data/lib/malt/formats/latex.rb +4 -4
- data/lib/malt/formats/less.rb +5 -5
- data/lib/malt/formats/liquid.rb +11 -1
- data/lib/malt/formats/markaby.rb +53 -0
- data/lib/malt/formats/markdown.rb +6 -6
- data/lib/malt/formats/mustache.rb +34 -0
- data/lib/malt/formats/pdf.rb +2 -2
- data/lib/malt/formats/radius.rb +4 -4
- data/lib/malt/formats/{rtals.rb → ragtag.rb} +13 -9
- data/lib/malt/formats/rdoc.rb +4 -4
- data/lib/malt/formats/ruby.rb +2 -2
- data/lib/malt/formats/sass.rb +10 -0
- data/lib/malt/formats/scss.rb +10 -0
- data/lib/malt/formats/tenjin.rb +4 -4
- data/lib/malt/formats/textile.rb +12 -12
- data/lib/malt/formats/xml.rb +29 -0
- data/lib/malt/formats/yaml.rb +2 -2
- data/lib/malt/meta/data.rb +4 -4
- data/lib/malt/meta/{gemfile → package} +6 -2
- data/lib/malt/render.rb +37 -9
- data/meta/data.rb +4 -4
- data/meta/{gemfile → package} +6 -2
- data/qed/03_formats/08_ragtag.rdoc +19 -0
- data/qed/03_formats/17_markaby.rdoc +50 -0
- data/qed/03_formats/18_builder.rb +50 -0
- data/qed/03_formats/19_erector.rb +50 -0
- data/qed/03_formats/20_mustache.rdoc +54 -0
- data/{test/samples/sample.md → qed/samples/sample.markdown} +0 -0
- data/{test → qed}/samples/sample.rdoc +0 -0
- metadata +81 -12
- data/lib/malt/engines/rtals.rb +0 -46
- data/qed/03_formats/08_rtal.rdoc +0 -15
data/meta/data.rb
CHANGED
@@ -4,10 +4,10 @@ module Malt
|
|
4
4
|
|
5
5
|
DIRECTORY = File.dirname(__FILE__)
|
6
6
|
|
7
|
-
def self.
|
8
|
-
@
|
7
|
+
def self.package
|
8
|
+
@package ||= (
|
9
9
|
require 'yaml'
|
10
|
-
YAML.load(File.new(DIRECTORY + '/
|
10
|
+
YAML.load(File.new(DIRECTORY + '/package'))
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -20,7 +20,7 @@ module Malt
|
|
20
20
|
|
21
21
|
def self.const_missing(name)
|
22
22
|
key = name.to_s.downcase
|
23
|
-
|
23
|
+
package[key] || profile[key] || super(name)
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
data/meta/{gemfile → package}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
name : malt
|
2
|
-
date : 2010-10-
|
3
|
-
version : 0.
|
2
|
+
date : 2010-10-22
|
3
|
+
version : 0.2.0
|
4
4
|
|
5
5
|
requires:
|
6
6
|
- syckle (build)
|
@@ -14,4 +14,8 @@ requires:
|
|
14
14
|
- rtals (test)
|
15
15
|
- liquid (test)
|
16
16
|
- erubis (test)
|
17
|
+
- mustache (test)
|
18
|
+
- erector (test)
|
19
|
+
- markaby (test)
|
20
|
+
- builder (test)
|
17
21
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
== RagTag
|
2
|
+
|
3
|
+
Lets say we have a Rtals document called 'test.rt' containing:
|
4
|
+
|
5
|
+
<html>
|
6
|
+
<body>
|
7
|
+
<h1>Example <span replace="title">DUMMY</span></h1>
|
8
|
+
<p>This is an example of a RagTag template.</p>
|
9
|
+
</body>
|
10
|
+
</html>
|
11
|
+
|
12
|
+
We can render Rtal documents via the +render+ method, as we can any format.
|
13
|
+
|
14
|
+
data = { :title=>"Document" }
|
15
|
+
|
16
|
+
html = Malt.render(:file=>'tmp/test.rt', :data=>data)
|
17
|
+
|
18
|
+
html.assert.include?('<h1>Example Document</h1>')
|
19
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
== Markaby
|
2
|
+
|
3
|
+
Lets say we have a Markaby document called 'test.markaby' containing:
|
4
|
+
|
5
|
+
html do
|
6
|
+
h1 "Example #{@title}"
|
7
|
+
p "This is an example of a Maraby template."
|
8
|
+
end
|
9
|
+
|
10
|
+
Notice the use of the instance variable. Markaby templates must use instance
|
11
|
+
variables for data rendering in order to avoid ambiguity with the markup
|
12
|
+
syntax itself.
|
13
|
+
|
14
|
+
We can render Markaby documents via the +render+ method, as we can any format.
|
15
|
+
Since Markaby is a template format and not just a markup syntax, so we need
|
16
|
+
to also provide the +render+ function with data for interpolation into the
|
17
|
+
Markaby document.
|
18
|
+
|
19
|
+
data = { :title=>"Document" }
|
20
|
+
|
21
|
+
html = Malt.render(:file=>'tmp/test.markaby', :data=>data)
|
22
|
+
|
23
|
+
html.assert.include?('<h1>Example Document</h1>')
|
24
|
+
|
25
|
+
We can get a hold of the Markaby document via the Malt.file function.
|
26
|
+
|
27
|
+
markaby = Malt.file('tmp/test.markaby')
|
28
|
+
|
29
|
+
markaby.class.assert == Malt::Format::Markaby
|
30
|
+
|
31
|
+
We can convert Markaby documents to html very easily.
|
32
|
+
|
33
|
+
data = {:title => "Document"}
|
34
|
+
|
35
|
+
html = markaby.to_html(data)
|
36
|
+
|
37
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
38
|
+
|
39
|
+
html.class.assert == Malt::Format::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 Document</h1>')
|
44
|
+
|
45
|
+
Or we can convert the Markaby document directly to HTML via the #html method.
|
46
|
+
|
47
|
+
out = markaby.html(data)
|
48
|
+
|
49
|
+
out.assert.include?('<h1>Example Document</h1>')
|
50
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
== Builder
|
2
|
+
|
3
|
+
Lets say we have a Builder document called 'test.builder' containing:
|
4
|
+
|
5
|
+
html do |h|
|
6
|
+
h.h1 "Example #{@title}"
|
7
|
+
h.p "This is an example of a Maraby template."
|
8
|
+
end
|
9
|
+
|
10
|
+
Notice the use of the instance variable. Builder templates must use instance
|
11
|
+
variables for data rendering in order to avoid ambiguity with the markup
|
12
|
+
syntax itself.
|
13
|
+
|
14
|
+
We can render Builder documents via the +render+ method, as we can any format.
|
15
|
+
Since Builder is a template format and not just a markup syntax, so we need
|
16
|
+
to also provide the +render+ function with data for interpolation into the
|
17
|
+
Builder document.
|
18
|
+
|
19
|
+
data = { :title=>"Document" }
|
20
|
+
|
21
|
+
html = Malt.render(:file=>'tmp/test.builder', :data=>data)
|
22
|
+
|
23
|
+
html.assert.include?('<h1>Example Document</h1>')
|
24
|
+
|
25
|
+
We can get a hold of the Builder document via the Malt.file function.
|
26
|
+
|
27
|
+
builder = Malt.file('tmp/test.builder')
|
28
|
+
|
29
|
+
builder.class.assert == Malt::Format::Builder
|
30
|
+
|
31
|
+
We can convert Builder documents to html very easily.
|
32
|
+
|
33
|
+
data = {:title => "Document"}
|
34
|
+
|
35
|
+
html = builder.to_html(data)
|
36
|
+
|
37
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
38
|
+
|
39
|
+
html.class.assert == Malt::Format::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 Document</h1>')
|
44
|
+
|
45
|
+
Or we can convert the Builder document directly to HTML via the #html method.
|
46
|
+
|
47
|
+
out = builder.html(data)
|
48
|
+
|
49
|
+
out.assert.include?('<h1>Example Document</h1>')
|
50
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
== Erector
|
2
|
+
|
3
|
+
Lets say we have a Erector document called 'test.erector' containing:
|
4
|
+
|
5
|
+
html do
|
6
|
+
h1 "Example #{@title}"
|
7
|
+
p "This is an example of a Maraby template."
|
8
|
+
end
|
9
|
+
|
10
|
+
Notice the use of the instance variable. Erector templates must use instance
|
11
|
+
variables for data rendering in order to avoid ambiguity with the markup
|
12
|
+
syntax itself.
|
13
|
+
|
14
|
+
We can render Erector documents via the +render+ method, as we can any format.
|
15
|
+
Since Erector is a template format and not just a markup syntax, so we need
|
16
|
+
to also provide the +render+ function with data for interpolation into the
|
17
|
+
Erector document.
|
18
|
+
|
19
|
+
data = { :title=>"Document" }
|
20
|
+
|
21
|
+
html = Malt.render(:file=>'tmp/test.erector', :data=>data)
|
22
|
+
|
23
|
+
html.assert.include?('<h1>Example Document</h1>')
|
24
|
+
|
25
|
+
We can get a hold of the Erector document via the Malt.file function.
|
26
|
+
|
27
|
+
erector = Malt.file('tmp/test.erector')
|
28
|
+
|
29
|
+
erector.class.assert == Malt::Format::Erector
|
30
|
+
|
31
|
+
We can convert Erector documents to html very easily.
|
32
|
+
|
33
|
+
data = {:title => "Document"}
|
34
|
+
|
35
|
+
html = erector.to_html(data)
|
36
|
+
|
37
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
38
|
+
|
39
|
+
html.class.assert == Malt::Format::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 Document</h1>')
|
44
|
+
|
45
|
+
Or we can convert the Erector document directly to HTML via the #html method.
|
46
|
+
|
47
|
+
out = erector.html(data)
|
48
|
+
|
49
|
+
out.assert.include?('<h1>Example Document</h1>')
|
50
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
== Mustache
|
2
|
+
|
3
|
+
Lets say we have a Mustache document called 'test.mustache' containing:
|
4
|
+
|
5
|
+
<h1>Example {{ title }}</h1>
|
6
|
+
|
7
|
+
<p>This is an example of a Mustache template.</p>
|
8
|
+
|
9
|
+
We can render mustache documents via the +render+ method, as we can any format.
|
10
|
+
However, becuase Mustache is a template format and not just a markup syntax,
|
11
|
+
we need to also provide the +render+ function with data for interpolation
|
12
|
+
into the mustache document.
|
13
|
+
|
14
|
+
data = { :title=>"Document" }
|
15
|
+
|
16
|
+
html = Malt.render(:file=>'tmp/test.mustache', :data=>data)
|
17
|
+
|
18
|
+
html.assert.include?('<h1>Example Document</h1>')
|
19
|
+
|
20
|
+
Mustache doesn't actually care what format the document is rendered as, since it
|
21
|
+
is purely a template engine that can be applied to any other format.
|
22
|
+
Lets say we have a Mustache document called 'test.mustache' containing ...
|
23
|
+
|
24
|
+
<h1>Example {{ title }}</h1>
|
25
|
+
|
26
|
+
<p>This is an example of a Mustache template.</p>
|
27
|
+
|
28
|
+
We can render erb documents to any format we wish.
|
29
|
+
|
30
|
+
liq = Malt.file('tmp/test.mustache')
|
31
|
+
|
32
|
+
html = liq.to_html(:title=>"Document")
|
33
|
+
|
34
|
+
We will notice that the output is an instance of Malt::Format::HTML.
|
35
|
+
|
36
|
+
html.class.assert == Malt::Format::HTML
|
37
|
+
|
38
|
+
We will notice that the output is an instance of Malt::Format::HTML.
|
39
|
+
|
40
|
+
html.class.assert == Malt::Format::HTML
|
41
|
+
|
42
|
+
Then by calling #to_s we can get the rendered HTML document.
|
43
|
+
|
44
|
+
html.to_s.assert.include?('<h1>Example Document</h1>')
|
45
|
+
|
46
|
+
Or we can convert the document directly to HTML via the #html method.
|
47
|
+
|
48
|
+
out = liq.html(:title=>"Alternate")
|
49
|
+
|
50
|
+
out.assert.include?('<h1>Example Alternate</h1>')
|
51
|
+
|
52
|
+
Mustache doesn't actually care what format the document is rendered as, since it
|
53
|
+
is purely a template engine that can be applied to any format.
|
54
|
+
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: malt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thomas Sawyer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-28 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -172,6 +172,62 @@ dependencies:
|
|
172
172
|
version: "0"
|
173
173
|
type: :development
|
174
174
|
version_requirements: *id011
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: mustache
|
177
|
+
prerelease: false
|
178
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
hash: 3
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
version: "0"
|
187
|
+
type: :development
|
188
|
+
version_requirements: *id012
|
189
|
+
- !ruby/object:Gem::Dependency
|
190
|
+
name: erector
|
191
|
+
prerelease: false
|
192
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
hash: 3
|
198
|
+
segments:
|
199
|
+
- 0
|
200
|
+
version: "0"
|
201
|
+
type: :development
|
202
|
+
version_requirements: *id013
|
203
|
+
- !ruby/object:Gem::Dependency
|
204
|
+
name: markaby
|
205
|
+
prerelease: false
|
206
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
208
|
+
requirements:
|
209
|
+
- - ">="
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
hash: 3
|
212
|
+
segments:
|
213
|
+
- 0
|
214
|
+
version: "0"
|
215
|
+
type: :development
|
216
|
+
version_requirements: *id014
|
217
|
+
- !ruby/object:Gem::Dependency
|
218
|
+
name: builder
|
219
|
+
prerelease: false
|
220
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
222
|
+
requirements:
|
223
|
+
- - ">="
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
hash: 3
|
226
|
+
segments:
|
227
|
+
- 0
|
228
|
+
version: "0"
|
229
|
+
type: :development
|
230
|
+
version_requirements: *id015
|
175
231
|
description: Malt provides a factory framework for rendering a variety of template and markup document formats.
|
176
232
|
email: transfire@gmail.com
|
177
233
|
executables:
|
@@ -195,55 +251,64 @@ files:
|
|
195
251
|
- lib/malt/core_ext.rb
|
196
252
|
- lib/malt/engines/abstract.rb
|
197
253
|
- lib/malt/engines/bluecloth.rb
|
254
|
+
- lib/malt/engines/builder.rb
|
198
255
|
- lib/malt/engines/erb.rb
|
256
|
+
- lib/malt/engines/erector.rb
|
199
257
|
- lib/malt/engines/erubis.rb
|
200
258
|
- lib/malt/engines/haml.rb
|
201
259
|
- lib/malt/engines/kramdown.rb
|
202
260
|
- lib/malt/engines/less.rb
|
203
261
|
- lib/malt/engines/liquid.rb
|
262
|
+
- lib/malt/engines/markaby.rb
|
263
|
+
- lib/malt/engines/mustache.rb
|
204
264
|
- lib/malt/engines/radius.rb
|
265
|
+
- lib/malt/engines/ragtag.rb
|
205
266
|
- lib/malt/engines/rdiscount.rb
|
206
267
|
- lib/malt/engines/rdoc.rb
|
207
268
|
- lib/malt/engines/redcloth.rb
|
208
|
-
- lib/malt/engines/rtals.rb
|
209
269
|
- lib/malt/engines/ruby.rb
|
210
270
|
- lib/malt/engines/sass.rb
|
211
271
|
- lib/malt/engines/tenjin.rb
|
212
272
|
- lib/malt/engines.rb
|
213
273
|
- lib/malt/formats/abstract.rb
|
214
274
|
- lib/malt/formats/abstract_template.rb
|
275
|
+
- lib/malt/formats/builder.rb
|
215
276
|
- lib/malt/formats/css.rb
|
216
277
|
- lib/malt/formats/erb.rb
|
278
|
+
- lib/malt/formats/erector.rb
|
217
279
|
- lib/malt/formats/haml.rb
|
218
280
|
- lib/malt/formats/html.rb
|
219
281
|
- lib/malt/formats/latex.rb
|
220
282
|
- lib/malt/formats/less.rb
|
221
283
|
- lib/malt/formats/liquid.rb
|
284
|
+
- lib/malt/formats/markaby.rb
|
222
285
|
- lib/malt/formats/markdown.rb
|
286
|
+
- lib/malt/formats/mustache.rb
|
223
287
|
- lib/malt/formats/pdf.rb
|
224
288
|
- lib/malt/formats/radius.rb
|
289
|
+
- lib/malt/formats/ragtag.rb
|
225
290
|
- lib/malt/formats/rbhtml.rb
|
226
291
|
- lib/malt/formats/rdoc.rb
|
227
292
|
- lib/malt/formats/rhtml.rb
|
228
|
-
- lib/malt/formats/rtals.rb
|
229
293
|
- lib/malt/formats/ruby.rb
|
230
294
|
- lib/malt/formats/sass.rb
|
231
295
|
- lib/malt/formats/scss.rb
|
232
296
|
- lib/malt/formats/tenjin.rb
|
233
297
|
- lib/malt/formats/text.rb
|
234
298
|
- lib/malt/formats/textile.rb
|
299
|
+
- lib/malt/formats/xml.rb
|
235
300
|
- lib/malt/formats/yaml.rb
|
236
301
|
- lib/malt/formats.rb
|
237
302
|
- lib/malt/kernel.rb
|
238
303
|
- lib/malt/markup.rb
|
239
304
|
- lib/malt/meta/data.rb
|
240
|
-
- lib/malt/meta/
|
305
|
+
- lib/malt/meta/package
|
241
306
|
- lib/malt/meta/profile
|
242
307
|
- lib/malt/render.rb
|
243
308
|
- lib/malt/template.rb
|
244
309
|
- lib/malt.rb
|
245
310
|
- meta/data.rb
|
246
|
-
- meta/
|
311
|
+
- meta/package
|
247
312
|
- meta/profile
|
248
313
|
- qed/01_overview.rdoc
|
249
314
|
- qed/02_formats.rdoc
|
@@ -254,7 +319,7 @@ files:
|
|
254
319
|
- qed/03_formats/05_erb.rdoc
|
255
320
|
- qed/03_formats/06_liquid.rdoc
|
256
321
|
- qed/03_formats/07_haml.rdoc
|
257
|
-
- qed/03_formats/
|
322
|
+
- qed/03_formats/08_ragtag.rdoc
|
258
323
|
- qed/03_formats/09_radius.rdoc
|
259
324
|
- qed/03_formats/11_tenjin.rdoc
|
260
325
|
- qed/03_formats/12_rbhtml.rdoc
|
@@ -262,6 +327,10 @@ files:
|
|
262
327
|
- qed/03_formats/14_scss.rdoc
|
263
328
|
- qed/03_formats/15_less.rdoc
|
264
329
|
- qed/03_formats/16_ruby.rdoc
|
330
|
+
- qed/03_formats/17_markaby.rdoc
|
331
|
+
- qed/03_formats/18_builder.rb
|
332
|
+
- qed/03_formats/19_erector.rb
|
333
|
+
- qed/03_formats/20_mustache.rdoc
|
265
334
|
- qed/applique/malt.rb
|
266
335
|
- qed/samples/data.yml
|
267
336
|
- qed/samples/output-erb.txt
|
@@ -270,10 +339,10 @@ files:
|
|
270
339
|
- qed/samples/output-radius.txt
|
271
340
|
- qed/samples/sample.erb
|
272
341
|
- qed/samples/sample.liquid
|
342
|
+
- qed/samples/sample.markdown
|
273
343
|
- qed/samples/sample.mustache
|
274
344
|
- qed/samples/sample.radius
|
275
|
-
-
|
276
|
-
- test/samples/sample.rdoc
|
345
|
+
- qed/samples/sample.rdoc
|
277
346
|
- README.rdoc
|
278
347
|
- Syckfile
|
279
348
|
- History.rdoc
|