Skip to content

Commit

Permalink
Handle spaces and quotes in the filename
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarburger committed Jun 3, 2011
1 parent 43de962 commit e380318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugin/hammer.vim/hammer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ REQUIRE_GHMARKUP
buffer = Vim::Buffer.current.extend Vim::ImprovedBuffer

if GitHub::Markup.can_render? buffer.basename
File.open File.join(Hammer::ENV.directory, "#{buffer.basename}.html"), 'w' do |f|
output_path = File.join Hammer::ENV.directory, "#{buffer.basename}.html"

File.open output_path, 'w' do |f|
f.write Hammer.render { GitHub::Markup.render(buffer.basename, buffer[1..-1]) }
end

Vim.command "silent ! #{Hammer::ENV.browser} #{File.join Hammer::ENV.directory, buffer.basename}.html"
Vim.command "silent ! #{Hammer::ENV.browser} #{output_path.inspect}"
Vim.command "redraw!"
elsif buffer.extname =~ /^\.(xhtml|html)$/
Vim.command "silent ! #{Hammer::ENV.browser} #{buffer.name}"
Expand Down

0 comments on commit e380318

Please sign in to comment.