malt 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +156 -0
- data/Assembly +28 -0
- data/COPYING.rdoc +33 -0
- data/Gemfile +10 -0
- data/HISTORY.rdoc +102 -0
- data/README.rdoc +16 -10
- data/Reapfile +4 -0
- data/lib/malt.rb +36 -8
- data/lib/malt.yml +156 -0
- data/lib/malt/conversions.rb +42 -0
- data/lib/malt/core_ext.rb +81 -3
- data/lib/malt/engines/abstract.rb +259 -50
- data/lib/malt/engines/bluecloth.rb +19 -9
- data/lib/malt/engines/builder.rb +93 -32
- data/lib/malt/engines/coffee.rb +46 -0
- data/lib/malt/engines/creole.rb +60 -0
- data/lib/malt/engines/erb.rb +69 -44
- data/lib/malt/engines/erector.rb +61 -30
- data/lib/malt/engines/erubis.rb +41 -31
- data/lib/malt/engines/haml.rb +13 -37
- data/lib/malt/engines/kramdown.rb +40 -15
- data/lib/malt/engines/less.rb +15 -14
- data/lib/malt/engines/liquid.rb +24 -14
- data/lib/malt/engines/markaby.rb +44 -22
- data/lib/malt/engines/maruku.rb +89 -0
- data/lib/malt/engines/mustache.rb +20 -14
- data/lib/malt/engines/nokogiri.rb +89 -0
- data/lib/malt/engines/radius.rb +72 -34
- data/lib/malt/engines/ragtag.rb +26 -18
- data/lib/malt/engines/rdiscount.rb +18 -11
- data/lib/malt/engines/rdoc.rb +21 -15
- data/lib/malt/engines/redcarpet.rb +137 -0
- data/lib/malt/engines/redcloth.rb +15 -7
- data/lib/malt/engines/ruby.rb +13 -12
- data/lib/malt/engines/sass.rb +30 -17
- data/lib/malt/engines/string.rb +36 -0
- data/lib/malt/engines/tenjin.rb +70 -27
- data/lib/malt/engines/wikicloth.rb +48 -0
- data/lib/malt/formats/abstract.rb +90 -29
- data/lib/malt/formats/abstract_template.rb +10 -8
- data/lib/malt/formats/builder.rb +39 -13
- data/lib/malt/formats/coffee.rb +54 -0
- data/lib/malt/formats/css.rb +3 -3
- data/lib/malt/formats/erb.rb +31 -66
- data/lib/malt/formats/haml.rb +8 -8
- data/lib/malt/formats/html.rb +1 -7
- data/lib/malt/formats/javascript.rb +27 -0
- data/lib/malt/formats/latex.rb +1 -1
- data/lib/malt/formats/less.rb +13 -11
- data/lib/malt/formats/liquid.rb +7 -7
- data/lib/malt/formats/markdown.rb +43 -44
- data/lib/malt/formats/mediawiki.rb +70 -0
- data/lib/malt/formats/mustache.rb +5 -5
- data/lib/malt/formats/pdf.rb +1 -7
- data/lib/malt/formats/radius.rb +5 -4
- data/lib/malt/formats/ragtag.rb +14 -13
- data/lib/malt/formats/rbhtml.rb +28 -20
- data/lib/malt/formats/rdoc.rb +5 -4
- data/lib/malt/formats/rhtml.rb +19 -43
- data/lib/malt/formats/ruby.rb +11 -45
- data/lib/malt/formats/sass.rb +16 -24
- data/lib/malt/formats/scss.rb +13 -30
- data/lib/malt/formats/string.rb +61 -0
- data/lib/malt/formats/tenjin.rb +4 -4
- data/lib/malt/formats/text.rb +1 -1
- data/lib/malt/formats/textile.rb +7 -19
- data/lib/malt/kernel.rb +1 -2
- data/lib/malt/machine.rb +83 -13
- data/lib/malt/tilted.rb +216 -0
- data/lib/malt/version.rb +21 -0
- data/test/helper.rb +15 -0
- data/test/unit/engines/case_engine_bluecloth.rb +40 -0
- data/test/unit/engines/case_engine_builder.rb +30 -0
- data/test/unit/engines/case_engine_coffee.rb +30 -0
- data/test/unit/engines/case_engine_creole.rb +35 -0
- data/test/unit/engines/case_engine_erb.rb +28 -0
- data/test/unit/engines/case_engine_erector.rb +36 -0
- data/test/unit/engines/case_engine_erubis.rb +28 -0
- data/test/unit/engines/case_engine_haml.rb +30 -0
- data/test/unit/engines/case_engine_kramdown.rb +30 -0
- data/test/unit/engines/case_engine_less.rb +40 -0
- data/test/unit/engines/case_engine_liquid.rb +28 -0
- data/test/unit/engines/case_engine_markaby.rb +20 -0
- data/test/unit/engines/case_engine_maruku.rb +30 -0
- data/test/unit/engines/case_engine_mustache.rb +28 -0
- data/test/unit/engines/case_engine_nokogiri.rb +30 -0
- data/test/unit/engines/case_engine_radius.rb +30 -0
- data/test/unit/engines/case_engine_ragtag.rb +40 -0
- data/test/unit/engines/case_engine_rdiscount.rb +30 -0
- data/test/unit/engines/case_engine_rdoc.rb +31 -0
- data/test/unit/engines/case_engine_redcarpet.rb +30 -0
- data/test/unit/engines/case_engine_redcloth.rb +31 -0
- data/test/unit/engines/case_engine_ruby.rb +28 -0
- data/test/unit/engines/case_engine_sass.rb +36 -0
- data/test/unit/engines/case_engine_string.rb +28 -0
- data/test/unit/engines/case_engine_tenjin.rb +28 -0
- data/test/unit/engines/case_engine_wikicloth.rb +25 -0
- data/test/unit/machine.rb +27 -0
- data/test/unit/malt.rb +12 -0
- metadata +364 -266
- data/History.rdoc +0 -64
- data/License.txt +0 -205
- data/Syckfile +0 -80
- data/features/consistent_rendering.feature +0 -36
- data/features/samples/sample.erb +0 -1
- data/features/samples/sample.erubis +0 -1
- data/features/samples/sample.liquid +0 -1
- data/features/samples/sample.mustache +0 -1
- data/features/samples/sample.radius +0 -1
- data/features/step_definitions/engine_steps.rb +0 -49
- data/features/support/loadpath.rb +0 -1
- data/features/support/sample_class.rb +0 -8
- data/lib/malt/formats/erector.rb +0 -53
- data/lib/malt/formats/markaby.rb +0 -53
- data/lib/malt/meta/data.rb +0 -26
- data/lib/malt/meta/package +0 -21
- data/lib/malt/meta/profile +0 -21
- data/meta/data.rb +0 -26
- data/meta/package +0 -21
- data/meta/profile +0 -21
- data/qed/01_overview.rdoc +0 -8
- data/qed/02_formats.rdoc +0 -39
- data/qed/03_formats/01_overview.rdoc +0 -7
- data/qed/03_formats/02_rdoc.rdoc +0 -83
- data/qed/03_formats/03_textile.rdoc +0 -48
- data/qed/03_formats/04_markdown.rdoc +0 -66
- data/qed/03_formats/05_erb.rdoc +0 -65
- data/qed/03_formats/06_liquid.rdoc +0 -54
- data/qed/03_formats/07_haml.rdoc +0 -44
- data/qed/03_formats/08_ragtag.rdoc +0 -19
- data/qed/03_formats/09_radius.rdoc +0 -43
- data/qed/03_formats/11_tenjin.rdoc +0 -47
- data/qed/03_formats/12_rbhtml.rdoc +0 -55
- data/qed/03_formats/13_sass.rdoc +0 -55
- data/qed/03_formats/14_scss.rdoc +0 -58
- data/qed/03_formats/15_less.rdoc +0 -46
- data/qed/03_formats/16_ruby.rdoc +0 -48
- data/qed/03_formats/17_markaby.rdoc +0 -50
- data/qed/03_formats/18_builder.rb +0 -50
- data/qed/03_formats/19_erector.rb +0 -50
- data/qed/03_formats/20_mustache.rdoc +0 -54
- data/qed/05_machine/01_limited_formats.rdoc +0 -29
- data/qed/05_machine/02_prioritized_engines.rdoc +0 -34
- data/qed/applique/malt.rb +0 -13
- data/qed/samples/data.yml +0 -4
- data/qed/samples/output-erb.txt +0 -1
- data/qed/samples/output-liquid.txt +0 -1
- data/qed/samples/output-mustache.txt +0 -1
- data/qed/samples/output-radius.txt +0 -1
- data/qed/samples/sample.erb +0 -1
- data/qed/samples/sample.liquid +0 -1
- data/qed/samples/sample.markdown +0 -308
- data/qed/samples/sample.mustache +0 -1
- data/qed/samples/sample.radius +0 -1
- data/qed/samples/sample.rdoc +0 -8
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'malt/engines/abstract'
|
2
|
+
|
3
|
+
module Malt::Engine
|
4
|
+
|
5
|
+
# Ruby strings as template engine.
|
6
|
+
#
|
7
|
+
# @see http://ruby-lang.org
|
8
|
+
#
|
9
|
+
class String < Abstract
|
10
|
+
|
11
|
+
default :str
|
12
|
+
|
13
|
+
#
|
14
|
+
def render(params={}, &content)
|
15
|
+
text, file, scope, locals = parameters(params, :text, :file, :scope, :locals)
|
16
|
+
|
17
|
+
bind = make_binding(scope, locals, &content)
|
18
|
+
eval("%{#{text}}", bind, file || '(eval)')
|
19
|
+
end
|
20
|
+
|
21
|
+
# Ruby compiles to Ruby. How odd. ;)
|
22
|
+
def compile(params)
|
23
|
+
text = parameters(params, :text)
|
24
|
+
"%{#{text}}"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
#
|
30
|
+
def require_engine
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
data/lib/malt/engines/tenjin.rb
CHANGED
@@ -4,55 +4,98 @@ module Malt::Engine
|
|
4
4
|
|
5
5
|
# Tenjin
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# @see http://www.kuwata-lab.com/tenjin/
|
8
8
|
#
|
9
|
-
#
|
10
|
-
#
|
9
|
+
# Let to it's own designs, Tenjin renders data as template instance variables.
|
10
|
+
# But that will not work for Malt, so use regular variables instead.
|
11
11
|
#
|
12
12
|
class Tenjin < Abstract
|
13
13
|
|
14
14
|
default :tenjin, :rbhtml
|
15
15
|
|
16
|
+
# Render Tenjin.
|
16
17
|
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
type = params
|
22
|
-
|
18
|
+
# @option params [String] :escapefunc
|
19
|
+
# Defaults to 'CGI.escapeHTML'.
|
20
|
+
#
|
21
|
+
def render(params, &content)
|
22
|
+
into, text, file, type, scope, locals = parameters(params, :to, :text, :file, :type, :scope, :locals)
|
23
|
+
|
24
|
+
into ||= :html
|
23
25
|
|
24
|
-
|
26
|
+
if type == :rbhtml && into != :html
|
27
|
+
super(params, &content)
|
28
|
+
else
|
29
|
+
scope, locals = make_ready(scope, locals, &content)
|
25
30
|
|
26
|
-
|
27
|
-
template = intermediate(params)
|
28
|
-
template.convert(text, file)
|
31
|
+
engine = prepare_engine(params)
|
29
32
|
|
30
|
-
|
33
|
+
engine.call(scope, locals)
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
37
|
+
# TODO: is there a way to split this out to a #compile method?
|
38
|
+
|
33
39
|
#
|
34
|
-
def
|
35
|
-
text = params
|
36
|
-
|
37
|
-
|
40
|
+
def prepare_engine(params={}, &content)
|
41
|
+
text, file = parameters(params, :text, :file)
|
42
|
+
|
43
|
+
file ||= "(tenjin)"
|
44
|
+
|
45
|
+
engine = create_engine(params)
|
46
|
+
script = engine.convert(text, file)
|
47
|
+
|
48
|
+
lambda do |scope, locals|
|
49
|
+
vars, vals = [], []
|
50
|
+
locals.each do |k,v|
|
51
|
+
vars << k
|
52
|
+
vals << v
|
53
|
+
end
|
54
|
+
|
55
|
+
code = %{
|
56
|
+
lambda do |#{vars.join(',')}|
|
57
|
+
_buf = ''
|
58
|
+
#{script}
|
59
|
+
_buf
|
60
|
+
end
|
61
|
+
}
|
62
|
+
|
63
|
+
eval(code, scope.to_binding, file, 2).call(*vals)
|
64
|
+
end
|
38
65
|
end
|
39
66
|
|
40
|
-
|
67
|
+
#
|
68
|
+
def create_engine(params={})
|
69
|
+
file, text = parameters(params, :file, :text)
|
70
|
+
|
71
|
+
opts = engine_options(params)
|
72
|
+
|
73
|
+
opts[:escapefunc] ||= 'CGI.escapeHTML'
|
41
74
|
|
42
|
-
|
43
|
-
|
75
|
+
cached(text, file, opts) do
|
76
|
+
::Tenjin::Template.new(nil, opts)
|
77
|
+
end
|
44
78
|
end
|
45
79
|
|
46
|
-
#
|
47
|
-
def
|
80
|
+
# Compile Tenjin document into Ruby source code.
|
81
|
+
#def compile(params)
|
82
|
+
# text, file = parameters(params, :text, :file)
|
83
|
+
# code = intermediate(params).convert(text, file)
|
84
|
+
# "_buf = ''\n#{code}\n_buf"
|
85
|
+
#end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
# Load Tenjin library if not already loaded.
|
90
|
+
def require_engine
|
48
91
|
return if defined? ::Tenjin::Engine
|
49
92
|
require_library 'tenjin'
|
93
|
+
require 'cgi'
|
50
94
|
end
|
51
95
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
opts
|
96
|
+
#
|
97
|
+
def engine_option_names
|
98
|
+
[:escapefunc]
|
56
99
|
end
|
57
100
|
|
58
101
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'malt/engines/abstract'
|
2
|
+
|
3
|
+
module Malt::Engine
|
4
|
+
|
5
|
+
# WikiCloth is a MediaWiki format for Ruby. Unlike Creole, WikiCloth
|
6
|
+
# also supports variable interpolation.
|
7
|
+
#
|
8
|
+
#@see http://code.google.com/p/wikicloth/
|
9
|
+
|
10
|
+
class WikiCloth < Abstract
|
11
|
+
|
12
|
+
default :wiki, :mediawiki, :mw
|
13
|
+
|
14
|
+
#
|
15
|
+
def render(params={}, &content)
|
16
|
+
scope, locals = parameters(params, :scope, :locals)
|
17
|
+
|
18
|
+
data = make_hash(scope, locals, &content)
|
19
|
+
|
20
|
+
case params[:to]
|
21
|
+
when :html, nil
|
22
|
+
prepare_engine(params).to_html(:params => data)
|
23
|
+
else
|
24
|
+
super(params)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
def create_engine(params={})
|
30
|
+
text = parameters(params, :text)
|
31
|
+
|
32
|
+
cached(text) do
|
33
|
+
::WikiCloth::WikiCloth.new(:data => text)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# Load `wikicloth` library if not already loaded.
|
40
|
+
def require_engine
|
41
|
+
return if defined? ::WikiCloth
|
42
|
+
require_library 'wikicloth'
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
@@ -27,8 +27,8 @@ module Format
|
|
27
27
|
include Malt::Kernel
|
28
28
|
|
29
29
|
# Register the class to an extension type.
|
30
|
-
def self.
|
31
|
-
@
|
30
|
+
def self.file_extension(*exts)
|
31
|
+
@file_extensions = exts
|
32
32
|
Malt::Format.register(self, *exts)
|
33
33
|
|
34
34
|
#exts.each do |ext|
|
@@ -40,9 +40,14 @@ module Format
|
|
40
40
|
#end
|
41
41
|
end
|
42
42
|
|
43
|
+
# @deprecated
|
44
|
+
def self.register(*exts)
|
45
|
+
self.file_extension(*exts)
|
46
|
+
end
|
47
|
+
|
43
48
|
#
|
44
49
|
def self.extensions
|
45
|
-
@
|
50
|
+
@file_extensions
|
46
51
|
end
|
47
52
|
|
48
53
|
#--
|
@@ -53,37 +58,47 @@ module Format
|
|
53
58
|
@engine
|
54
59
|
end
|
55
60
|
|
56
|
-
|
61
|
+
private
|
57
62
|
|
58
63
|
#
|
59
64
|
def initialize(options={})
|
60
65
|
@options = options.rekey
|
61
|
-
@type = @options[:type]
|
62
|
-
initialize_engine
|
63
|
-
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
@file = @options[:file]
|
68
|
+
@text = @options[:text] || file_read(@file)
|
69
|
+
@type = @options[:type] || file_type(@file)
|
67
70
|
end
|
68
71
|
|
69
|
-
|
72
|
+
public
|
70
73
|
|
71
74
|
# Access to the options given to the initializer.
|
72
75
|
attr :options
|
73
76
|
|
77
|
+
# Change options on the fly.
|
78
|
+
def with(options={})
|
79
|
+
alt = dup
|
80
|
+
alt.with!(options)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Change options in-place.
|
84
|
+
def with!(options)
|
85
|
+
@options.update(options.rekey)
|
86
|
+
self
|
87
|
+
end
|
88
|
+
|
74
89
|
# Document source text.
|
75
90
|
def text
|
76
|
-
@text
|
91
|
+
@text
|
77
92
|
end
|
78
93
|
|
79
94
|
# File name of document.
|
80
95
|
def file
|
81
|
-
@file
|
96
|
+
@file
|
82
97
|
end
|
83
98
|
|
84
99
|
# File extension (with prefixed dot).
|
85
100
|
def type
|
86
|
-
@type
|
101
|
+
@type
|
87
102
|
end
|
88
103
|
|
89
104
|
# Specified engine to use for rendering.
|
@@ -95,25 +110,37 @@ module Format
|
|
95
110
|
end
|
96
111
|
|
97
112
|
#
|
98
|
-
def to(type, data
|
99
|
-
__send__("to_#{type}", data, &yld)
|
113
|
+
def to(type, *data, &yld)
|
114
|
+
__send__("to_#{type}", *data, &yld)
|
100
115
|
end
|
101
116
|
|
102
117
|
# Render to default or given format.
|
103
118
|
#
|
104
119
|
# If the first argument is a Symbol it is considered the format, otherwise
|
105
|
-
# it is taken to be the
|
120
|
+
# it is taken to be the data for rendering template variables.
|
106
121
|
def render(*type_and_data, &yld)
|
107
|
-
type, data =
|
122
|
+
type, data = parse_type_from_data(*type_and_data)
|
108
123
|
meth = method(type || default)
|
109
124
|
#__send__(type || default, data, &yld)
|
110
|
-
meth.arity == 0 ? meth.call(&yld) : meth.call(data, &yld)
|
125
|
+
meth.arity == 0 ? meth.call(&yld) : meth.call(*data, &yld)
|
111
126
|
end
|
112
127
|
|
113
128
|
#
|
114
|
-
|
115
|
-
|
116
|
-
|
129
|
+
def render_into(into, *data, &content)
|
130
|
+
parameters = rendering_parameters(into, data)
|
131
|
+
Malt.render(parameters, &content)
|
132
|
+
end
|
133
|
+
|
134
|
+
#
|
135
|
+
def rendering_parameters(into, data)
|
136
|
+
opts = options.merge(
|
137
|
+
:to => into,
|
138
|
+
:data => data,
|
139
|
+
:text => text,
|
140
|
+
:file => file,
|
141
|
+
:engine => engine
|
142
|
+
)
|
143
|
+
end
|
117
144
|
|
118
145
|
#
|
119
146
|
# def method_missing(s, *a, &b)
|
@@ -152,7 +179,7 @@ module Format
|
|
152
179
|
if type
|
153
180
|
type = type.to_s.sub(/^\./,'')
|
154
181
|
fext = self.class.extensions.find{|e| file.end_with?(e)}
|
155
|
-
new_file = file.chomp(fext) + type
|
182
|
+
new_file = file.chomp(fext) + '.' + type
|
156
183
|
else
|
157
184
|
fext = self.class.extensions.find{|e| file.end_with?(e)}
|
158
185
|
new_file = file.chomp('.'+fext)
|
@@ -179,8 +206,8 @@ module Format
|
|
179
206
|
end
|
180
207
|
|
181
208
|
#
|
182
|
-
def to_default(data
|
183
|
-
to(default, data, &yld)
|
209
|
+
def to_default(*data, &yld)
|
210
|
+
to(default, *data, &yld)
|
184
211
|
end
|
185
212
|
|
186
213
|
# Default rendering type is +:html+. Override if it
|
@@ -190,17 +217,51 @@ module Format
|
|
190
217
|
end
|
191
218
|
|
192
219
|
#
|
193
|
-
def
|
194
|
-
if Symbol ===
|
195
|
-
type =
|
196
|
-
data = type_and_data.last
|
220
|
+
def parse_type_from_data(*data)
|
221
|
+
if Symbol === data.first
|
222
|
+
type = data.shift
|
197
223
|
else
|
198
224
|
type = nil
|
199
|
-
data = type_and_data.first
|
200
225
|
end
|
201
226
|
return type, data
|
202
227
|
end
|
203
228
|
|
229
|
+
##
|
230
|
+
#def parse_type_scope_data(*data)
|
231
|
+
# if Symbol === data.first
|
232
|
+
# type = data.shift
|
233
|
+
# else
|
234
|
+
# type = nil
|
235
|
+
# end
|
236
|
+
# scope, data = scope_vs_data(*data)
|
237
|
+
# return type, scope, data
|
238
|
+
#end
|
239
|
+
|
240
|
+
# @deprecate
|
241
|
+
def scope_vs_data(scope, data=nil)
|
242
|
+
if scope && !data
|
243
|
+
if scope.respond_to?(:to_hash)
|
244
|
+
data = scope
|
245
|
+
scope = nil
|
246
|
+
end
|
247
|
+
end
|
248
|
+
return scope, data
|
249
|
+
end
|
250
|
+
|
251
|
+
#
|
252
|
+
def file_read(file)
|
253
|
+
File.read(file)
|
254
|
+
end
|
255
|
+
|
256
|
+
#
|
257
|
+
def file_type(file)
|
258
|
+
if file
|
259
|
+
File.extname(file)
|
260
|
+
else
|
261
|
+
nil
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
204
265
|
end
|
205
266
|
|
206
267
|
# TODO: Is this needed anymore, if so where?
|
@@ -9,19 +9,21 @@ module Format
|
|
9
9
|
class AbstractTemplate < Abstract
|
10
10
|
|
11
11
|
#
|
12
|
-
def to(type, data
|
12
|
+
def to(type, *data, &yld)
|
13
13
|
new_class = Malt::Format.registry[type.to_sym] # TODO: Malt.machine.format?
|
14
|
-
new_text =
|
14
|
+
new_text = render_into(type, *data, &yld)
|
15
15
|
new_file = refile(type)
|
16
16
|
new_options = options.merge(:text=>new_text, :file=>new_file, :type=>type)
|
17
17
|
new_class.new(new_options)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
#
|
21
|
-
def render(*type_and_data, &
|
22
|
-
type, data =
|
23
|
-
opts = options.merge(:
|
24
|
-
|
21
|
+
def render(*type_and_data, &content)
|
22
|
+
type, data = parse_type_from_data(*type_and_data)
|
23
|
+
#opts = options.merge(:to=>type, :text=>text, :file=>file, :data=>data)
|
24
|
+
render_into(type, *data, &content)
|
25
|
+
|
26
|
+
#render_engine.render(opts, &yld)
|
25
27
|
#opts = options.merge(:format=>type, :text=>text, :file=>file, :data=>data, :engine=>engine)
|
26
28
|
#Malt.render(opts, &yld)
|
27
29
|
end
|
@@ -29,7 +31,7 @@ module Format
|
|
29
31
|
# ERB templates can be any type.
|
30
32
|
def method_missing(sym, *args, &yld)
|
31
33
|
if Malt::Format.registry.key?(sym) # TODO: Malt.machine.format?
|
32
|
-
return
|
34
|
+
return render_into(sym, *args, &yld) #.to_s
|
33
35
|
elsif md = /^to_/.match(sym.to_s)
|
34
36
|
type = md.post_match.to_sym
|
35
37
|
if Malt::Format.registry.key?(type) # TODO: Malt.machine.format?
|