aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/harvest_authors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/harvest_authors.rb')
-rw-r--r--lib/sisu/v5/harvest_authors.rb113
1 files changed, 86 insertions, 27 deletions
diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb
index 7904ab15..26a0a9e3 100644
--- a/lib/sisu/v5/harvest_authors.rb
+++ b/lib/sisu/v5/harvest_authors.rb
@@ -88,20 +88,36 @@ module SiSU_HarvestAuthors
end
lang_hash_file_array.each_pair do |lang,a|
idx_array[lang] ||= []
- idx_array=SiSU_HarvestAuthors::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest
+ idx_array=SiSU_HarvestAuthors::Harvest.new(
+ @opt,
+ @env,
+ a,
+ filename,
+ name,
+ idx_array,
+ lang
+ ).extract_harvest
end
end
- the_idx=SiSU_HarvestAuthors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index
- SiSU_HarvestAuthors::OutputIndex.new(@opt,the_idx).html_print.html_songsheet
+ the_idx=SiSU_HarvestAuthors::Index.new(
+ idx_array,
+ @@the_idx_authors
+ ).construct_book_author_index
+ SiSU_HarvestAuthors::OutputIndex.new(
+ @opt,
+ the_idx
+ ).html_print.html_songsheet
end
end
class Harvest
def initialize(opt,env,data,filename,name,idx_array,lang)
- @opt,@env,@data,@filename,@name,@idx_array,@lang=opt,env,data,filename,name,idx_array,lang
+ @opt, @env,@data,@filename,@name,@idx_array,@lang=
+ opt,env, data, filename, name, idx_array, lang
end
def extract_harvest
- data,filename,name,idx_array,lang=@data,@filename,@name,@idx_array,@lang
- @title,@subtitle,@fulltitle,@author,@author_format,@date=nil,nil,nil,nil,nil,nil
+ data, filename, name, idx_array, lang =
+ @data,@filename,@name,@idx_array,@lang
+ @title=@subtitle=@fulltitle=@author=@author_format=@date=nil
@authors=[]
rgx={}
rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
@@ -123,7 +139,9 @@ module SiSU_HarvestAuthors
end
break if @title && @subtitle && @author && @date
end
- @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
+ @fulltitle=@subtitle \
+ ? (@title + ' - ' + @subtitle)
+ : @title
if @title \
and @author_format
creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details
@@ -138,7 +156,15 @@ module SiSU_HarvestAuthors
else
"sisu_manifest.#{lang}.html"
end
- idx_array[lang] <<= { filename: filename, file: file, date: @date, title: @fulltitle, author: creator, page: page, lang: lang }
+ idx_array[lang] <<= {
+ filename: filename,
+ file: file,
+ date: @date,
+ title: @fulltitle,
+ author: creator,
+ page: page,
+ lang: lang
+ }
else
#p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}"
end
@@ -164,7 +190,15 @@ module SiSU_HarvestAuthors
if @@the_idx_authors[lang][author].is_a?(NilClass)
@@the_idx_authors[lang][author]={ md: [] }
end
- @@the_idx_authors[lang][author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page], lang: idx[:lang] }
+ @@the_idx_authors[lang][author][:md] << {
+ filename: idx[:filename],
+ file: idx[:file],
+ author: idx[:author],
+ title: idx[:title],
+ date: idx[:date],
+ page: idx[:page],
+ lang: idx[:lang]
+ }
end
end
end
@@ -188,18 +222,26 @@ module SiSU_HarvestAuthors
@output[lng] ||={}
harvest_pth,file='',''
if @env.output_dir_structure.by? == :language
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub + '/' \
+ + lng + '/' \
+ + 'manifest'
file="#{harvest_pth}/authors.html"
elsif @env.output_dir_structure.by? == :filetype
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub + '/' \
+ + 'manifest'
file="#{harvest_pth}/authors.#{lng}.html"
elsif @env.output_dir_structure.by? == :filename
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub
file="#{harvest_pth}/authors.#{lng}.html"
end
- FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
+ FileUtils::mkdir_p(harvest_pth) \
+ unless FileTest.directory?(harvest_pth)
fileinfo=(@opt.act[:verbose][:set]==:on \
|| @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:urls_selected][:set]==:on \
|| @opt.act[:maintenance][:set]==:on) \
? ("file://#{file}") : ''
SiSU_Screen::Ansi.new(
@@ -213,7 +255,8 @@ module SiSU_HarvestAuthors
def html_file_close
@the_idx.keys.each do |lng|
@output[lng][:html].close
- @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File)
+ @output[lng][:html_mnt].close \
+ if @output[lng][:html_mnt].is_a?(File)
end
end
def html_print
@@ -257,18 +300,22 @@ module SiSU_HarvestAuthors
file="#{harvest_pth}/authors.#{lg}.html"
end
l=ln[lg][:t]
- harvest_languages += %{<a href="#{file}">#{l}</a>&nbsp;&nbsp;&nbsp;}
+ harvest_languages +=
+ %{<a href="#{file}">#{l}</a>&nbsp;&nbsp;&nbsp;}
end
sv=SiSU_Env::InfoVersion.instance.get_version
if @env.output_dir_structure.by? == :language
home_pth='../..'
- output_structure_by='(output organised by language &amp; filetype)'
+ output_structure_by=
+ '(output organised by language &amp; filetype)'
elsif @env.output_dir_structure.by? == :filetype
home_pth='..'
- output_structure_by='(output organised by filetype)'
+ output_structure_by=
+ '(output organised by filetype)'
elsif @env.output_dir_structure.by? == :filename
home_pth='.'
- output_structure_by='(output organised by filename)'
+ output_structure_by=
+ '(output organised by filename)'
else
home_pth='.'
output_structure_by='(output organised by ?)'
@@ -301,8 +348,11 @@ WOK
end
def html_head
@the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.act[:maintenance][:set]==:on
- @output[lng][:html] << html_head_adjust(lng)
+ @output[lng][:html_mnt] \
+ << html_head_adjust(lng,'maintenance') \
+ if @opt.act[:maintenance][:set]==:on
+ @output[lng][:html] \
+ << html_head_adjust(lng)
end
end
def html_alph
@@ -315,7 +365,8 @@ WOK
end
a=a.join
@the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a if @opt.act[:maintenance][:set]==:on
+ @output[lng][:html_mnt] << a \
+ if @opt.act[:maintenance][:set]==:on
@output[lng][:html] << a
end
end
@@ -333,12 +384,14 @@ WOK
</html>
WOK
@the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a if @output[lng][:html_mnt].is_a?(File)
+ @output[lng][:html_mnt] << a \
+ if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html] << a
end
end
def do_html(lng,html)
- @output[lng][:html_mnt] << html if @output[lng][:html_mnt].is_a?(File)
+ @output[lng][:html_mnt] << html \
+ if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html] << html
end
def do_string_name(lng,attrib,string)
@@ -353,9 +406,11 @@ WOK
if @alph.length > 0
@letter=@alph.shift
if @output[lng][:html_mnt].is_a?(File)
- @output[lng][:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
+ @output[lng][:html_mnt] \
+ << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
end
- @output[lng][:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
+ @output[lng][:html] \
+ << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
else break
end
end
@@ -383,14 +438,18 @@ WOK
"./#{i[:file]}/#{i[:page]}"
else '' #error
end
- work=[ "#{i[:date]} #{i[:title]}", %{<p class="publication">#{i[:date]} <a href="#{manifest_at}">#{i[:title]}</a>, #{i[:author][:authors_s]}</p>} ]
+ work=[
+ "#{i[:date]} #{i[:title]}",
+ %{<p class="publication">#{i[:date]} <a href="#{manifest_at}">#{i[:title]}</a>, #{i[:author][:authors_s]}</p>}
+ ]
works<<=(@output[lng][:html_mnt].is_a?(File)) \
? (work.concat([%{<p class="publication">[<a href="#{i[:file]}.sst">src</a>]&nbsp;&nbsp;#{i[:date]} <a href="file://#{manifest_at}">#{i[:title]}</a>, #{i[:author][:authors_s]} -- [<a href="#{i[:file]}.sst">#{i[:file]}.sst</a>]</p>}]))
: work
end
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)
+ @output[lng][:html_mnt] << z[2] \
+ if @output[lng][:html_mnt].is_a?(File)
end
end
end