malt 0.3.0 → 0.4.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/.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
data/.ruby
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
---
|
2
|
+
source:
|
3
|
+
- var
|
4
|
+
authors:
|
5
|
+
- name: trans
|
6
|
+
email: transfire@gmail.com
|
7
|
+
copyrights:
|
8
|
+
- holder: Rubyworks
|
9
|
+
year: '2010'
|
10
|
+
license: BSD-2-Clause
|
11
|
+
replacements: []
|
12
|
+
alternatives: []
|
13
|
+
requirements:
|
14
|
+
- name: blankslate
|
15
|
+
- name: detroit
|
16
|
+
groups:
|
17
|
+
- build
|
18
|
+
development: true
|
19
|
+
- name: qed
|
20
|
+
groups:
|
21
|
+
- test
|
22
|
+
development: true
|
23
|
+
- name: test
|
24
|
+
groups:
|
25
|
+
- test
|
26
|
+
development: true
|
27
|
+
- name: lemon
|
28
|
+
groups:
|
29
|
+
- test
|
30
|
+
development: true
|
31
|
+
- name: ae
|
32
|
+
groups:
|
33
|
+
- test
|
34
|
+
development: true
|
35
|
+
- name: rdoc
|
36
|
+
version: 3+
|
37
|
+
groups:
|
38
|
+
- test
|
39
|
+
development: true
|
40
|
+
- name: RedCloth
|
41
|
+
groups:
|
42
|
+
- test
|
43
|
+
development: true
|
44
|
+
- name: bluecloth
|
45
|
+
groups:
|
46
|
+
- test
|
47
|
+
development: true
|
48
|
+
- name: kramdown
|
49
|
+
groups:
|
50
|
+
- test
|
51
|
+
development: true
|
52
|
+
- name: rdiscount
|
53
|
+
groups:
|
54
|
+
- test
|
55
|
+
development: true
|
56
|
+
- name: haml
|
57
|
+
groups:
|
58
|
+
- test
|
59
|
+
development: true
|
60
|
+
- name: sass
|
61
|
+
groups:
|
62
|
+
- test
|
63
|
+
development: true
|
64
|
+
- name: less
|
65
|
+
groups:
|
66
|
+
- test
|
67
|
+
development: true
|
68
|
+
- name: tenjin
|
69
|
+
groups:
|
70
|
+
- test
|
71
|
+
development: true
|
72
|
+
- name: rtals
|
73
|
+
groups:
|
74
|
+
- test
|
75
|
+
development: true
|
76
|
+
- name: liquid
|
77
|
+
groups:
|
78
|
+
- test
|
79
|
+
development: true
|
80
|
+
- name: erubis
|
81
|
+
groups:
|
82
|
+
- test
|
83
|
+
development: true
|
84
|
+
- name: mustache
|
85
|
+
groups:
|
86
|
+
- test
|
87
|
+
development: true
|
88
|
+
- name: markaby
|
89
|
+
groups:
|
90
|
+
- test
|
91
|
+
development: true
|
92
|
+
- name: builder
|
93
|
+
groups:
|
94
|
+
- test
|
95
|
+
development: true
|
96
|
+
- name: radius
|
97
|
+
groups:
|
98
|
+
- test
|
99
|
+
development: true
|
100
|
+
- name: ragtag
|
101
|
+
groups:
|
102
|
+
- test
|
103
|
+
development: true
|
104
|
+
- name: redcarpet
|
105
|
+
groups:
|
106
|
+
- test
|
107
|
+
development: true
|
108
|
+
- name: wikicloth
|
109
|
+
groups:
|
110
|
+
- test
|
111
|
+
development: true
|
112
|
+
- name: maruku
|
113
|
+
groups:
|
114
|
+
- test
|
115
|
+
development: true
|
116
|
+
- name: creole
|
117
|
+
groups:
|
118
|
+
- test
|
119
|
+
development: true
|
120
|
+
- name: erector
|
121
|
+
groups:
|
122
|
+
- test
|
123
|
+
development: true
|
124
|
+
- name: active_support
|
125
|
+
groups:
|
126
|
+
- test
|
127
|
+
development: true
|
128
|
+
- name: coffee-script
|
129
|
+
groups:
|
130
|
+
- test
|
131
|
+
development: true
|
132
|
+
dependencies: []
|
133
|
+
conflicts: []
|
134
|
+
repositories:
|
135
|
+
- uri: git@github.com:rubyworks/malt.git
|
136
|
+
scm: git
|
137
|
+
name: upstream
|
138
|
+
resources:
|
139
|
+
home: http://rubyworks.github.com/malt
|
140
|
+
code: http://github.com/rubyworks/malt
|
141
|
+
wiki: http://wiki.github.com/rubyworks/malt
|
142
|
+
docs: http://rubyworks.github.com/malt/docs/api
|
143
|
+
bugs: http://github.com/rubyworks/malt/issues
|
144
|
+
extra: {}
|
145
|
+
load_path:
|
146
|
+
- lib
|
147
|
+
revision: 0
|
148
|
+
created: '2010-06-22'
|
149
|
+
summary: Multi-template/multi-markup rendering engine
|
150
|
+
title: Malt
|
151
|
+
version: 0.4.0
|
152
|
+
name: malt
|
153
|
+
description: Malt provides a factory framework for rendering a variety of template
|
154
|
+
and markup document formats.
|
155
|
+
organization: rubyworks
|
156
|
+
date: '2011-11-26'
|
data/Assembly
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
gem:
|
3
|
+
active: true
|
4
|
+
|
5
|
+
github:
|
6
|
+
gh_pages: web
|
7
|
+
|
8
|
+
dnote:
|
9
|
+
labels: ~
|
10
|
+
output: log/notes.html
|
11
|
+
|
12
|
+
qedoc:
|
13
|
+
title: Malt Demonstrandum
|
14
|
+
output: web/qed.html
|
15
|
+
|
16
|
+
email:
|
17
|
+
mailto:
|
18
|
+
- ruby-talk@ruby-lang.org
|
19
|
+
- rubyworks-mailinglist@googlegroups.com
|
20
|
+
|
21
|
+
locat:
|
22
|
+
output: log/locat.html
|
23
|
+
|
24
|
+
vclog:
|
25
|
+
output:
|
26
|
+
- log/changes.html
|
27
|
+
- log/history.html
|
28
|
+
|
data/COPYING.rdoc
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
== Malt
|
4
|
+
|
5
|
+
Copyright:: (c) 2010 Rubyworks
|
6
|
+
License:: BSD-2-Clause
|
7
|
+
Website:: http://rubyworks.github.com/malt
|
8
|
+
|
9
|
+
Malt - Multi-Template
|
10
|
+
|
11
|
+
Copyright 2010 Rubyworks. All rights reserved.
|
12
|
+
|
13
|
+
Redistribution and use in source and binary forms, with or without
|
14
|
+
modification, are permitted provided that the following conditions are met:
|
15
|
+
|
16
|
+
1. Redistributions of source code must retain the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer.
|
18
|
+
|
19
|
+
2. Redistributions in binary form must reproduce the above copyright
|
20
|
+
notice, this list of conditions and the following disclaimer in the
|
21
|
+
documentation and/or other materials provided with the distribution.
|
22
|
+
|
23
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
+
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
28
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
30
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
32
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source :rubygems
|
2
|
+
gemspec
|
3
|
+
|
4
|
+
## JRuby can't compile libv8 which both less and coffee-script gems depend.
|
5
|
+
#if defined?(RUBY_ENGINE)
|
6
|
+
# if RUBY_ENGINE == 'jruby'
|
7
|
+
# @dependencies.reject!{ |d| d.name == 'less' or d.name == 'coffee-script' }
|
8
|
+
# end
|
9
|
+
#end
|
10
|
+
|
data/HISTORY.rdoc
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
= Release History
|
2
|
+
|
3
|
+
== 0.4.0 | 2011-11-27
|
4
|
+
|
5
|
+
This release of Malt is a major improvement over the previous release.
|
6
|
+
Where as before not all formats behaved consistently --for instance,
|
7
|
+
not all templating engines handled block yielding, this release has
|
8
|
+
ensured consistent functionality across all engines. A couple of
|
9
|
+
significant changes were made to do this.
|
10
|
+
|
11
|
+
Most important to the end user, templating formats can no longer
|
12
|
+
use `yield` to insert block content, but rather must use `content`.
|
13
|
+
This was done to avoid unnecessary implementation complexity due
|
14
|
+
to Ruby's limitation on the use of yield within Proc objects.
|
15
|
+
The code is much cleaner and subsequently more robust thanks to
|
16
|
+
this change.
|
17
|
+
|
18
|
+
The builder-style engines (Builder, Markaby, Erector and Nokogiri)
|
19
|
+
have all been united under a single `Builder` format class. The
|
20
|
+
common extension for such files is `.rbml`. These engines have been
|
21
|
+
tweaked to behave uniformly, supporting explicit and implicit
|
22
|
+
evaluation modes and using instance variables and externalized
|
23
|
+
scope.
|
24
|
+
|
25
|
+
In addition to these changes, a few new formats/engines have been
|
26
|
+
added, including Creole, Maruku, WikiCloth, CoffeeScript and
|
27
|
+
Nokogiri Builder.
|
28
|
+
|
29
|
+
Changes:
|
30
|
+
|
31
|
+
* Add Creole, Maruku and WikiCloth markup engine/formats.
|
32
|
+
* Add CoffeeScript transpiler engine/formats.
|
33
|
+
* Add Nokogiri Builder format.
|
34
|
+
* Support `scope and `locals` style data, as well as `data` option.
|
35
|
+
* Unified builder engines under one .rbml/.builder format.
|
36
|
+
* Use #content instead of #yield for block content!
|
37
|
+
* Add :multi option for multi-format rendering.
|
38
|
+
* Overhaul internal engine API, for better overall design.
|
39
|
+
* Formats delegate to master Malt.render method.
|
40
|
+
|
41
|
+
|
42
|
+
== 0.3.0 | 2010-11-04
|
43
|
+
|
44
|
+
New release adds a Malt::Machine class that encapsulates all
|
45
|
+
Malt's class level functionality. This allow Malt to be
|
46
|
+
be more finally controlled. For example an instance of
|
47
|
+
Malt::Machine can be used to limit rendering to a select
|
48
|
+
set of formats.
|
49
|
+
|
50
|
+
Changes:
|
51
|
+
|
52
|
+
* Add Machine class to encapsulate toplevel functions.
|
53
|
+
* Add feature via Machine options to select available formats.
|
54
|
+
* Add `#to_default` to for converting to default format.
|
55
|
+
* Add `Malt.engine?` to test for supported engine types.
|
56
|
+
* Rename `Malt.support?` to `Malt.format?`.
|
57
|
+
* Rename `Malt.main` to `Malt.cli`.
|
58
|
+
|
59
|
+
|
60
|
+
== 0.2.0 | 2010-10-22
|
61
|
+
|
62
|
+
Malt now support Erector, Markaby, Builder and Mustache templates.
|
63
|
+
Erector, Markaby and Builder are Ruby-based formats --templates
|
64
|
+
are simply Ruby code. This requires them to use instance variables
|
65
|
+
in templates rather than local variables/methods. Something to keep
|
66
|
+
in mind.
|
67
|
+
|
68
|
+
Changes:
|
69
|
+
|
70
|
+
* Add support for Erector templates.
|
71
|
+
* Add support for Markaby templates.
|
72
|
+
* Add support for Builder templates.
|
73
|
+
* Add support for Mustache templates.
|
74
|
+
* Add `:pass` option to render method.
|
75
|
+
* Rename `:format` option to `:to` for render method.
|
76
|
+
|
77
|
+
|
78
|
+
== 0.1.1 | 2010-09-21
|
79
|
+
|
80
|
+
This release simple fixes two bugs. One to handle variant arity
|
81
|
+
in format class #render methods. Currently the interface can vary
|
82
|
+
dependent on whether they accept interpolation data or not (this will
|
83
|
+
probably be uniform in the future). The other fix raises an error if
|
84
|
+
no engine exists to handle a given format.
|
85
|
+
|
86
|
+
Changes:
|
87
|
+
|
88
|
+
* Bug fix to raise error if format not handled by any engine.
|
89
|
+
* Bug fix to underlying #render calls to handle variant arities.
|
90
|
+
|
91
|
+
|
92
|
+
== 0.1.0 | 2010-08-23
|
93
|
+
|
94
|
+
This if the initial release of Malt. I have no doubt the code base
|
95
|
+
still needs some fine-tuning --hence the 0.1 version, but I have put
|
96
|
+
it to good use with the latest version of Brite, my static website
|
97
|
+
generator, so I know that it is at least is a working state.
|
98
|
+
|
99
|
+
Changes:
|
100
|
+
|
101
|
+
* Initial release.
|
102
|
+
|
data/README.rdoc
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
= Malt
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
{Homepage}[http://rubyworks.github.com/malt] |
|
4
|
+
{Development}[http://github.com/rubyworks/malt] |
|
5
|
+
{Mailing List}[http://groups.google.com/group/rubyworks-mailinglist]
|
6
|
+
|
7
|
+
{<img src="http://travis-ci.org/rubyworks/malt.png" />}[http://travis-ci.org/rubyworks/malt]
|
5
8
|
|
6
9
|
|
7
10
|
== DESCRIPTION
|
@@ -41,11 +44,13 @@ Notice the #to_s. This is needed because #to_html returns an
|
|
41
44
|
Malt::Format::HTML object.
|
42
45
|
|
43
46
|
|
44
|
-
==
|
45
|
-
|
46
|
-
Malt can also "multi-render".
|
47
|
+
== LIMITATIONS
|
47
48
|
|
48
|
-
|
49
|
+
*JRuby* and *Rubinus* users: Not all template systems work with your Ruby.
|
50
|
+
Consequently not all of Malt will work either. Thankfully Malt only
|
51
|
+
requires template engines as they are needed, so it will work fine
|
52
|
+
in most cases. But, you will need to avoid engines that depend on compiled
|
53
|
+
code, such as +less+ and +coffee-script+.
|
49
54
|
|
50
55
|
|
51
56
|
== INSTALATION
|
@@ -63,10 +68,11 @@ cd into it and run setup.rb, e.g.
|
|
63
68
|
$ sudo setup.rb
|
64
69
|
|
65
70
|
|
66
|
-
== COPYING
|
67
71
|
|
68
|
-
|
72
|
+
== COPYRIGHTS
|
73
|
+
|
74
|
+
Copyright (c) 2010 Rubyworks
|
69
75
|
|
70
|
-
This program is ditributed under the terms of the
|
76
|
+
This program is ditributed under the terms of the *BSD-2-Clause* license.
|
71
77
|
|
72
|
-
See the
|
78
|
+
See the COPYING.rdoc file for details.
|
data/Reapfile
ADDED
data/lib/malt.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require 'malt/
|
1
|
+
require 'malt/core_ext'
|
2
|
+
require 'malt/version'
|
2
3
|
require 'malt/kernel'
|
3
4
|
require 'malt/machine'
|
4
|
-
require 'malt/core_ext'
|
5
5
|
|
6
6
|
module Malt
|
7
|
-
|
8
7
|
class << self
|
9
8
|
include Malt::Kernel
|
10
9
|
end
|
@@ -14,32 +13,61 @@ module Malt
|
|
14
13
|
@machine ||= Machine.new
|
15
14
|
end
|
16
15
|
|
17
|
-
#
|
16
|
+
# Render a file.
|
18
17
|
def self.file(file, options={})
|
19
18
|
machine.file(file, options)
|
20
19
|
end
|
21
20
|
|
22
|
-
#
|
21
|
+
# Render text string.
|
23
22
|
def self.text(text, options={})
|
24
23
|
machine.text(text, options)
|
25
24
|
end
|
26
25
|
|
27
|
-
#
|
26
|
+
# Render a URL.
|
28
27
|
def self.open(url, options={})
|
29
28
|
machine.open(url, options)
|
30
29
|
end
|
31
30
|
|
31
|
+
# Render a document.
|
32
|
+
#
|
33
|
+
# param [Hash] params
|
34
|
+
# Rendering parameters.
|
35
|
+
#
|
36
|
+
# option params [Symbol] :to
|
37
|
+
# The format to which the file/text is to be rendered.
|
38
|
+
#
|
39
|
+
# option params [String] :file
|
40
|
+
# The file to be rendered. If `:text` is not given, this file must exist on disk
|
41
|
+
# so it can be read-in to fill in the `:text` option. If text is given, the file
|
42
|
+
# is only used to help determine type and clarify error messages.
|
43
|
+
#
|
44
|
+
# option params [String] :text
|
45
|
+
# The text to render. This option is required unless `:file` is given.
|
46
|
+
#
|
47
|
+
# option params [Symbol] :type
|
48
|
+
# The format of the text. This will be determined automatically by the `:file`
|
49
|
+
# option if it is given and has a recognized extension. Otherwise it needs
|
50
|
+
# be explicitly provided.
|
51
|
+
#
|
52
|
+
# option params [Hash,Object,Binding,Array] :data
|
53
|
+
# The data source used for evaluation. This can be a locals hash, a scope
|
54
|
+
# object or binding, or an array of a scope object/binding and locals hash.
|
55
|
+
# This option is split-up into :scope and :locals before passing on to
|
56
|
+
# the redering engine.
|
57
|
+
#
|
58
|
+
# option params [Boolean] :pass
|
59
|
+
# If not a supported type return text rather than raise an error.
|
32
60
|
#
|
33
61
|
def self.render(params, &body)
|
34
62
|
machine.render(params, &body)
|
35
63
|
end
|
36
64
|
|
37
|
-
#
|
65
|
+
# Returns `true` if the extension given is a recognized format.
|
38
66
|
def self.format?(ext)
|
39
67
|
machine.format?(ext)
|
40
68
|
end
|
41
69
|
|
42
|
-
# Returns true if the extension given is renderable.
|
70
|
+
# Returns `true` if the extension given is renderable.
|
43
71
|
def self.engine?(ext)
|
44
72
|
machine.engine?(ext)
|
45
73
|
end
|