aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/harvest_topics.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/harvest_topics.rb')
-rw-r--r--lib/sisu/v5/harvest_topics.rb120
1 files changed, 90 insertions, 30 deletions
diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb
index cd507f63..62103618 100644
--- a/lib/sisu/v5/harvest_topics.rb
+++ b/lib/sisu/v5/harvest_topics.rb
@@ -90,11 +90,27 @@ module SiSU_HarvestTopics
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
+ 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
+ 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
end
class Mix
@@ -104,11 +120,13 @@ module SiSU_HarvestTopics
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
- @idx_lst,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
+ data, filename, name, idx_array, lang=
+ @data,@filename,@name,@idx_array,@lang
+ @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil
rgx={}
rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
rgx[:title]=/^@title:[ ]+(.+)/
@@ -150,10 +168,26 @@ module SiSU_HarvestTopics
idxl=[]
g.each do |i|
i=i.strip
- idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page, lang: lang }
+ idxl << {
+ filename: filename,
+ file: file,
+ rough_idx: i,
+ title: @fulltitle,
+ author: creator,
+ page: page,
+ lang: lang
+ }
end
idxl
- else { filename: filename, file: file, rough_idx: @idx_list, title: @fulltitle, author: creator, page: page, lang: lang }
+ else {
+ filename: filename,
+ file: file,
+ rough_idx: @idx_list,
+ title: @fulltitle,
+ author: creator,
+ page: page,
+ lang: lang,
+ }
end
else
if (@opt.act[:verbose_plus][:set]==:on \
@@ -167,7 +201,8 @@ module SiSU_HarvestTopics
end
class Index < Mix
def initialize(opt,env,idx_array,the_idx)
- @opt,@env,@idx_array,@the_idx=opt,env,idx_array,the_idx
+ @opt, @env,@idx_array,@the_idx=
+ opt,env, idx_array, the_idx
@@the_idx_topics=@the_idx
end
def song
@@ -195,7 +230,13 @@ module SiSU_HarvestTopics
names += %{<a href="authors.#{lang}.html##{s}">#{n}</a>, }
end
end
- { filename: idx[:filename], file: idx[:file], author: names, title: idx[:title], page: idx[:page] }
+ {
+ filename: idx[:filename],
+ file: idx[:file],
+ author: names,
+ title: idx[:title],
+ page: idx[:page]
+ }
end
def capital_(txt)
txt[0].chr.capitalize + txt[1,txt.length]
@@ -471,18 +512,26 @@ module SiSU_HarvestTopics
@output[lng] ||={}
harvest_pth,file='',''
if @env.output_dir_structure.by? == :language
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest"
- file="#{harvest_pth}/topics.html"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub + '/' \
+ + lng + '/' \
+ + 'manifest'
+ file=harvest_pth + '/' + 'topics.html'
elsif @env.output_dir_structure.by? == :filetype
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest"
- file="#{harvest_pth}/topics.#{lng}.html"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub + '/' \
+ + 'manifest'
+ file=harvest_pth + '/' + 'topics.' + lng + '.html'
elsif @env.output_dir_structure.by? == :filename
- harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}"
- file="#{harvest_pth}/topics.#{lng}.html"
+ harvest_pth=@env.path.webserv + '/' \
+ + @opt.base_stub
+ file=harvest_pth + '/' + 'topics.' + 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}")
: ''
@@ -615,16 +664,17 @@ module SiSU_HarvestTopics
@the_idx.keys.each do |lg|
if @env.output_dir_structure.by? == :language
harvest_pth="../../#{lg}/manifest"
- file="#{harvest_pth}/topics.html"
+ file=harvest_pth + '/' + 'topics.html'
elsif @env.output_dir_structure.by? == :filetype
harvest_pth='.'
- file="#{harvest_pth}/topics.#{lg}.html"
+ file=harvest_pth + '/' + 'topics.' + lg + '.html'
elsif @env.output_dir_structure.by? == :filename
harvest_pth='.'
- file="#{harvest_pth}/topics.#{lg}.html"
+ file=harvest_pth + '/topics.' + 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
@@ -668,7 +718,9 @@ 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_mnt] \
+ << html_head_adjust(lng,'maintenance') \
+ if @opt.act[:maintenance][:set]==:on
@output[lng][:html] << html_head_adjust(lng)
end
end
@@ -682,7 +734,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
@@ -700,7 +753,8 @@ 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
@@ -708,12 +762,14 @@ WOK
@output[lng][:html] << html
end
def do_html_maintenance(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)
end
def do_string(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
do_html(lng,html)
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
+ do_html_maintenance(lng,html) \
+ if @output[lng][:html_mnt].is_a?(File)
end
def do_string_default(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
@@ -721,7 +777,8 @@ WOK
end
def do_string_maintenance(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
+ do_html_maintenance(lng,html) \
+ if @output[lng][:html_mnt].is_a?(File)
end
def do_string_name(lng,attrib,string)
f=/^(\S)/.match(string)[1]
@@ -735,9 +792,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}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
+ @output[lng][:html_mnt] \
+ << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><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
@@ -745,7 +804,8 @@ WOK
name=string.strip.gsub(/\s+/,'_')
html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>}
do_html(lng,html)
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
+ do_html_maintenance(lng,html) \
+ if @output[lng][:html_mnt].is_a?(File)
end
def do_array(lng,lv,array)
lv+=1