5 def initialize(lyrics, options = {})
6 @options = DEFAULT_OPTIONS.merge(options)
11 @parsed_lyrics ||= parse!
18 parsed[:slides] = @lyrics.strip.gsub("\r\n", "\n").split(/\n[ \t]*\n/)
19 parsed[:slides].collect! { |s| s.strip }
20 parsed[:slides].reject! { |s| s.empty? }
22 parsed[:slides].each_with_index do |s,idx|
23 [:chorus, :bridge].each do |sub|
24 if s =~ Regexp.new("^\\[#{sub}\\]") and !parsed.has_key?(sub)
25 parsed[sub] = s.split("\n")[1..-1].join("\n")
26 parsed[:slides][idx] = parsed[sub]
29 parsed[:slides][idx].gsub!("[#{sub}]", parsed[sub]) if parsed[sub]