Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 20 lines (19 sloc) 488 Bytes
#!/usr/bin/env ruby
here = File.expand_path File.dirname __FILE__
$:<<here
require 'lib/media_wiki'
include MediaWiki
ARGV.each do |arg|
old_path = arg
new_path = arg.gsub(/\.mw$/, '.step')
old = File.read(old_path)
puts new_path
File.open(new_path, "w") do |f|
f.puts "div do"
f.puts "message <<-MARKDOWN"
f.write mw2md(old).
gsub(/^# (.*)$/, " MARKDOWN\n end\n\nstep \"\\1\" do\n message <<-MARKDOWN\n")
f.puts " MARKDOWN"
f.puts "end"
end
end