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
@@ -1 +0,0 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)+'/../../lib')
|
data/lib/malt/formats/erector.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'malt/formats/abstract'
|
2
|
-
require 'malt/formats/html'
|
3
|
-
require 'malt/engines/erector'
|
4
|
-
|
5
|
-
module Malt::Format
|
6
|
-
|
7
|
-
# Erecotr looks like a Markup format, but it is a template format
|
8
|
-
# Much like pure Ruby too.
|
9
|
-
class Erector < Abstract
|
10
|
-
|
11
|
-
register 'erector'
|
12
|
-
|
13
|
-
#
|
14
|
-
def erector(*)
|
15
|
-
text
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
def to_erector(*)
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
#
|
24
|
-
def html(data=nil, &yld)
|
25
|
-
render_engine.render(:format=>:html, :text=>text, :file=>file, :data=>data, &yld)
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
def to_html(data=nil, &yld)
|
30
|
-
text = html(data, &yld)
|
31
|
-
opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html)
|
32
|
-
HTML.new(opts)
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
#def to_ruby(db, &yld)
|
37
|
-
# @ruby ||= (
|
38
|
-
# source = engine.compile(text, file)
|
39
|
-
# Ruby.new(:text=>source, :file=>refile(:rb))
|
40
|
-
# )
|
41
|
-
#end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
#
|
46
|
-
def render_engine
|
47
|
-
@render_engine ||= Malt::Engine::Erector.new(options)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
data/lib/malt/formats/markaby.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'malt/formats/abstract'
|
2
|
-
require 'malt/formats/html'
|
3
|
-
require 'malt/engines/markaby'
|
4
|
-
|
5
|
-
module Malt::Format
|
6
|
-
|
7
|
-
# Erecotr looks like a Markup format, but it is a template format
|
8
|
-
# Much like pure Ruby too.
|
9
|
-
class Markaby < Abstract
|
10
|
-
|
11
|
-
register 'markaby', 'mab'
|
12
|
-
|
13
|
-
#
|
14
|
-
def markaby(*)
|
15
|
-
text
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
def to_markaby(*)
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
#
|
24
|
-
def html(data=nil, &yld)
|
25
|
-
render_engine.render(:format=>:html, :text=>text, :file=>file, :data=>data, &yld)
|
26
|
-
end
|
27
|
-
|
28
|
-
#
|
29
|
-
def to_html(data=nil, &yld)
|
30
|
-
text = html(data, &yld)
|
31
|
-
opts = options.merge(:text=>text, :file=>refile(:html), :type=>:html)
|
32
|
-
HTML.new(opts)
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
#def to_ruby(db, &yld)
|
37
|
-
# @ruby ||= (
|
38
|
-
# source = engine.compile(text, file)
|
39
|
-
# Ruby.new(:text=>source, :file=>refile(:rb))
|
40
|
-
# )
|
41
|
-
#end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
#
|
46
|
-
def render_engine
|
47
|
-
@render_engine ||= Malt::Engine::Markaby.new(options)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
data/lib/malt/meta/data.rb
DELETED
@@ -1,26 +0,0 @@
|
|
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.package
|
8
|
-
@package ||= (
|
9
|
-
require 'yaml'
|
10
|
-
YAML.load(File.new(DIRECTORY + '/package'))
|
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
|
-
package[key] || profile[key] || super(name)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/lib/malt/meta/package
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
name : malt
|
2
|
-
date : 2010-11-04
|
3
|
-
version : 0.3.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
|
-
- mustache (test)
|
18
|
-
- erector (test)
|
19
|
-
- markaby (test)
|
20
|
-
- builder (test)
|
21
|
-
|
data/lib/malt/meta/profile
DELETED
@@ -1,21 +0,0 @@
|
|
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
|
data/meta/data.rb
DELETED
@@ -1,26 +0,0 @@
|
|
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.package
|
8
|
-
@package ||= (
|
9
|
-
require 'yaml'
|
10
|
-
YAML.load(File.new(DIRECTORY + '/package'))
|
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
|
-
package[key] || profile[key] || super(name)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
data/meta/package
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
name : malt
|
2
|
-
date : 2010-11-04
|
3
|
-
version : 0.3.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
|
-
- mustache (test)
|
18
|
-
- erector (test)
|
19
|
-
- markaby (test)
|
20
|
-
- builder (test)
|
21
|
-
|
data/meta/profile
DELETED
@@ -1,21 +0,0 @@
|
|
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
|
data/qed/01_overview.rdoc
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
= Introduction
|
2
|
-
|
3
|
-
Malt is a multi-template rendering framework. It provides two convenient
|
4
|
-
interfaces for working with backend template systems. The first is
|
5
|
-
a functional interface via `Malt.render` method. And the second is an
|
6
|
-
object-oriented interface that can be easily constructed via the
|
7
|
-
`Malt.file` or `Malt.text` methods.
|
8
|
-
|
data/qed/02_formats.rdoc
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
= Formats
|
2
|
-
|
3
|
-
We have created a set of sample documents in the samples directory.
|
4
|
-
We will take each format in turn.
|
5
|
-
|
6
|
-
formats = %w{erb liquid}
|
7
|
-
|
8
|
-
Included with the format samples are files containing the expected results
|
9
|
-
of each rendering.
|
10
|
-
|
11
|
-
expected_output = {}
|
12
|
-
|
13
|
-
formats.each do |format|
|
14
|
-
expected_output[format] = File.read("qed/samples/output-#{format}.txt")
|
15
|
-
end
|
16
|
-
|
17
|
-
The data to inject into the formats that interpolate, is also stored in the
|
18
|
-
samples folder.
|
19
|
-
|
20
|
-
data = YAML.load(File.new('qed/samples/data.yml'))
|
21
|
-
|
22
|
-
Now we can render each of thes formats, and verify we get the expected result.
|
23
|
-
|
24
|
-
formats.each do |format|
|
25
|
-
output = Malt.render(:file=>"qed/samples/sample.#{format}", :format=>format, :data=>data)
|
26
|
-
output.assert == expected_output[format]
|
27
|
-
end
|
28
|
-
|
29
|
-
Notice that formats the do not use interpolation data simply ignore it even
|
30
|
-
if it is given.
|
31
|
-
|
32
|
-
We can also handle the files in a more object-oriented manner.
|
33
|
-
|
34
|
-
formats.each do |format|
|
35
|
-
object = Malt.file("qed/samples/sample.#{format}", :format=>format)
|
36
|
-
output = object.render(data)
|
37
|
-
output.assert == expected_output[format]
|
38
|
-
end
|
39
|
-
|
@@ -1,7 +0,0 @@
|
|
1
|
-
= Formats
|
2
|
-
|
3
|
-
Malt support a wide variety of markup and template systems.
|
4
|
-
|
5
|
-
Malt provides two distinct APIs for rendering each format --a single-point-of-entry
|
6
|
-
functional interface, `Malt.render`, and an object-oriented interface where by
|
7
|
-
each format is represented by a document class.
|
data/qed/03_formats/02_rdoc.rdoc
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
== RDoc
|
2
|
-
|
3
|
-
Lets say we have a RDoc document called 'test.rdoc' containing:
|
4
|
-
|
5
|
-
= Example
|
6
|
-
|
7
|
-
This is an example of RDoc rendering.
|
8
|
-
|
9
|
-
We can convert rdoc documents to html easily via the univeral +render+ function.
|
10
|
-
|
11
|
-
html = Malt.render(:file=>'tmp/test.rdoc')
|
12
|
-
|
13
|
-
html.assert.include?('<h1>Example</h1>')
|
14
|
-
|
15
|
-
Malt recognizes the type of file by the '.rdoc' extension and renders it using
|
16
|
-
the default redering engine (in this case RDoc itself). By default the engine
|
17
|
-
renders to HTML, so we did not need to specify the output :format option to
|
18
|
-
the +render+ method.
|
19
|
-
|
20
|
-
If we have a file that has a different extension, but is in fact an RDoc
|
21
|
-
document, we can inform Malt.
|
22
|
-
|
23
|
-
Lets say we have an RDoc document called 'test.txt' containing:
|
24
|
-
|
25
|
-
= Example
|
26
|
-
|
27
|
-
This is an example of RDoc rendering.
|
28
|
-
|
29
|
-
We can inform Malt as the actual type using the `:type` option.
|
30
|
-
|
31
|
-
html = Malt.render(:file=>'tmp/test.txt', :type=>:rdoc)
|
32
|
-
|
33
|
-
html.assert.include?('<h1>Example</h1>')
|
34
|
-
|
35
|
-
Alternately we can use the object-oriented interface. Again, lets say we have
|
36
|
-
an RDoc document called 'test.rdoc' containing ...
|
37
|
-
|
38
|
-
= Example
|
39
|
-
|
40
|
-
This is an example of RDOC rendering.
|
41
|
-
|
42
|
-
Then we can use the `Malt.file` method to instantiate an RDoc object.
|
43
|
-
|
44
|
-
rdoc = Malt.file('tmp/test.rdoc')
|
45
|
-
|
46
|
-
We will notice that the output is an instance of Malt::Formats::HTML.
|
47
|
-
|
48
|
-
rdoc.class.assert == Malt::Format::RDoc
|
49
|
-
|
50
|
-
While we could have used `Malt::Formats::RDoc.new` to create the object directly,
|
51
|
-
Malt provides the #file, as well as #text, methods for convience. We can convert
|
52
|
-
the rdoc to html with the #to_html method.
|
53
|
-
|
54
|
-
html = rdoc.to_html
|
55
|
-
|
56
|
-
Again notice that the output is an instance of Malt::Format::HTML.
|
57
|
-
|
58
|
-
html.class.assert == Malt::Format::HTML
|
59
|
-
|
60
|
-
And that by calling #to_s we can get the rendered HTML document.
|
61
|
-
|
62
|
-
html.to_s.assert.include?('<h1>Example</h1>')
|
63
|
-
|
64
|
-
We can convert rdoc documents to html very easily.
|
65
|
-
|
66
|
-
rdoc = Malt.file('tmp/test.rdoc')
|
67
|
-
|
68
|
-
html = rdoc.to_html
|
69
|
-
|
70
|
-
First we will notice that the output is an instance of Malt::Format::HTML.
|
71
|
-
|
72
|
-
html.class.assert == Malt::Format::HTML
|
73
|
-
|
74
|
-
And that by calling #to_s we can get the rendered HTML document.
|
75
|
-
|
76
|
-
html.to_s.assert.include?('<h1>Example</h1>')
|
77
|
-
|
78
|
-
Or we can convert the RDoc document directly to HTML via the #html method.
|
79
|
-
|
80
|
-
out = rdoc.html
|
81
|
-
|
82
|
-
out.assert.include?('<h1>Example</h1>')
|
83
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
== Textile
|
2
|
-
|
3
|
-
Malt supports Textile via RedCloth.
|
4
|
-
|
5
|
-
Lets say we have a Textile document called 'test.tt' containing ...
|
6
|
-
|
7
|
-
h1. Example
|
8
|
-
|
9
|
-
This is an example of Textile rendering.
|
10
|
-
|
11
|
-
We can redner the textile document via the universal render function.
|
12
|
-
Textile documents are recognized by the +.textile+ or +.tt+ extension.
|
13
|
-
|
14
|
-
html = Malt.render(:file=>'tmp/test.tt')
|
15
|
-
|
16
|
-
html.assert.include?('<h1>Example</h1>')
|
17
|
-
|
18
|
-
Malt supports Textile via either the RedCloth or the ___ backend.
|
19
|
-
|
20
|
-
Lets say we have an Textile document called 'test.tt' containing ...
|
21
|
-
|
22
|
-
h1. Example
|
23
|
-
|
24
|
-
This is an example of Textile rendering.
|
25
|
-
|
26
|
-
We can access the file via the +Malt.file+ method. Textile documents are
|
27
|
-
recognized by the +.textile+ or +.tt+ extension.
|
28
|
-
|
29
|
-
tile = Malt.file('tmp/test.tt')
|
30
|
-
|
31
|
-
We can the convert the document to a Malt Html object via the #to_html method.
|
32
|
-
|
33
|
-
html = tile.to_html
|
34
|
-
|
35
|
-
Notice that the output is an instance of Malt::Format::HTML.
|
36
|
-
|
37
|
-
html.class.assert == Malt::Format::HTML
|
38
|
-
|
39
|
-
And that by calling #to_s we can get the rendered HTML document.
|
40
|
-
|
41
|
-
html.to_s.assert.include?('<h1>Example</h1>')
|
42
|
-
|
43
|
-
Or we can convert the document directly to HTML via the #html method.
|
44
|
-
|
45
|
-
out = tile.html
|
46
|
-
|
47
|
-
out.assert.include?('<h1>Example</h1>')
|
48
|
-
|