Skip to content

Commit

Permalink
Added a utility for outputting the results of the Haml engine to a file.
Browse files Browse the repository at this point in the history
git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@134 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information
nex3 committed Nov 8, 2006
1 parent 2760695 commit 0b5c3e3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bin/haml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0b5c3e3

Please sign in to comment.