diff --git a/Rakefile b/Rakefile index 8cbe0e6..9f3161b 100644 --- a/Rakefile +++ b/Rakefile @@ -30,12 +30,12 @@ directory 'docs/' desc 'Build docs and open in browser for the reading' task :read => :docs do - sh 'open docs/rocco.html' + sh 'open docs/lib/rocco.html' end # Make index.html a copy of rocco.html -file 'docs/index.html' => 'docs/rocco.html' do |f| - cp 'docs/rocco.html', 'docs/index.html', :preserve => true +file 'docs/index.html' => 'docs/lib/rocco.html' do |f| + cp 'docs/lib/rocco.html', 'docs/index.html', :preserve => true end task :docs => 'docs/index.html' CLEAN.include 'docs/index.html' diff --git a/lib/rocco.rb b/lib/rocco.rb index f27e7bc..a480366 100644 --- a/lib/rocco.rb +++ b/lib/rocco.rb @@ -310,7 +310,7 @@ class Rocco # `def func():\n print "omg!"` def normalize_leading_spaces( sections ) sections.map do |section| - if section[ 0 ] + if section.any? && section[0].any? leading_space = section[0][0].match( "^\s+" ) if leading_space section[0] = section[0].map{ |line| line.sub( /^#{leading_space.to_s}/, '' ) }