1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Added a utility for outputting the results of the Haml engine to a file.

git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@134 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2006-11-08 16:57:33 +00:00
parent 2760695088
commit 0b5c3e3351

18
bin/haml Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# The command line Haml parser.
if ARGV[0] == "--help" or ARGV[0] == "-h" or ARGV[0] == "-?"
puts <<END
Usage: haml (template file) (output file)
Description:
Uses the Haml engine to parse the specified template
and outputs the result to the specified file.
END
else
require File.join(File.dirname(__FILE__), '..', 'lib', 'haml', 'engine')
template = File.read(ARGV[0])
result = Haml::Engine.new(template).to_html
File.open(ARGV[1], "w") { |f| f.write(result) }
end