1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

fix rake task for ruby 1.8

This commit is contained in:
Konstantin Haase 2013-02-26 22:39:24 +11:00
parent 14ee09549e
commit 2a3ee2dc88

View file

@ -135,8 +135,9 @@ task :toc, [:readme] do |t, a|
end
puts "* [Sinatra](#sinatra)"
title = Regexp.new('(?<=\* )(.*)') # so Ruby 1.8 doesn't complain
File.binread(a.readme).scan(/^##.*/) do |line|
puts line.gsub(/#(?=#)/, ' ').gsub('#', '*').gsub(/(?<=\* )(.*)/) { "[#{$1}](##{link($1)})" }
puts line.gsub(/#(?=#)/, ' ').gsub('#', '*').gsub(title) { "[#{$1}](##{link($1)})" }
end
end