aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/harvest_topics.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v6/harvest_topics.rb')
-rw-r--r--lib/sisu/v6/harvest_topics.rb77
1 files changed, 41 insertions, 36 deletions
diff --git a/lib/sisu/v6/harvest_topics.rb b/lib/sisu/v6/harvest_topics.rb
index ce6e13c2..c682bd37 100644
--- a/lib/sisu/v6/harvest_topics.rb
+++ b/lib/sisu/v6/harvest_topics.rb
@@ -97,6 +97,11 @@ module SiSU_HarvestTopics
SiSU_HarvestTopics::OutputIndex.new(@opt,the_hash).html_print.html_songsheet
end
end
+ class Mix
+ def spaces
+ Ax[:spaces]
+ 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
@@ -160,7 +165,7 @@ module SiSU_HarvestTopics
idx_array
end
end
- class Index
+ class Index < Mix
def initialize(opt,env,idx_array,the_idx)
@opt,@env,@idx_array,@the_idx=opt,env,idx_array,the_idx
@@the_idx_topics=@the_idx
@@ -313,7 +318,7 @@ module SiSU_HarvestTopics
else
@the_h[x0] ||={}
end
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
if extract >= 1
y0.each_pair do |x1,y1|
if extract == 1
@@ -322,7 +327,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1] ||={}
end
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
if extract >= 2
y1.each_pair do |x2,y2|
if extract == 2
@@ -331,7 +336,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2] ||={}
end
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
if extract >= 3
y2.each_pair do |x3,y3|
if extract == 3
@@ -340,7 +345,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3] ||={}
end
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
if extract == 4
y3.each_pair do |x4,y4|
if extract == 4
@@ -349,14 +354,14 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3][x4] ||={}
end
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
if extract == 5
y4.each_pair do |x5,y5|
if extract == 5
@the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
@the_h[x0][x1][x2][x3][x4][x5][:md] << y5
end
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end
@@ -375,22 +380,22 @@ module SiSU_HarvestTopics
end
def traverse_base
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
y4.each_pair do |x5,y5|
- puts ' '*5 + x5 if x5.is_a?(String)
+ puts spaces*5 + x5 if x5.is_a?(String)
end
end
end
@@ -405,37 +410,37 @@ module SiSU_HarvestTopics
end
def traverse
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
if y0.has_key?(:md)
- y0[:md].each { |x| puts ' '*5 + x[:title] }
+ y0[:md].each { |x| puts spaces*5 + x[:title] }
end
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
if y1.has_key?(:md)
- y1[:md].each { |x| puts ' '*5 + x[:title] }
+ y1[:md].each { |x| puts spaces*5 + x[:title] }
end
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
if y2.has_key?(:md)
- y2[:md].each { |x| puts ' '*5 + x[:title] }
+ y2[:md].each { |x| puts spaces*5 + x[:title] }
end
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
if y3.has_key?(:md)
- y3[:md].each { |x| puts ' '*5 + x[:title] }
+ y3[:md].each { |x| puts spaces*5 + x[:title] }
end
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
if y4.has_key?(:md)
- y4[:md].each { |x| puts ' '*5 + x[:title] }
+ y4[:md].each { |x| puts spaces*5 + x[:title] }
end
y4.each_pair do |x5,y5|
- puts ' '*5 + x4 if x4.is_a?(String)
+ puts spaces*5 + x4 if x4.is_a?(String)
end
end
end
@@ -449,7 +454,7 @@ module SiSU_HarvestTopics
end
end
end
- class OutputIndex
+ class OutputIndex < Mix
require_relative 'i18n' # i18n.rb
def initialize(opt,the_idx)
@opt,@the_idx=opt,the_idx
@@ -509,67 +514,67 @@ module SiSU_HarvestTopics
lng=x0
if x0.is_a?(String)
#do_string_name(lng,'lev0',x0)
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
end
if y0.is_a?(Hash)
if y0.has_key?(:md)
y0[:md].each do |x|
#do_hash(lng,attrib,x) #lv==0 ?
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y0.each_pair do |x1,y1|
if x1.is_a?(String)
do_string_name(lng,'lev0',x1)
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
end
if y1.is_a?(Hash)
if y1.has_key?(:md)
y1[:md].each do |x|
do_hash(lng,0,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y1.each_pair do |x2,y2|
if x2.is_a?(String)
do_string(lng,'lev1',x2)
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
end
if y2.is_a?(Hash)
if y2.has_key?(:md)
y2[:md].each do |x|
do_hash(lng,1,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y2.each_pair do |x3,y3|
if x3.is_a?(String)
do_string(lng,'lev2',x3)
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
end
if y3.is_a?(Hash)
if y3.has_key?(:md)
y3[:md].each do |x|
do_hash(lng,2,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y3.each_pair do |x4,y4|
if x4.is_a?(String)
do_string(lng,'lev3',x4)
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
end
if y4.is_a?(Hash)
if y4.has_key?(:md)
y4[:md].each do |x|
do_hash(lng,3,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y4.each_pair do |x5,y5|
if x5.is_a?(String)
do_string(lng,'lev4',x5)
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end