aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-05-01 23:30:34 -0400
committerRalph Amissah <ralph@amissah.com>2012-05-01 23:31:05 -0400
commitaae35fa1dd9c736bbb8dc93e66fed2188007465c (patch)
treecbcbfa8ff24b3ce8668e9a15edab8a4ea9d4b9bf /lib
parentv3: 3.2.6 version & changelog "opened" (diff)
v3: harvest (metadata, site/document summary) fixes
* harvest_topics, sort fix * harvest_authors, minor fix * sst content parsing lang dir * output file location, currently works for (by?) :language & :filetype
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3/harvest.rb4
-rw-r--r--lib/sisu/v3/harvest_authors.rb36
-rw-r--r--lib/sisu/v3/harvest_topics.rb536
3 files changed, 351 insertions, 225 deletions
diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb
index 71adb0f0..17931696 100644
--- a/lib/sisu/v3/harvest.rb
+++ b/lib/sisu/v3/harvest.rb
@@ -93,8 +93,8 @@ WOK
case opt.mod.inspect
when/--harvest/i
css(opt) if opt.cmd.inspect =~/M/
- SiSU_Harvest_Authors::Songsheet.new(opt,env).songsheet
- SiSU_Harvest_Topics::Songsheet.new(opt,env).songsheet
+ SiSU_HarvestAuthors::Songsheet.new(opt,env).songsheet
+ SiSU_HarvestTopics::Songsheet.new(opt,env).songsheet
if opt.cmd.inspect =~/R/
require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(opt).rsync_harvest
diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb
index 5bb702be..2c541c48 100644
--- a/lib/sisu/v3/harvest_authors.rb
+++ b/lib/sisu/v3/harvest_authors.rb
@@ -57,7 +57,7 @@
** Description: simple xml representation (sax style)
=end
-module SiSU_Harvest_Authors
+module SiSU_HarvestAuthors
require_relative 'author_format' # author_format.rb
class Songsheet
@@the_idx_authors={}
@@ -85,11 +85,11 @@ module SiSU_Harvest_Authors
end
lang_hash_file_array.each_pair do |lang,a|
idx_array[lang] ||= []
- idx_array=SiSU_Harvest_Authors::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_Harvest_Authors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index
- SiSU_Harvest_Authors::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
@@ -130,7 +130,7 @@ module SiSU_Harvest_Authors
else
name.sub(/\.ss[mt]$/,'')
end
- page=if @env.output_dir_structure.by_language_code?
+ page=if @env.output_dir_structure.by? == :language
"#{lang}/sisu_manifest.html"
else
"sisu_manifest.#{lang}.html"
@@ -174,7 +174,8 @@ module SiSU_Harvest_Authors
@opt,@the_idx=opt,the_idx
@env=SiSU_Env::InfoEnv.new
@rc=SiSU_Env::GetInit.instance.sisu_yaml.rc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
+ @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
+ @alph=@alphabet_list.dup
@letter=@alph.shift
@vz=SiSU_Env::GetInit.instance.skin
end
@@ -183,7 +184,7 @@ module SiSU_Harvest_Authors
@output ||={}
@output[lng] ||={}
harvest_pth,file='',''
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest"
file="#{harvest_pth}/authors.html"
else
@@ -212,17 +213,17 @@ module SiSU_Harvest_Authors
end
def html_head_adjust(lng,type='')
css_path,topics='',''
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
css_path=(type !~/maintenance/) \
? '../../_sisu/css/harvest.css'
: 'harvest.css'
topics='topics.html'
- elsif @env.output_dir_structure.by_filetype?
+ elsif @env.output_dir_structure.by? == :filetype
css_path=(type !~/maintenance/) \
? '../_sisu/css/harvest.css'
: 'harvest.css'
topics="topics.#{lng}.html"
- elsif @env.output_dir_structure.by_filename?
+ elsif @env.output_dir_structure.by? == :filename
css_path=(type !~/maintenance/) \
? '../_sisu/css/harvest.css'
: 'harvest.css'
@@ -231,10 +232,10 @@ module SiSU_Harvest_Authors
ln=SiSU_i18n::Languages.new.language.list
harvest_languages=''
@the_idx.keys.each do |lng|
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
harvest_pth="../../#{lng}/manifest"
file="#{harvest_pth}/authors.html"
- else @env.output_dir_structure.by_filetype?
+ else @env.output_dir_structure.by? == :filetype
harvest_pth='.'
file="#{harvest_pth}/authors.#{lng}.html"
end
@@ -312,6 +313,11 @@ WOK
end
def do_string_name(lng,attrib,string)
f=/^(\S)/.match(string[0])[1]
+ if @lng != lng
+ @alph=@alphabet_list.dup
+ @letter=@alph.shift
+ @lng = lng
+ end
if @letter < f
while @letter < f
if @alph.length > 0
@@ -338,13 +344,13 @@ WOK
@output[lng][:html] << x
works=[]
a[1][:md].each do |x|
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
manifest_pth="#{@env.path.output}/#{x[:file]}"
manifest_at=x[:file] + '.html'
- elsif @env.output_dir_structure.by_filetype?
+ elsif @env.output_dir_structure.by? == :filetype
manifest_name=x[:file]
manifest_at=x[:file] + '.' + lng + '.html'
- elsif @env.output_dir_structure.by_filename?
+ elsif @env.output_dir_structure.by? == :filename
manifest_at="../#{x[:file]}/#{x[:page]}"
end
work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb
index dd7ec8c2..30155e5f 100644
--- a/lib/sisu/v3/harvest_topics.rb
+++ b/lib/sisu/v3/harvest_topics.rb
@@ -58,7 +58,7 @@
** Description: simple xml representation (sax style)
=end
-module SiSU_Harvest_Topics
+module SiSU_HarvestTopics
require_relative 'author_format' # author_format.rb
include SiSU_Viz
class Songsheet
@@ -80,18 +80,18 @@ module SiSU_Harvest_Topics
lang_hash_file_array[y[:lng_is]] ||= []
lang_hash_file_array[y[:lng_is]] << line
elsif line =~/^@\S+?:(?:\s|$)/m \
- or line =~/^(?:\s*\n|%+ )/
+ 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_Harvest_Topics::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest
+ idx_array[lang] ||=[]
+ idx_array=SiSU_HarvestTopics::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest
end
end
- the_idx=SiSU_Harvest_Topics::Index.new(@opt,@env,idx_array,@@the_idx_topics).construct_book_topic_index
- SiSU_Harvest_Topics::OutputIndex.new(@opt,the_idx).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 Harvest
@@ -132,10 +132,10 @@ module SiSU_Harvest_Topics
else
name.sub(/\.ss[mt]$/,'')
end
- page=if @env.output_dir_structure.by_language_code?
+ page=if @env.output_dir_structure.by? == :language
#fix
end
- page=if @env.output_dir_structure.by_language_code?
+ page=if @env.output_dir_structure.by? == :language
"#{lang}/sisu_manifest.html"
else
"sisu_manifest.#{lang}.html"
@@ -162,101 +162,266 @@ module SiSU_Harvest_Topics
@opt,@env,@idx_array,@the_idx=opt,env,idx_array,the_idx
@@the_idx_topics=@the_idx
end
+ def song
+ the_idx=construct_book_topic_keys
+ the_hash=construct_book_topic_hash(the_idx)
+ #traverse_base
+ #traverse
+ end
def capital(txt)
+ txt_a=txt.scan(/\S+/)
+ tx=''
+ txt_a.each do |txt|
+ tx += txt[0].chr.capitalize + txt[1,txt.length] + ' '
+ end
+ tx.strip
+ end
+ def capital_(txt)
txt[0].chr.capitalize + txt[1,txt.length]
end
- def contents(lang,hash,idx)
+ def contents(idx)
names=''
idx[:author][:last_first_format_a].each do |n|
s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
- names=if @env.output_dir_structure.by_language_code?
+ names=if @env.output_dir_structure.by? == :language
names += %{<a href="authors.html##{s}">#{n}</a>, }
else
names += %{<a href="authors.#{lang}.html##{s}">#{n}</a>, }
end
end
- hash << { filename: idx[:filename], file: idx[:file], author: names, title: idx[:title], page: idx[:page] }
+ md={ 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]
end
- def construct_book_topic_index
+ def key_create(c)
+ x=nil
+ x=if c.length==5
+ c[0].to_s + '|' +
+ capital(c[1][0].to_s) + '|' +
+ capital(c[2][0].to_s) + '|' +
+ capital(c[3][0].to_s) #+ '|' +
+ #((c[4].class == String) ? c[4][0] : '')
+ elsif c.length==4
+ c[0].to_s + '|' +
+ capital(c[1][0].to_s) + '|' +
+ capital(c[2][0].to_s) #+ '|' +
+ #((c[3].class == String) ? c[3][0] : '')
+ elsif c.length==3
+ c[0].to_s + '|' +
+ capital(c[1][0].to_s) #+ '|' +
+ #((c[2].class == String) ? c[2][0] : '')
+ elsif c.length==2
+ c[0].to_s #+ '|' +
+ #((c[1].class == String) ? c[1][0] : '')
+ elsif c.length==1
+ c[0].to_s
+ end
+ end
+ def construct_book_topic_keys
idx_array=@idx_array
+ @idx_a=[]
+ @the_a=[]
idx_array.each_pair do |lang,idx_array|
@@the_idx_topics[lang] ||= {}
idx_array.each do |idx|
- @lv0,@lv1,@lv2,@lv3,@lv4={},{},{},{},{}
if idx[:rough_idx]
idx_lst=idx[:rough_idx].scan(/[^:]+/)
else
puts "no topic register in: << #{idx[:filename]} >>"
next
end
- idx_lst_alt=[]
- idx_lst.each {|lev| idx_lst_alt << lev.scan(/[^|]+/)}
- depth = idx_lst_alt.length - 1
- range = 0..depth
- range.each do |t|
- if idx_lst_alt[t]
- case t
- when 0
- lev0=idx_lst_alt[t]
- lev0.each do |lv0|
- lv0=capital(lv0)
- if @@the_idx_topics[lang][lv0].class==NilClass
- @@the_idx_topics[lang][lv0]={ md: [] }
- end
- @lv0=lv0 if lev0.length==1
- j=@@the_idx_topics[lang][lv0][:md]
- contents(lang,j,idx) if idx_lst_alt.length - 1 == t
+ idx_a=[]
+ idx_lst.each do |c|
+ idx_a << c.scan(/[^|\n]+/m)
+ end
+ idx_a << contents(idx)
+ @idx_a << [lang] + idx_a
+ end
+ end
+ @idx_a.each do |c|
+ if c.length > 0 \
+ and c.class == Array
+ if c[0].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[0]]
+ end
+ end
+ if c.length > 0 \
+ and c.class == Array
+ if c[1].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[1]] if v
+ end
+ end
+ if c.length > 1 \
+ and c.class == Array
+ if c[2].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[2]] if v
+ end
+ end
+ if c.length > 2 \
+ and c.class == Array
+ if c[3].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[3]] if v
+ end
+ end
+ if c.length > 3 \
+ and c.class == Array
+ if c[4].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[4]] if v
+ end
+ end
+ if c.length > 4 \
+ and c.class == Array
+ if c[5].class == Hash
+ v=key_create(c)
+ @the_a << [v, c[5]] if v
+ end
+ end
+ end
+ y=@the_a.sort_by { |x| x[0] }
+ #y.each {|z| puts z}
+ end
+ def construct_book_topic_hash(y)
+ @the_h={}
+ y.each do |z|
+ x=z[0].scan(/[^|]+/)
+ depth=x.length
+ extract=(depth-1)
+ k=case extract
+ when 4
+ { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } }
+ when 3
+ { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } }
+ when 2
+ { x[0] => { x[1] => { x[2] => z[1] } } }
+ when 1
+ { x[0] => { x[1] => z[1] } }
+ when 0
+ { x[0] => z[1] }
+ end
+ if extract >= 0
+ k.each_pair do |x0,y|
+ if extract == 0
+ @the_h[x0] ||={ md: [] }
+ @the_h[x0][:md] << y
+ else
+ @the_h[x0] ||={}
+ end
+ #puts ' '*0 + x0
+ if extract >= 1
+ y.each_pair do |x1,y|
+ if extract == 1
+ @the_h[x0][x1] ||={ md: [] }
+ @the_h[x0][x1][:md] << y
+ else
+ @the_h[x0][x1] ||={}
end
- when 1
- lev1=idx_lst_alt[t]
- lev1.each do |lv1|
- lv1=capital(lv1)
- if @@the_idx_topics[lang][@lv0][lv1].class==NilClass
- @@the_idx_topics[lang][@lv0][lv1]={ md: [] }
+ #puts ' '*1 + x1
+ if extract >= 2
+ y.each_pair do |x2,y|
+ if extract == 2
+ @the_h[x0][x1][x2] ||={ md: [] }
+ @the_h[x0][x1][x2][:md] << y
+ else
+ @the_h[x0][x1][x2] ||={}
+ end
+ #puts ' '*2 + x2
+ if extract >= 3
+ y.each_pair do |x3,y|
+ if extract == 3
+ @the_h[x0][x1][x2][x3] ||={ md: [] }
+ @the_h[x0][x1][x2][x3][:md] << y
+ else
+ @the_h[x0][x1][x2][x3] ||={}
+ end
+ #puts ' '*3 + x3
+ if extract == 4
+ y.each_pair do |x4,y|
+ if extract == 4
+ @the_h[x0][x1][x2][x3][x4] ||={ md: [] }
+ @the_h[x0][x1][x2][x3][x4][:md] << y
+ end
+ #puts ' '*4 + x4
+ end
+ end
+ end
+ end
end
- @lv1=lv1 if lev1.length==1
- j=@@the_idx_topics[lang][@lv0][lv1][:md]
- contents(lang,j,idx) if idx_lst_alt.length - 1 == t
end
- when 2
- lev2=idx_lst_alt[t]
- lev2.each do |lv2|
- lv2=capital(lv2)
- if @@the_idx_topics[lang][@lv0][@lv1][lv2].class==NilClass
- @@the_idx_topics[lang][@lv0][@lv1][lv2]={ md: [] }
+ end
+ end
+ end
+ end
+ end
+ #@the_h.each_pair { |x,y| p x; p y }
+ @the_h
+ end
+ def traverse_base
+ @the_h.each_pair do |x0,y|
+ puts ' '*0 + x0 if x0.class == String
+ if y.class == Hash
+ y.each_pair do |x1,y|
+ puts ' '*1 + x1 if x1.class == String
+ if y.class == Hash
+ y.each_pair do |x2,y|
+ puts ' '*2 + x2 if x2.class == String
+ if y.class == Hash
+ y.each_pair do |x3,y|
+ puts ' '*3 + x3 if x3.class == String
+ if y.class == Hash
+ y.each_pair do |x4,y|
+ puts ' '*4 + x4 if x4.class == String
+ end
+ end
end
- @lv2=lv2 if lev2.length==1
- j=@@the_idx_topics[lang][@lv0][@lv1][lv2][:md]
- contents(lang,j,idx) if idx_lst_alt.length - 1 == t
end
- when 3
- lev3=idx_lst_alt[t]
- lev3.each do |lv3|
- lv3=capital(lv3)
- if @@the_idx_topics[lang][@lv0][@lv1][@lv2][lv3].class==NilClass
- @@the_idx_topics[lang][@lv0][@lv1][@lv2][lv3]={ md: [] }
+ end
+ end
+ end
+ end
+ end
+ end
+ def traverse
+ @the_h.each_pair do |x0,y|
+ puts ' '*0 + x0 if x0.class == String
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x1,y|
+ puts ' '*1 + x1 if x1.class == String
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x2,y|
+ puts ' '*2 + x2 if x2.class == String
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
end
- @lv3=lv3 if lev3.length==1
- j=@@the_idx_topics[lang][@lv0][@lv1][@lv2][lv3][:md]
- contents(lang,j,idx) if idx_lst_alt.length - 1 == t
- end
- when 4
- lev4=idx_lst_alt[t]
- lev4.each do |lv4|
- lv4=capital(lv4)
- if @@the_idx_topics[lang][@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass
- @@the_idx_topics[lang][@lv0][@lv1][@lv2][@lv3][lv4]={ md: [] }
+ y.each_pair do |x3,y|
+ puts ' '*3 + x3 if x3.class == String
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each { |x| puts ' '*5 + x[:title] }
+ end
+ y.each_pair do |x4,y|
+ puts ' '*4 + x4 if x4.class == String
+ end
+ end
end
- @lv4=lv4 if lev4.length==1
- j=@@the_idx_topics[lang][@lv0][@lv1][@lv2][@lv3][lv4][:md]
- contents(lang,j,idx) if idx_lst_alt.length - 1 == t
end
end
end
end
end
end
- @the_idx
end
end
class OutputIndex
@@ -265,7 +430,8 @@ module SiSU_Harvest_Topics
@opt,@the_idx=opt,the_idx
@env=SiSU_Env::InfoEnv.new
@rc=SiSU_Env::GetInit.instance.sisu_yaml.rc
- @alph=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
+ @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
+ @alph=@alphabet_list.dup
@letter=@alph.shift
@vz=SiSU_Env::GetInit.instance.skin
end
@@ -274,17 +440,17 @@ module SiSU_Harvest_Topics
@output ||={}
@output[lng] ||={}
harvest_pth,file='',''
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest"
file="#{harvest_pth}/topics.html"
- else @env.output_dir_structure.by_filetype?
+ elsif @env.output_dir_structure.by? == :filetype
harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest"
file="#{harvest_pth}/topics.#{lng}.html"
end
FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
puts "file://#{file}"
@output[lng][:html]=File.new(file,'w')
- if @opt.cmd.inspect =~/-M/
+ if @opt.cmd.inspect =~/[M]/
@output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w')
end
end
@@ -297,26 +463,92 @@ module SiSU_Harvest_Topics
end
def html_print
def html_songsheet
+ #traverse
html_file_open
html_head
html_alph
- html_body
+ html_body_traverse
html_tail
html_file_close
end
+ def html_body_traverse
+ @the_idx.each_pair do |x0,y|
+ lng=x0
+ if x0.class == String
+ #do_string_name(lng,'lev0',x0)
+ #puts ' '*0 + x0
+ end
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ #do_hash(lng,attrib,x) #lv==0 ?
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x1,y|
+ if x1.class == String
+ do_string_name(lng,'lev0',x1)
+ #puts ' '*1 + x1
+ end
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,0,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x2,y|
+ if x2.class == String
+ do_string(lng,'lev1',x2)
+ #puts ' '*2 + x2
+ end
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,1,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x3,y|
+ if x3.class == String
+ do_string(lng,'lev2',x3)
+ #puts ' '*3 + x3
+ end
+ if y.class == Hash
+ if y.has_key?(:md)
+ y[:md].each do |x|
+ do_hash(lng,2,x)
+ #puts ' '*5 + x[:title]
+ end
+ end
+ y.each_pair do |x4,y|
+ if x4.class == String
+ do_string(lng,'lev3',x4)
+ #puts ' '*4 + x4
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
def html_head_adjust(lng,type='')
css_path,authors='',''
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
css_path=(type !~/maintenance/) \
? '../../_sisu/css/harvest.css'
: 'harvest.css'
authors='authors.html'
- elsif @env.output_dir_structure.by_filetype?
+ elsif @env.output_dir_structure.by? == :filetype
css_path=(type !~/maintenance/) \
? '../_sisu/css/harvest.css'
: 'harvest.css'
authors="authors.#{lng}.html"
- elsif @env.output_dir_structure.by_filename?
+ elsif @env.output_dir_structure.by? == :filename
css_path=(type !~/maintenance/) \
? '../_sisu/css/harvest.css'
: 'harvest.css'
@@ -325,10 +557,10 @@ module SiSU_Harvest_Topics
ln=SiSU_i18n::Languages.new.language.list
harvest_languages=''
@the_idx.keys.each do |lng|
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
harvest_pth="../../#{lng}/manifest"
file="#{harvest_pth}/topics.html"
- else @env.output_dir_structure.by_filetype?
+ else @env.output_dir_structure.by? == :filetype
harvest_pth='.'
file="#{harvest_pth}/topics.#{lng}.html"
end
@@ -421,6 +653,11 @@ WOK
end
def do_string_name(lng,attrib,string)
f=/^(\S)/.match(string)[1]
+ if @lng != lng
+ @alph=@alphabet_list.dup
+ @letter=@alph.shift
+ @lng = lng
+ end
if @letter < f
while @letter < f
if @alph.length > 0
@@ -445,11 +682,11 @@ WOK
end
end
def do_hash_md(lng,attrib,hash)
- if @env.output_dir_structure.by_language_code?
+ if @env.output_dir_structure.by? == :language
manifest_at=hash[:file] + '.html'
- elsif @env.output_dir_structure.by_filetype?
+ elsif @env.output_dir_structure.by? == :filetype
manifest_at=hash[:file] + '.' + lng + '.html'
- elsif @env.output_dir_structure.by_filename?
+ elsif @env.output_dir_structure.by? == :filename
manifest_at="../#{hash[:file]}/#{hash[:page]}"
end
html=%{<a href="#{manifest_at}">#{hash[:title]}</a> - #{hash[:author]}}
@@ -492,140 +729,23 @@ WOK
case
when y==String
attrib="lev#{lv}"
- lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a)
- when y==Array
- do_array(lng,lv,a)
- when y==Hash
- do_hash(lng,lv,a)
- end
- end
- def html_body
- the_idx=@the_idx
- the_idx.each_pair do |lng,lng_array|
- lng_array.sort.each do |a|
- do_case(lng,-1,a)
- end
- end
- end
- self
- end
- def screen_print
- def do_string(lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lng,lv,array)
- lv+=1
- array.each do |b|
- do_case(lng,lv,b)
- end
- end
- def do_hash_md(lng,lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lng,lv,string)
- end
- def do_hash(lng,lv,hash)
- lv+=1
- key=[]
- hash.each_key do |m|
- if m == :md
- do_case(lng,lv,hash[m])
- elsif m != :title \
- and m != :author \
- and m != :filename \
- and m != :file \
- and m != :rough_idx \
- and m != :page
- key << m
- elsif m == :title
- do_hash_md(lng,lv,hash)
+ if a=~/S/
+ lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a)
end
- end
- if key.length > 0
- key.sort.each do |m|
- do_string(lng,lv,m)
- do_case(lng,lv,hash[m])
- end
- end
- end
- def do_case(lng,lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lng,lv,a)
when y==Array
do_array(lng,lv,a)
when y==Hash
do_hash(lng,lv,a)
end
end
- def cycle
- the_idx=@the_idx
- the_idx.keys.each do |lng|
- the_idx[lng].each do |a|
- do_case(lng,-1,a)
- end
- end
- end
- self
- end
- def screen_print_unsorted
- def do_string(lng,lv,string)
- s=' '*4
- puts s*lv + string
- end
- def do_array(lng,lv,array)
- lv+=1
- array.each do |b|
- do_case(lng,lv,b)
- end
- end
- def do_hash_md(lng,lv,hash)
- string=hash[:title] + ' - ' + hash[:author]
- do_string(lng,lv,string)
- end
- def do_hash(lng,lv,hash)
- lv+=1
- hash.each_key do |m|
- if m == :md
- do_case(lng,lv,hash[m])
- else
- if m != :title \
- and m != :author \
- and m != :filename \
- and m != :file \
- and m != :rough_idx \
- and m != :page
- do_string(lng,lv,m)
- do_case(lng,lv,hash[m])
- elsif m == :title
- do_hash_md(lng,lv,hash)
- else
- end
- end
- end
- end
- def do_case(lng,lv,a)
- s=' '*4
- y = a.class
- case
- when y==String
- do_string(lng,lv,a)
- when y==Array
- do_array(lng,lv,a)
- when y==Hash
- do_hash(lng,lv,a)
- end
- end
- def cycle
- the_idx=@the_idx
- the_idx.keys.each do |lng|
- the_idx[lng].each do |a|
- do_case(lng,-1,a)
- end
- end
- end
+ #def html_body
+ # the_idx=@the_idx
+ # the_idx.each_pair do |lng,lng_array|
+ # lng_array.sort.each do |a|
+ # do_case(lng,-1,a)
+ # end
+ # end
+ #end
self
end
end