From f31e286f4a73c5c0f355512b0cb45c6c82088516 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 22 Jun 2013 01:13:46 -0400 Subject: v5: general code cleaning * propagate back to v4 after testing --- lib/sisu/v5/harvest_authors.rb | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'lib/sisu/v5/harvest_authors.rb') diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index 89a64fee..c20558df 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -155,9 +155,9 @@ module SiSU_HarvestAuthors end def construct_book_author_index idx_array=@idx_array - idx_array.each_pair do |lang,idx_array| + idx_array.each_pair do |lang,idx_arr| @@the_idx_authors[lang] ||= {} - idx_array.each do |idx| + idx_arr.each do |idx| idx[:author][:last_first_format_a].each do |author| author=author.strip if @@the_idx_authors[lang][author].is_a?(NilClass) @@ -237,18 +237,18 @@ module SiSU_HarvestAuthors end ln=SiSU_i18n::Languages.new.language.list harvest_languages='' - @the_idx.keys.each do |lng| + @the_idx.keys.each do |lg| if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lng}/manifest" + harvest_pth="../../#{lg}/manifest" file="#{harvest_pth}/authors.html" elsif @env.output_dir_structure.by? == :filetype harvest_pth='.' - file="#{harvest_pth}/authors.#{lng}.html" + file="#{harvest_pth}/authors.#{lg}.html" elsif @env.output_dir_structure.by? == :filename harvest_pth='.' - file="#{harvest_pth}/authors.#{lng}.html" + file="#{harvest_pth}/authors.#{lg}.html" end - l=ln[lng][:t] + l=ln[lg][:t] harvest_languages += %{#{l}   } end sv=SiSU_Env::InfoVersion.instance.get_version @@ -365,25 +365,23 @@ WOK end @output[lng][:html] << x works=[] - a[1][:md].each do |x| + a[1][:md].each do |i| manifest_at=if @env.output_dir_structure.by? == :language - manifest_pth="#{@env.path.output}/#{x[:file]}" - x[:file] + '.html' + i[:file] + '.html' elsif @env.output_dir_structure.by? == :filetype - manifest_name=x[:file] - x[:file] + '.' + lng + '.html' + i[:file] + '.' + lng + '.html' elsif @env.output_dir_structure.by? == :filename - "./#{x[:file]}/#{x[:page]}" + "./#{i[:file]}/#{i[:page]}" else '' #error end - work=[ "#{x[:date]} #{x[:title]}", %{

#{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

} ] + work=[ "#{i[:date]} #{i[:title]}", %{

#{i[:date]} #{i[:title]}, #{i[:author][:authors_s]}

} ] works<<=(@output[lng][:html_mnt].is_a?(File)) \ - ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) + ? (work.concat([%{

[src]  #{i[:date]} #{i[:title]}, #{i[:author][:authors_s]} -- [#{i[:file]}.sst]

}])) : work end - works.sort_by {|x| x[0]}.each do |x| - @output[lng][:html] << x[1] - @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].is_a?(File) + works.sort_by {|y| y[0]}.each do |z| + @output[lng][:html] << z[1] + @output[lng][:html_mnt] << z[2] if @output[lng][:html_mnt].is_a?(File) end end end -- cgit v1.2.3