class SiSU_HarvestTopics::Songsheet
Public Class Methods
new(opt,env)
click to toggle source
# File lib/sisu/html_harvest_topics.rb, line 61 def initialize(opt,env) @opt,@env=opt,env @file_list=opt.files end
Public Instance Methods
songsheet()
click to toggle source
# File lib/sisu/html_harvest_topics.rb, line 65 def songsheet idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} name=y[:f] filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|classify):(?:\s|$)/m lang_hash_file_array[y[:lng_is]] ||= [] lang_hash_file_array[y[:lng_is]] << line elsif line =~/^@\S+?:(?:\s|$)/m \ or line =~/^(?:\s*\n|\s*$|%+ )/ else break end end end lang_hash_file_array.each_pair do |lang,a| idx_array[lang] ||=[] idx_array=SiSU_HarvestTopics::Harvest.new( @opt, @env, a, filename, name, idx_array, lang ).extract_harvest end end the_hash=SiSU_HarvestTopics::Index.new( @opt, @env, idx_array, @@the_idx_topics ).song SiSU_HarvestTopics::OutputIndex.new( @opt, the_hash ).html_print.html_songsheet end