lib/whimsy/asf/agenda.rb in whimsy-asf-0.0.9 vs lib/whimsy/asf/agenda.rb in whimsy-asf-0.0.10

- old
+ new

@@ -21,13 +21,13 @@ '8.' => 'Discussion Items', '9.' => 'Action Items' } @@parsers = [] - def self.parse(file=nil, &block) + def self.parse(file=nil, quick=false, &block) @@parsers << block if block - new.parse(file) if file + new.parse(file, quick) if file end def initialize @sections = {} end @@ -48,12 +48,13 @@ @sections[section].merge!(hash) end end end - def parse(file) + def parse(file, quick=false) @file = file + @quick = quick if not @file.valid_encoding? filter = Proc.new {|c| c.unpack('U').first rescue 0xFFFD} @file = @file.chars.map(&filter).pack('U*').force_encoding('utf-8') end @@ -82,19 +83,21 @@ unindent = text.sub(/s+\Z/,'').scan(/^ *\S/).map(&:length).min || 1 text.gsub! /^ {#{unindent-1}}/, '' end end - # add roster and prior report link - whimsy = 'https://whimsy.apache.org' - @sections.each do |section, hash| - next unless section =~ /^(4[A-Z]|\d+|[A-Z][A-Z]?)$/ - committee = ASF::Committee.find(hash['title'] ||= 'UNKNOWN') - unless section =~ /^4[A-Z]$/ - hash['roster'] = - "#{whimsy}/roster/committee/#{CGI.escape committee.name}" + unless @quick + # add roster and prior report link + whimsy = 'https://whimsy.apache.org' + @sections.each do |section, hash| + next unless section =~ /^(4[A-Z]|\d+|[A-Z][A-Z]?)$/ + committee = ASF::Committee.find(hash['title'] ||= 'UNKNOWN') + unless section =~ /^4[A-Z]$/ + hash['roster'] = + "#{whimsy}/roster/committee/#{CGI.escape committee.name}" + end + hash['prior_reports'] = minutes(committee.display_name) end - hash['prior_reports'] = minutes(committee.display_name) end # add attach to section @sections.each do |section, hash| hash[:attach] = section