haml 1.0.5 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/README +229 -0
- data/Rakefile +56 -60
- data/VERSION +1 -1
- data/bin/haml +4 -14
- data/bin/html2haml +89 -0
- data/bin/sass +8 -0
- data/init.rb +5 -1
- data/lib/haml.rb +643 -0
- data/lib/haml/buffer.rb +33 -30
- data/lib/haml/engine.rb +258 -75
- data/lib/haml/error.rb +43 -0
- data/lib/haml/exec.rb +181 -0
- data/lib/haml/filters.rb +89 -0
- data/lib/haml/helpers.rb +19 -5
- data/lib/haml/helpers/action_view_mods.rb +28 -4
- data/lib/haml/template.rb +13 -27
- data/lib/sass.rb +418 -0
- data/lib/sass/constant.rb +190 -0
- data/lib/sass/constant/color.rb +77 -0
- data/lib/sass/constant/literal.rb +51 -0
- data/lib/sass/constant/number.rb +87 -0
- data/lib/sass/constant/operation.rb +30 -0
- data/lib/sass/constant/string.rb +18 -0
- data/lib/sass/engine.rb +179 -0
- data/lib/sass/error.rb +35 -0
- data/lib/sass/plugin.rb +119 -0
- data/lib/sass/tree/attr_node.rb +44 -0
- data/lib/sass/tree/node.rb +29 -0
- data/lib/sass/tree/rule_node.rb +47 -0
- data/lib/sass/tree/value_node.rb +12 -0
- data/test/benchmark.rb +16 -19
- data/test/haml/engine_test.rb +220 -0
- data/test/{helper_test.rb → haml/helper_test.rb} +9 -8
- data/test/{mocks → haml/mocks}/article.rb +0 -0
- data/test/{results → haml/results}/content_for_layout.xhtml +0 -0
- data/test/{results → haml/results}/eval_suppressed.xhtml +0 -0
- data/test/haml/results/filters.xhtml +57 -0
- data/test/{results → haml/results}/helpers.xhtml +10 -0
- data/test/haml/results/helpful.xhtml +8 -0
- data/test/{results → haml/results}/just_stuff.xhtml +5 -0
- data/test/{results → haml/results}/list.xhtml +0 -0
- data/test/{results → haml/results}/original_engine.xhtml +1 -1
- data/test/{results → haml/results}/partials.xhtml +0 -0
- data/test/{results → haml/results}/silent_script.xhtml +0 -0
- data/test/{results → haml/results}/standard.xhtml +2 -1
- data/test/{results → haml/results}/tag_parsing.xhtml +0 -0
- data/test/{results → haml/results}/very_basic.xhtml +0 -0
- data/test/haml/results/whitespace_handling.xhtml +104 -0
- data/test/{rhtml → haml/rhtml}/standard.rhtml +4 -1
- data/test/{runner.rb → haml/runner.rb} +1 -1
- data/test/{template_test.rb → haml/template_test.rb} +28 -23
- data/test/{templates → haml/templates}/_partial.haml +0 -0
- data/test/{templates → haml/templates}/_text_area.haml +0 -0
- data/test/haml/templates/breakage.haml +8 -0
- data/test/{templates → haml/templates}/content_for_layout.haml +0 -0
- data/test/{templates → haml/templates}/eval_suppressed.haml +0 -0
- data/test/haml/templates/filters.haml +53 -0
- data/test/{templates → haml/templates}/helpers.haml +10 -1
- data/test/{templates → haml/templates}/helpful.haml +3 -0
- data/test/{templates → haml/templates}/just_stuff.haml +7 -0
- data/test/{templates → haml/templates}/list.haml +0 -0
- data/test/haml/templates/original_engine.haml +17 -0
- data/test/{templates → haml/templates}/partialize.haml +0 -0
- data/test/{templates → haml/templates}/partials.haml +0 -0
- data/test/{templates → haml/templates}/silent_script.haml +0 -0
- data/test/{templates → haml/templates}/standard.haml +3 -1
- data/test/{templates → haml/templates}/tag_parsing.haml +0 -0
- data/test/{templates → haml/templates}/very_basic.haml +0 -0
- data/test/haml/templates/whitespace_handling.haml +137 -0
- data/test/profile.rb +36 -18
- data/test/sass/engine_test.rb +87 -0
- data/test/sass/plugin_test.rb +103 -0
- data/test/sass/results/basic.css +9 -0
- data/test/sass/results/compact.css +5 -0
- data/test/sass/results/complex.css +86 -0
- data/test/sass/results/constants.css +12 -0
- data/test/sass/results/expanded.css +18 -0
- data/test/sass/results/nested.css +14 -0
- data/test/sass/templates/basic.sass +23 -0
- data/test/sass/templates/bork.sass +2 -0
- data/test/sass/templates/compact.sass +15 -0
- data/test/sass/templates/complex.sass +291 -0
- data/test/sass/templates/constants.sass +80 -0
- data/test/sass/templates/expanded.sass +15 -0
- data/test/sass/templates/nested.sass +15 -0
- metadata +98 -48
- data/REFERENCE +0 -662
- data/test/engine_test.rb +0 -93
- data/test/results/helpful.xhtml +0 -5
- data/test/results/whitespace_handling.xhtml +0 -51
- data/test/templates/original_engine.haml +0 -17
- data/test/templates/whitespace_handling.haml +0 -66
data/README
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
= Haml and Sass
|
2
|
+
|
3
|
+
Haml and Sass are templating engines
|
4
|
+
for the two most common types of documents on the web:
|
5
|
+
HTML and CSS, respectively.
|
6
|
+
They are designed to make it both easier and more pleasant
|
7
|
+
to code HTML and CSS documents,
|
8
|
+
by eliminating redundancy,
|
9
|
+
reflecting the underlying structure that the document represents,
|
10
|
+
and providing elegant, easily understandable, and powerful syntax.
|
11
|
+
|
12
|
+
== Using
|
13
|
+
|
14
|
+
There are two ways to use Haml and Sass.
|
15
|
+
The easiest is as a Rails plugin:
|
16
|
+
Simply type <tt>./script/plugin install http://hamptoncatlin.com/haml/stable</tt>
|
17
|
+
and both Haml and Sass will be installed.
|
18
|
+
Views with the <tt>.haml</tt> extension will automatically use Haml.
|
19
|
+
Sass is a little more complicated;
|
20
|
+
<tt>.sass</tt> files should be placed in public/stylesheets/sass,
|
21
|
+
where they'll be automatically compiled
|
22
|
+
to corresponding CSS files in public/stylesheets when needed
|
23
|
+
(the Sass template directory is customizable...
|
24
|
+
see the Sass module docs for details).
|
25
|
+
|
26
|
+
== Formatting
|
27
|
+
|
28
|
+
=== Haml
|
29
|
+
|
30
|
+
The most basic element of Haml
|
31
|
+
is a shorthand for creating HTML tags:
|
32
|
+
|
33
|
+
%tagname{ :attr1 => 'value1', :attr2 => 'value2' } Contents
|
34
|
+
|
35
|
+
No end-tag is needed; Haml handles that automatically.
|
36
|
+
Adding <tt>class</tt> and <tt>id</tt> attributes is even easier.
|
37
|
+
Haml uses the same syntax as the CSS that styles the document:
|
38
|
+
|
39
|
+
%tagname#id.class
|
40
|
+
|
41
|
+
In fact, when you're using the <tt><div></tt> tag,
|
42
|
+
it becomes <em>even easier</em>.
|
43
|
+
Because <tt><div></tt> is such a common element,
|
44
|
+
a tag without a name defaults to a div. So
|
45
|
+
|
46
|
+
#foo Hello!
|
47
|
+
|
48
|
+
becomes
|
49
|
+
|
50
|
+
<div id='foo'>Hello!</foo>
|
51
|
+
|
52
|
+
Haml uses indentation
|
53
|
+
to bring the individual elements to represent the HTML structure.
|
54
|
+
A tag's children are indented two spaces more than the parent tag.
|
55
|
+
Again, a closing tag is automatically added.
|
56
|
+
For example:
|
57
|
+
|
58
|
+
%ul
|
59
|
+
%li Salt
|
60
|
+
%li Pepper
|
61
|
+
|
62
|
+
becomes:
|
63
|
+
|
64
|
+
<ul>
|
65
|
+
<li>Salt</li>
|
66
|
+
<li>Pepper</li>
|
67
|
+
</ul>
|
68
|
+
|
69
|
+
You can also put plain text as a child of an element:
|
70
|
+
|
71
|
+
%p
|
72
|
+
Hello,
|
73
|
+
World!
|
74
|
+
|
75
|
+
It's even possible to embed Ruby code into Haml documents.
|
76
|
+
An equals sign, <tt>=</tt>, will output the result of the code.
|
77
|
+
A hyphen, <tt>-</tt>, will run the code but not output the result.
|
78
|
+
You can even use control statements
|
79
|
+
like <tt>if</tt> and <tt>while</tt>:
|
80
|
+
|
81
|
+
%p
|
82
|
+
Date/Time:
|
83
|
+
- now = DateTime.now
|
84
|
+
%strong= now
|
85
|
+
- if now > DateTime.parse("December 31, 2006")
|
86
|
+
= "Happy new " + "year!"
|
87
|
+
|
88
|
+
Haml provides far more tools than those presented here.
|
89
|
+
Check out the reference documentation in the Haml module.
|
90
|
+
|
91
|
+
=== Sass
|
92
|
+
|
93
|
+
At its most basic,
|
94
|
+
Sass is just another way of writing CSS.
|
95
|
+
Although it's very much like normal CSS,
|
96
|
+
the basic syntax offers a few helpful features:
|
97
|
+
tabulation (using *two spaces*)
|
98
|
+
indicates the attributes in a rule,
|
99
|
+
rather than non-DRY brackets;
|
100
|
+
and newlines indicate the end of an attribute,
|
101
|
+
rather than a semicolon.
|
102
|
+
For example:
|
103
|
+
|
104
|
+
#main
|
105
|
+
:background-color #f00
|
106
|
+
:width 98%
|
107
|
+
|
108
|
+
becomes:
|
109
|
+
|
110
|
+
#main {
|
111
|
+
background-color: #f00;
|
112
|
+
width: 98% }
|
113
|
+
|
114
|
+
However, Sass provides much more than a way to make CSS look nice.
|
115
|
+
In CSS, it's important to have accurate selectors,
|
116
|
+
so your styles don't just apply to everything.
|
117
|
+
However, in order to do this,
|
118
|
+
you need to use nested element selectors.
|
119
|
+
These get very ugly very quickly.
|
120
|
+
I'm sure everyone's had to write something like
|
121
|
+
"#main .sidebar .top p h1 a",
|
122
|
+
followed by
|
123
|
+
"#main .sidebar .top p h1 a:visited" and
|
124
|
+
"#main .sidebar .top p h1 a:hover".
|
125
|
+
Well, Sass gets rid of that.
|
126
|
+
Like Haml, it uses indentation to indicate the structure of the document.
|
127
|
+
So, what was:
|
128
|
+
|
129
|
+
#main {
|
130
|
+
width: 90%;
|
131
|
+
}
|
132
|
+
#main p {
|
133
|
+
border-style: solid;
|
134
|
+
border-width: 1px;
|
135
|
+
border-color: #00f;
|
136
|
+
}
|
137
|
+
#main p a {
|
138
|
+
text-decoration: none;
|
139
|
+
font-weight: bold;
|
140
|
+
}
|
141
|
+
#main p a:hover {
|
142
|
+
text-decoration: underline;
|
143
|
+
}
|
144
|
+
|
145
|
+
becomes:
|
146
|
+
|
147
|
+
#main
|
148
|
+
:width 90%
|
149
|
+
p
|
150
|
+
:border-style solid
|
151
|
+
:border-width 1px
|
152
|
+
:border-color #00f
|
153
|
+
a
|
154
|
+
:text-decoration none
|
155
|
+
:font-weight bold
|
156
|
+
a:hover
|
157
|
+
:text-decoration underline
|
158
|
+
|
159
|
+
Pretty nice, no? Well, it gets better.
|
160
|
+
One of the main complaints against CSS is that it doesn't allow constants.
|
161
|
+
What if have a color or a width you re-use all the time?
|
162
|
+
In CSS, you just have to re-type it each time,
|
163
|
+
which is a nightmare when you decide to change it later.
|
164
|
+
Not so for Sass!
|
165
|
+
You can use the "!" character to set constants.
|
166
|
+
Then, if you put "=" after your attribute name,
|
167
|
+
you can set it to a constant.
|
168
|
+
For example:
|
169
|
+
|
170
|
+
!note_bg= #55aaff
|
171
|
+
|
172
|
+
#main
|
173
|
+
:width 70%
|
174
|
+
.note
|
175
|
+
:background-color= !note_bg
|
176
|
+
p
|
177
|
+
:width 5em
|
178
|
+
:background-color= !note_bg
|
179
|
+
|
180
|
+
becomes:
|
181
|
+
|
182
|
+
#main {
|
183
|
+
width: 70%; }
|
184
|
+
#main .note {
|
185
|
+
background-color: #55aaff; }
|
186
|
+
#main p {
|
187
|
+
width: 5em;
|
188
|
+
background-color: #55aaff; }
|
189
|
+
|
190
|
+
You can even do simple arithmetic operations with constants,
|
191
|
+
adding numbers and even colors together:
|
192
|
+
|
193
|
+
!main_bg= #46ar12
|
194
|
+
!main_width= 40em
|
195
|
+
|
196
|
+
#main
|
197
|
+
:background-color= !main_bg
|
198
|
+
:width= !main_width
|
199
|
+
.sidebar
|
200
|
+
:background-color= !main_bg + #333333
|
201
|
+
:width= !main_width - 25em
|
202
|
+
|
203
|
+
becomes:
|
204
|
+
|
205
|
+
#main {
|
206
|
+
background-color: #46a312;
|
207
|
+
width: 40em; }
|
208
|
+
#main .sidebar {
|
209
|
+
background-color: #79d645;
|
210
|
+
width: 15em; }
|
211
|
+
|
212
|
+
A comprehensive list of features is in
|
213
|
+
the documentation for the Sass module.
|
214
|
+
|
215
|
+
== Authors
|
216
|
+
|
217
|
+
Haml and Sass are designed by Hampton Catlin (hcatlin).
|
218
|
+
Help with the Ruby On Rails implementation and much of the documentation
|
219
|
+
by Jeff Hardy (packagethief).
|
220
|
+
|
221
|
+
Nathan Weizenbaum (Nex3) contributed the buffered-engine code to Haml,
|
222
|
+
along with many other enhancements
|
223
|
+
(including the silent-line syntax: "-").
|
224
|
+
He continues to actively work on both Haml and Sass.
|
225
|
+
|
226
|
+
If you use this software, you must pay Hampton a compliment.
|
227
|
+
Say something nice about it.
|
228
|
+
Beyond that, the implementation is licensed under the MIT License.
|
229
|
+
Ok, fine, I guess that means compliments aren't *required*.
|
data/Rakefile
CHANGED
@@ -11,21 +11,34 @@ volatile_requires.each do |file|
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
# ----- Benchmarking -----
|
15
|
+
|
16
|
+
temp_desc = <<END
|
17
|
+
Benchmark haml against ERb.
|
18
|
+
TIMES=n sets the number of runs. Defaults to 100.
|
19
|
+
END
|
20
|
+
|
21
|
+
desc temp_desc.chomp
|
22
|
+
task :benchmark do
|
23
|
+
require 'test/benchmark'
|
24
|
+
|
25
|
+
puts '-'*51, "Benchmark: Haml vs. ERb", '-'*51
|
26
|
+
puts "Running benchmark #{ENV['TIMES']} times..." if ENV['TIMES']
|
27
|
+
times = ENV['TIMES'].to_i if ENV['TIMES']
|
28
|
+
benchmarker = Haml::Benchmarker.new
|
29
|
+
puts benchmarker.benchmark(times || 100)
|
30
|
+
puts '-'*51
|
21
31
|
end
|
22
32
|
|
23
|
-
#
|
33
|
+
# Benchmarking gets screwed up if some other tasks have been
|
34
|
+
# initialized.
|
35
|
+
unless ARGV[0] == 'benchmark'
|
36
|
+
|
37
|
+
# ----- Default: Testing ------
|
24
38
|
|
25
|
-
desc 'Default: run unit tests.'
|
26
|
-
task :default => :test
|
39
|
+
desc 'Default: run unit tests.'
|
40
|
+
task :default => :test
|
27
41
|
|
28
|
-
if is_task?('test', 'default')
|
29
42
|
require 'rake/testtask'
|
30
43
|
|
31
44
|
desc 'Test the Haml plugin'
|
@@ -34,16 +47,14 @@ if is_task?('test', 'default')
|
|
34
47
|
t.pattern = 'test/**/*_test.rb'
|
35
48
|
t.verbose = true
|
36
49
|
end
|
37
|
-
end
|
38
50
|
|
39
|
-
# ----- Packaging -----
|
51
|
+
# ----- Packaging -----
|
40
52
|
|
41
|
-
if is_task?('package', 'repackage', 'clobber_package')
|
42
53
|
require 'rake/gempackagetask'
|
43
|
-
|
54
|
+
|
44
55
|
spec = Gem::Specification.new do |spec|
|
45
56
|
spec.name = 'haml'
|
46
|
-
spec.summary =
|
57
|
+
spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
|
47
58
|
spec.version = File.read('VERSION').strip
|
48
59
|
spec.author = 'Hampton Catlin'
|
49
60
|
spec.email = 'haml@googlegroups.com'
|
@@ -57,61 +68,42 @@ if is_task?('package', 'repackage', 'clobber_package')
|
|
57
68
|
but it can function as a stand-alone templating engine.
|
58
69
|
END
|
59
70
|
|
60
|
-
readmes = FileList.new('*')
|
61
|
-
|
71
|
+
readmes = FileList.new('*') do |list|
|
72
|
+
list.exclude(/[a-z]/)
|
73
|
+
list.exclude('TODO')
|
74
|
+
end.to_a
|
75
|
+
spec.executables = ['haml', 'html2haml', 'sass']
|
62
76
|
spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes
|
63
77
|
spec.homepage = 'http://haml.hamptoncatlin.com/'
|
64
78
|
spec.has_rdoc = true
|
65
79
|
spec.extra_rdoc_files = readmes
|
66
80
|
spec.rdoc_options += [
|
67
81
|
'--title', 'Haml',
|
68
|
-
'--main', '
|
82
|
+
'--main', 'README',
|
69
83
|
'--exclude', 'lib/haml/buffer.rb',
|
70
84
|
'--line-numbers',
|
71
85
|
'--inline-source'
|
72
86
|
]
|
73
87
|
spec.test_files = FileList['test/**/*_test.rb'].to_a
|
74
88
|
end
|
75
|
-
|
89
|
+
|
76
90
|
Rake::GemPackageTask.new(spec) do |pkg|
|
77
91
|
pkg.need_zip = true
|
78
92
|
pkg.need_tar_gz = true
|
79
93
|
pkg.need_tar_bz2 = true
|
80
94
|
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# ----- Benchmarking -----
|
84
|
-
|
85
|
-
if is_task?('benchmark')
|
86
|
-
temp_desc = <<END
|
87
|
-
Benchmark HAML against ERb.
|
88
|
-
TIMES=n sets the number of runs. Defaults to 100.
|
89
|
-
END
|
90
|
-
|
91
|
-
desc temp_desc.chomp
|
92
|
-
task :benchmark do
|
93
|
-
require 'test/benchmark'
|
94
|
-
|
95
|
-
puts '-'*51, "Benchmark: Haml vs. ERb", '-'*51
|
96
|
-
puts "Running benchmark #{ENV['TIMES']} times..." if ENV['TIMES']
|
97
|
-
times = ENV['TIMES'].to_i if ENV['TIMES']
|
98
|
-
benchmarker = Haml::Benchmarker.new
|
99
|
-
puts benchmarker.benchmark(times || 100)
|
100
|
-
puts '-'*51
|
101
|
-
end
|
102
|
-
end
|
103
95
|
|
104
|
-
# ----- Documentation -----
|
96
|
+
# ----- Documentation -----
|
105
97
|
|
106
|
-
if is_task?('rdoc', 'rerdoc', 'clobber_rdoc', 'rdoc_devel', 'rerdoc_devel', 'clobber_rdoc_devel')
|
107
98
|
require 'rake/rdoctask'
|
108
|
-
|
99
|
+
|
109
100
|
rdoc_task = Proc.new do |rdoc|
|
110
|
-
rdoc.title = 'Haml'
|
101
|
+
rdoc.title = 'Haml/Sass'
|
111
102
|
rdoc.options << '--line-numbers' << '--inline-source'
|
112
|
-
rdoc.rdoc_files.include('
|
103
|
+
rdoc.rdoc_files.include('README')
|
113
104
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
114
105
|
rdoc.rdoc_files.exclude('lib/haml/buffer.rb')
|
106
|
+
rdoc.rdoc_files.exclude('lib/sass/tree/*')
|
115
107
|
end
|
116
108
|
|
117
109
|
Rake::RDocTask.new do |rdoc|
|
@@ -124,48 +116,52 @@ if is_task?('rdoc', 'rerdoc', 'clobber_rdoc', 'rdoc_devel', 'rerdoc_devel', 'clo
|
|
124
116
|
rdoc.rdoc_dir = 'rdoc_devel'
|
125
117
|
rdoc.options << '--all'
|
126
118
|
rdoc.rdoc_files.include('test/*.rb')
|
119
|
+
|
120
|
+
# Get rid of exclusion rules
|
127
121
|
rdoc.rdoc_files = Rake::FileList.new(*rdoc.rdoc_files.to_a)
|
128
122
|
rdoc.rdoc_files.include('lib/haml/buffer.rb')
|
123
|
+
rdoc.rdoc_files.include('lib/sass/tree/*')
|
129
124
|
end
|
130
|
-
end
|
131
125
|
|
132
|
-
# ----- Coverage -----
|
126
|
+
# ----- Coverage -----
|
133
127
|
|
134
|
-
if is_task?('rcov', 'clobber_rcov')
|
135
128
|
unless not_loaded.include? 'rcov/rcovtask'
|
136
129
|
Rcov::RcovTask.new do |t|
|
137
130
|
t.libs << "test"
|
138
131
|
t.test_files = FileList['test/**/*_test.rb']
|
132
|
+
t.rcov_opts << '-x' << '"^\/"'
|
139
133
|
if ENV['NON_NATIVE']
|
140
134
|
t.rcov_opts << "--no-rcovrt"
|
141
135
|
end
|
142
136
|
t.verbose = true
|
143
137
|
end
|
144
138
|
end
|
145
|
-
end
|
146
139
|
|
147
|
-
# ----- Profiling -----
|
140
|
+
# ----- Profiling -----
|
148
141
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
END
|
142
|
+
temp_desc = <<-END
|
143
|
+
Run a profile of haml.
|
144
|
+
ENGINE=str sets the engine to be profiled (Haml or Sass).
|
145
|
+
TIMES=n sets the number of runs. Defaults to 100.
|
146
|
+
FILE=n sets the file to profile. Defaults to 'standard'.
|
147
|
+
END
|
155
148
|
desc temp_desc.chomp
|
156
149
|
task :profile do
|
157
150
|
require 'test/profile'
|
151
|
+
|
152
|
+
engine = ENV['ENGINE'] && ENV['ENGINE'].downcase == 'sass' ? Sass : Haml
|
158
153
|
|
159
|
-
puts '-'*51, "Profiling
|
154
|
+
puts '-'*51, "Profiling #{engine}", '-'*51
|
160
155
|
|
161
156
|
args = []
|
162
157
|
args.push ENV['TIMES'].to_i if ENV['TIMES']
|
163
158
|
args.push ENV['FILE'] if ENV['FILE']
|
164
159
|
|
165
|
-
profiler =
|
160
|
+
profiler = engine::Profiler.new
|
166
161
|
res = profiler.profile(*args)
|
167
162
|
puts res
|
168
163
|
|
169
164
|
puts '-'*51
|
170
165
|
end
|
166
|
+
|
171
167
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.5.0
|
data/bin/haml
CHANGED
@@ -1,18 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# The command line Haml parser.
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Usage: haml (template file) (output file)
|
4
|
+
require File.dirname(__FILE__) + '/../lib/haml'
|
5
|
+
require 'haml/exec'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
and outputs the result to the specified file.
|
11
|
-
END
|
12
|
-
else
|
13
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'haml', 'engine')
|
14
|
-
|
15
|
-
template = File.read(ARGV[0])
|
16
|
-
result = Haml::Engine.new(template).to_html
|
17
|
-
File.open(ARGV[1], "w") { |f| f.write(result) }
|
18
|
-
end
|
7
|
+
opts = Haml::Exec::Haml.new(ARGV)
|
8
|
+
opts.parse!
|