From 93e1767ea887ea7ed67b8c70d2db7d2c7309a943 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 22 Apr 2012 13:59:33 -0400
Subject: sha256 (3.2.5)

---
 data/doc/sisu/CHANGELOG_v3 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 96450db9..8a7e81ac 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -17,9 +17,9 @@ v3 branch once stable will supersede & replace current stable v2 branch
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.5
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.5-1
 http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.5.orig.tar.xz
-  sisu_3.2.5.orig.tar.xz
-  sisu_3.2.5-1.dsc
-  sisu_3.2.5-1.debian.tar.gz
+  2238f9a6d88f9060ffe42b77bd77c2b668948d6dfdcf9a151f24dbbdf54b9857 1682996 sisu_3.2.5.orig.tar.xz
+  0d798dd042acd8ea7bf3b5efd9710ea94f2146dc192e2a79619dcc63a039f5bd 1382 sisu_3.2.5-1.dsc
+  5740d2d7004188fa15809cef23c2d4f5fb382f360a13efe23df5dacaeb40e3e0 295265 sisu_3.2.5-1.debian.tar.gz
 
   * v3: shared_html_lite, codeblock fix, affecting sql:
     SELECT ocn,body FROM doc_objects WHERE t_is='code';
-- 
cgit v1.2.3


From 712054c1ea1d675d955ce70c288f4f376fa5f3c2 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 1 May 2012 23:25:49 -0400
Subject: v3: 3.2.6 version & changelog "opened"

---
 data/doc/sisu/CHANGELOG_v3 | 8 ++++++++
 data/sisu/v3/v/version.yml | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 8a7e81ac..cab6d252 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -13,6 +13,14 @@ Reverse Chronological:
 %% Development branch UNSTABLE
 v3 branch once stable will supersede & replace current stable v2 branch
 
+%% 3.2.6.orig.tar.xz (2012-05-01:18/2)
+http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.6
+http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.6-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.6.orig.tar.xz
+  sisu_3.2.6.orig.tar.xz
+  sisu_3.2.6-1.dsc
+  sisu_3.2.6-1.debian.tar.gz
+
 %% 3.2.5.orig.tar.xz (2012-04-22:16/7)
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.5
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.5-1
diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml
index 1ce9ed62..b029757f 100644
--- a/data/sisu/v3/v/version.yml
+++ b/data/sisu/v3/v/version.yml
@@ -1,5 +1,5 @@
 ---
-:version: 3.2.5
-:date_stamp: 2012w16/7
-:date: "2012-04-22"
+:version: 3.2.6
+:date_stamp: 2012w18/2
+:date: "2012-05-01"
 :project: SiSU
-- 
cgit v1.2.3


From aae35fa1dd9c736bbb8dc93e66fed2188007465c Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 1 May 2012 23:30:34 -0400
Subject: 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
---
 data/doc/sisu/CHANGELOG_v3     |   6 +
 lib/sisu/v3/harvest.rb         |   4 +-
 lib/sisu/v3/harvest_authors.rb |  36 +--
 lib/sisu/v3/harvest_topics.rb  | 536 +++++++++++++++++++++++++----------------
 4 files changed, 357 insertions(+), 225 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index cab6d252..9482c8cb 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -21,6 +21,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.6.orig.tar.xz
   sisu_3.2.6-1.dsc
   sisu_3.2.6-1.debian.tar.gz
 
+* v3: harvest
+  * harvest_topics, sort fix
+  * harvest_authors, minor fix
+  * sst content parsing lang dir
+  * output file location, currently works for (by?) :language & :filetype
+
 %% 3.2.5.orig.tar.xz (2012-04-22:16/7)
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.5
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.5-1
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
-- 
cgit v1.2.3


From 714a14fcc16f4881779f3ea69fe6658560a26b66 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 1 May 2012 23:33:31 -0400
Subject: v3: misc, minor

---
 lib/sisu/v3/composite.rb         | 2 +-
 lib/sisu/v3/screen_text_color.rb | 2 +-
 lib/sisu/v3/sysenv.rb            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb
index 21adb030..ac64b15e 100644
--- a/lib/sisu/v3/composite.rb
+++ b/lib/sisu/v3/composite.rb
@@ -108,7 +108,7 @@ module SiSU_Assemble
     end
     def read
       begin
-        @fns_array=IO.readlines(@opt.fns,'')
+        @fns_array=IO.readlines(@opt.fno,'')
         assembled=insertions?
         write(assembled)
       rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error
diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb
index 7705e3b1..5dd6109d 100644
--- a/lib/sisu/v3/screen_text_color.rb
+++ b/lib/sisu/v3/screen_text_color.rb
@@ -206,7 +206,7 @@ module SiSU_Screen
     def sisu
     end
     def rescue
-      puts %{\t   #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t   An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
+      STDERR.puts %{\t   #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t   An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}}
     end
     def warn
       puts "\t  #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}"
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 0439955b..09dd5d6e 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -4796,7 +4796,7 @@ WOK
         elsif output_dir_structure.redirect?
           @md.opt.opt_act[:redirect][:inst]
         else
-          "#{@env.path.webserv}"
+          @env.path.webserv
         end
       end
       def base
-- 
cgit v1.2.3


From f297b90d4089b5bfe2f63010a6800e8d52047771 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 1 May 2012 23:37:43 -0400
Subject: v3: hub (seek finer grained control over what happens when; causes
 breakage)

* (primarily) cycle files then options (instead of options then files)
* manifest re-run on (currently generated) translated files if any
---
 data/doc/sisu/CHANGELOG_v3 |   6 +-
 lib/sisu/v3/hub.rb         | 403 ++++++++++++++++++++++++++-------------------
 lib/sisu/v3/options.rb     |  28 +++-
 3 files changed, 261 insertions(+), 176 deletions(-)

diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 9482c8cb..f5e56046 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -21,12 +21,16 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.6.orig.tar.xz
   sisu_3.2.6-1.dsc
   sisu_3.2.6-1.debian.tar.gz
 
-* v3: harvest
+* 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
 
+* v3: hub (seek finer grained control over what happens when; causes breakage)
+  * (primarily) cycle files then options (instead of options then files)
+  * manifest re-run on (currently generated) translated files if any
+
 %% 3.2.5.orig.tar.xz (2012-04-22:16/7)
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.5
 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.5-1
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 241d1538..ce8446e5 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -62,6 +62,64 @@ module SiSU
   require_relative 'sysenv'                             # sysenv.rb
     include SiSU_Screen
   @@pwd_the=Dir.pwd
+  class OptionLoopFiles
+    def initialize(opt)
+      @opt=opt
+    end
+    def loop_files_on_given_option
+      @opt.files.each_with_index do |fns,i|
+        @opt.fns=fns
+        @opt.f_pth=@opt.f_pths[i]
+        if fns !~/\.-sst$/
+          @opt.pth=@opt.paths[i]
+          @opt.lng=@opt.lngs[i]
+        else
+          @opt.pth=Dir.pwd
+          @opt.lng='en'
+        end
+        @@pwd=@opt.pth
+        Dir.chdir(@opt.pth) #watch
+        @env=SiSU_Env::InfoEnv.new(fns)
+        yield
+      end
+    end
+    def manifest_on_files_translated
+      r=Px[:lng_lst].join('|')
+      number_of_files={}
+      @opt.files.each_with_index do |fns,i|
+        fn=fns.gsub(/(?:\.#{r})?\.ss[tm]$/,'')
+        if number_of_files[fn].class == Array
+          number_of_files[fn] << i
+        else
+          number_of_files = { fn => [i] }
+        end
+      end
+      files_translated_idx=[]
+      number_of_files.each do |x|
+        if x[1].length > 1
+          files_translated_idx << x[1]
+        end
+      end
+      if files_translated_idx.flatten.length > 1
+      SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) tranlated files',"").grey_title_hi unless @opt.cmd =~/q/
+        files_translated_idx.flatten.each do |i|
+          @opt.fns=@opt.files[i]
+          @opt.f_pth=@opt.f_pths[i]
+          if @opt.fns !~/\.-sst$/
+            @opt.pth=@opt.paths[i]
+            @opt.lng=@opt.lngs[i]
+          else
+            @opt.pth=Dir.pwd
+            @opt.lng='en'
+          end
+          @@pwd=@opt.pth
+          Dir.chdir(@opt.pth) #watch
+          @env=SiSU_Env::InfoEnv.new(@opt.fns)
+          yield
+        end
+      end
+    end
+  end
   class Op
     @@env=SiSU_Env::InfoEnv.new
     def initialize(opt,req,message)
@@ -124,9 +182,6 @@ module SiSU
     end
     def select
       require_relative @req
-      if @req =~/^conf$/               # -C
-        SiSU_Initialize::Source.new(@opt).read
-      end
       if not @opt.files.empty?
         @opt.files.each_with_index do |fns,i|
           env=SiSU_Env::InfoEnv.new(fns)
@@ -177,64 +232,9 @@ module SiSU
               and @req =~ /^po4a$/
                 require_relative 'composite'          # composite.rb #pre-processing
                 SiSU_Po4a::Source.new(@opt).read                                         # -P      po4a.rb
-              elsif @req=~/^dal$/ \
-              and FileTest.file?(@opt.fns) \
-              and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
-                if fns =~ /\.ssm$/
-                  require_relative 'composite'          # composite.rb #pre-processing
-                  SiSU_Assemble::Composite.new(@opt).read
-                  @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
-                end
-                SiSU_DAL::Source.new(@opt).read                                         # -m
-              elsif FileTest.file?(env.source_file_with_path)
-                case @opt.fns
-                when /\.(?:(?:-|ssm\.)?sst|ssm)$/
-                  case @req
-                  when /^dal$/
-                    if fns =~ /\.ssm$/
-                      require_relative 'composite'      # composite.rb #pre-processing
-                      SiSU_Assemble::Composite.new(@opt).read
-                      @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
-                    end
-                                            SiSU_DAL::Source.new(@opt).read              # -m     dal.rb
-                  when /^git$/;             SiSU_Git::Source.new(@opt).read              # -g     git.rb
-                  when /^concordance$/;     SiSU_Concordance::Source.new(@opt).read      # -w     concordance.rb
-                  when /^share_src$/;       SiSU_Markup::Source.new(@opt).read           # -s     share_src.rb
-                  when /^sisupod_make$/;    SiSU_Doc::Source.new(@opt).read              # -S     sisupod_make.rb
-#                 when /^source_kdissert$/; SiSU_KdiSource::Source.new(@opt).read       # -S     share_src_kdissert.rb
-                  when /^digests$/;         SiSU_DigestView::Source.new(@opt).read       # -N     digests.rb
-                  when /^plaintext$/;       SiSU_Plaintext::Source.new(@opt).read        # -t -a  plaintext.rb
-                  when /^po4a$/;            SiSU_Po4a::Source.new(@opt).read             # -P     po4a.rb
-                 #when /^wikispeak$/;       SiSU_Wikispeak::Source.new(@opt).read        # -g
-                  when /^epub$/;            SiSU_EPUB::Source.new(@opt).read             # -e     epub.rb
-                  when /^odf$/;             SiSU_ODF::Source.new(@opt).read              # -o     odf.rb
-                  when /^xml_md_oai_pmh_dc$/; SiSU_XML_Metadata::OAI_PMH.new(@opt).read  # -O
-                  when /^texpdf$/;          SiSU_TeX::Source.new(@opt).read              # -p     texpdf.rb
-                  when /^manpage$/;         SiSU_Manpage::Source.new(@opt).read          # -i     manpage.rb
-                  when /^texinfo$/;         SiSU_TexInfo::Source.new(@opt).read          # -I     texinfo.rb
-                  when /^html$/;            SiSU_HTML::Source.new(@opt).read             # -h -H  html.rb
-                  when /^xhtml$/;           SiSU_XHTML::Source.new(@opt).read            # -b     xhtml.rb
-                  when /^xml$/;             SiSU_XML_SAX::Source.new(@opt).read          # -x     xml.rb
-                  when /^xml_dom$/;         SiSU_XML_DOM::Source.new(@opt).read          # -X     xml_dom.rb
-                  when /^shared_images$/;   SiSU_Images::Source.new(@opt).read            # -j     shared_images.rb
-                 #when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read  # -f
-                  when /^xml_scaffold$/;    SiSU_XML_Scaffold::Source.new(@opt).read     # -k     xml_scaffold.rb
-                  when /^embedded$/;        SiSU_Embedded::Source.new(@opt).read         # -m     embedded.rb (image and other content) #check
-                  when /^manifest$/;        SiSU_Manifest::Source.new(@opt).read         # -y     manifest.rb
-                  when /^qrcode$/;          SiSU_QRcode::Source.new(@opt).read           # -Q     qrcode.rb
-                  when /^sitemaps$/;        SiSU_Sitemaps::Source.new(@opt).read         # -Y     sitemaps.rb
-                  when /^zap$/;             SiSU_Zap::Source.new(@opt).read              # -Z     zap.rb
-                  when /^dbi$/;             SiSU_DBI::SQL.new(@opt).connect              # -D -d  dbi.rb
-                  when /^dbi_discreet$/;    SiSU_DBI_Discreet::SQL.new(@opt).build       # -d     dbi_discreet.rb
-                  end
-                  @n_do=@n_do+1
-                  SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/
-                  ObjectSpace.garbage_collect
-                else                    #print "not processed --> ", fns, "\n"
-                end
               else
-               if @req !~/^conf$/ \
-               and @opt.fns !~/http:\/\//
+                if @req !~/^conf$/ \
+                and @opt.fns !~/http:\/\//
                   SiSU::Operations.new(@opt).not_found
                 end
               end
@@ -256,8 +256,8 @@ module SiSU
             end
           end
         end
-      elsif @req =~/^dbi$/;            SiSU_DBI::SQL.new(@opt).connect         # -D -d
-      elsif @req=~/^sisupod_make$/;    SiSU_Doc::Source.new(@opt).read         # -S
+      #elsif @req =~/^dbi$/;            SiSU_DBI::SQL.new(@opt).connect         # -D -d
+      #elsif @req=~/^sisupod_make$/;    SiSU_Doc::Source.new(@opt).read         # -S
       end
       SiSU::Operations.new.counter
     end
@@ -429,9 +429,6 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
         if @opt.cmd =~/Z/                                                      #% -Z wipe previous output clean
           op('zap','Zap, deletions')
         end
-        if @opt.act[:share_source][:bool]
-          op('share_src','SiSU markup source')
-        end
         if @opt.act[:dal][:bool]
           @retry_count= -1
           begin
@@ -477,119 +474,185 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
             retry unless @retry_count > 1
           ensure
           end
-          @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
-        end
-        if @opt.act[:dal][:bool]                                               #%--dal, -m
-          op('dal','dal')
-        end
-        @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
-        if @opt.act[:sisupod][:bool]                                           #% --sisupod, -S make sisupod
-          op('sisupod_make','sisupod (txz)')
-          if @opt.fns=~/\.kdi._sst/
-            op('share_src_kdissert','kdissert (kdi)')                          #% -S share kdissert source
+           #@opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
+         end
+         #@opt.files_mod=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
+        def requires(req)
+          require_relative req
+        end
+        def each_file_loop_options
+          @opt.files.each_with_index do |fno,i|
+            @opt.fno=fno
+            @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
+              gsub(/\.ssm$/,'.ssm.sst')
+            @opt.f_pth=@opt.f_pths[i]
+            if @opt.fns !~/\.-sst$/
+              @opt.pth=@opt.paths[i]
+              @opt.lng=@opt.lngs[i]
+            else
+              @opt.pth=Dir.pwd
+              @opt.lng='en'
+            end
+            @@pwd=@opt.pth
+            Dir.chdir(@opt.pth) #watch
+            @env=SiSU_Env::InfoEnv.new(@opt.fns)
+            if @opt.act[:dal][:bool]                       #% --dal, -m
+              if @opt.fno =~ /\.ssm$/
+                require_relative 'composite'               # composite.rb #pre-processing
+                SiSU_Assemble::Composite.new(@opt).read
+              end
+              requires('dal')                              # -m     dal.rb
+              SiSU_DAL::Source.new(@opt).read
+            end
+            if @opt.act[:share_source][:bool]
+              requires('share_src')                        # -s     share_src.rb
+              SiSU_Markup::Source.new(@opt).read
+            end
+            if @opt.act[:sisupod][:bool]                   #% --sisupod, -S make sisupod
+              requires('sisupod_make')                     # -S     sisupod_make.rb
+              SiSU_Doc::Source.new(@opt).read
+            end
+            if @opt.act[:qrcode][:bool]                    #% --qrcode, -Q
+              requires('qrcode')                           # -Q     qrcode.rb
+              SiSU_QRcode::Source.new(@opt).read
+            end
+            if @opt.act[:hash_digests][:bool]              #% --hash-digests, -N digest tree
+              requires('digests')                          # -N     digests.rb
+              SiSU_DigestView::Source.new(@opt).read
+            end
+            if @opt.act[:txt][:bool]                       #% --txt, -t -a
+              requires('plaintext')                        # -t -a  plaintext.rb
+              SiSU_Plaintext::Source.new(@opt).read
+            end
+            if @opt.act[:html][:bool]                      #% --html, -h
+              requires('html')                             # -h -H  html.rb
+              SiSU_HTML::Source.new(@opt).read
+            end
+            if @opt.act[:concordance][:bool]               #% --concordance, -w
+              requires('concordance')                      # -w     concordance.rb
+              SiSU_Concordance::Source.new(@opt).read
+            end
+            if @opt.act[:epub][:bool]                      #% --epub, -e
+              requires('epub')                             # -e     epub.rb
+              SiSU_EPUB::Source.new(@opt).read
+            end
+            if @opt.act[:odt][:bool]                       #% --odt, -o opendocument
+              requires('odf')                              # -o     odf.rb
+              SiSU_ODF::Source.new(@opt).read
+            end
+            if @opt.act[:xhtml][:bool]                     #% --xhtml, -b xhtml
+              requires('xhtml')                            # -b     xhtml.rb
+              SiSU_XHTML::Source.new(@opt).read
+            end
+            if @opt.act[:xml_sax][:bool]                   #% --xml-sax, -x xml sax type
+              requires('xml')                              # -x     xml.rb
+              SiSU_XML_SAX::Source.new(@opt).read
+            end
+            if @opt.act[:xml_dom][:bool]                   #% --xml-dom, -x xml dom type
+              requires('xml_dom')                          # -X     xml_dom.rb
+              SiSU_XML_DOM::Source.new(@opt).read
+            end
+            if @opt.act[:pdf][:bool]                       #% --pdf, -p latex/ texpdf
+              requires('texpdf')                           # -p     texpdf.rb
+              SiSU_TeX::Source.new(@opt).read
+            end
+            if @opt.act[:manpage][:bool]                   #% --manpage, -i
+              requires('manpage')                          # -i     manpage.rb
+              SiSU_Manpage::Source.new(@opt).read
+            end
+            if @opt.act[:texinfo][:bool]                   #% --texinfo, -I
+              requires('texinfo')                          # -I     texinfo.rb
+              SiSU_TexInfo::Source.new(@opt).read
+            end
+            if @opt.act[:sqlite_discreet][:bool]           #% --sqlite, -d DB sqlite
+              requires('dbi_discreet')                     # -d     dbi_discreet.rb
+              SiSU_DBI_Discreet::SQL.new(@opt).build
+            end
+            if @opt.act[:manifest][:bool]                  #% --manifest, -y
+              requires('manifest')                         # -y     manifest.rb
+              SiSU_Manifest::Source.new(@opt).read
+            end
           end
         end
-        if @opt.act[:qrcode][:bool]                                            #% --qrcode, -Q
-          op('qrcode','QRcode')
-        end
-        if @opt.act[:hash_digests][:bool]                                      #% --hash-digests, -N digest tree
-          op('digests','digests')
-        end
-        if @opt.act[:html][:bool]                                              #% --html, -h
-          op('html','html')
-        end
-        if @opt.act[:txt][:bool]                                               #% --txt, -t -a
-          #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
-          op('plaintext','plaintext')
-        end
-        if @opt.act[:epub][:bool]                                              #% --epub, -e
-          op('epub','ePub')
-        end
-        if @opt.act[:odt][:bool]                                               #% --odt, -o opendocument
-          op('odf','OpenDocument')
-        end
-        if @opt.act[:xml_sax][:bool]                                           #% --xml-sax, -x xml sax type
-          op('xml','xml sax')
-        end
-        if @opt.act[:xml_dom][:bool]                                           #% --xml-dom, -x xml dom type
-          op('xml_dom','xml dom')
-        end
-       #if @opt.act[:fictionbook]                                              #% --fictionbook, -f fictionbook xml
-       #  op('xml_fictionbook','xml fictionbook')
-       #end
-        if @opt.act[:xhtml][:bool]                                             #% --xhtml, -b xhtml
-          op('xhtml','xhtml sax')
-        end
-        if @opt.act[:images][:bool]                                            #% --images, -j
-          op('shared_images','images')
-        end
-        if @opt.act[:concordance][:bool]                                       #% --concordance, -w
-          op('concordance','Concordance')
-        end
-        if @opt.cmd =~/O/                                                      #% -O open archive initiative, metadata harvesting
-          op('xml_md_oai_pmh_dc','OAI PMH')
-        end
-        if @opt.act[:po4a][:bool]                                              #% --po4a, -P
-          op('po4a','po4a')
-        end
-        if @opt.act[:git][:bool]                                               #% --git, -g sisu git
-          op('git','SiSU Git')
-        end
-        if @opt.cmd =~/T/                                                      #% -T termsheet/standard form
-          SiSU_Help::Help.new('termsheet').help_request
-          @opt.files.each do |fns|
-            if FileTest.file?(fns)
-              @opt.fns=fns
-              case @opt.fns
-              when /\.(termsheet.rb)$/
-                SiSU::Operations.new(@opt).termsheet
-              else                                 #print "not processed --> ", fns, "\n"
+        def loop_files_on_given_option_do
+          if @opt.act[:images][:bool]                                            #% --images, -j
+            OptionLoopFiles.new(@opt).loop_files_on_given_option do
+              requires('shared_images')
+              SiSU_Images::Source.new(@opt).read                                 # -j     shared_images.rb
+            end
+          end
+          if @opt.cmd =~/O/                                                      #% -O open archive initiative, metadata harvesting
+            op('xml_md_oai_pmh_dc','OAI PMH')
+          end
+          if @opt.act[:po4a][:bool]                                              #% --po4a, -P
+            OptionLoopFiles.new(@opt).loop_files_on_given_option do
+              requires('po4a')
+              SiSU_Po4a::Source.new(@opt).read                                   # -P     po4a.rb
+            end
+          end
+          if @opt.act[:git][:bool]                                               #% --git, -g sisu git
+            OptionLoopFiles.new(@opt).loop_files_on_given_option do
+              #requires('git')
+              #fix
+            end
+          end
+          if @opt.cmd =~/T/                                                      #% -T termsheet/standard form
+            SiSU_Help::Help.new('termsheet').help_request
+            @opt.files.each do |fns|
+              if FileTest.file?(fns)
+                @opt.fns=fns
+                case @opt.fns
+                when /\.(termsheet.rb)$/
+                  SiSU::Operations.new(@opt).termsheet
+                else                                 #print "not processed --> ", fns, "\n"
+                end
+              else SiSU::Operations.new(@opt).not_found
               end
-            else SiSU::Operations.new(@opt).not_found
             end
+            SiSU::Operations.new.counter
           end
-          SiSU::Operations.new.counter
-        end
-        if @opt.cmd =~/k/                                                      #% -T temporary tests
-          op('xml_scaffold','XML scaffold')
-        end
-        if @opt.act[:pdf][:bool]                                               #% --pdf, -p latex/ texpdf
-          op('texpdf','LaTeX pdf')
-        end
-        if @opt.act[:manpage][:bool]                                           #% --manpage, -i
-          op('manpage','manpage')
-        end
-        if @opt.act[:texinfo][:bool]                                           #% --texinfo, -I
-          op('texinfo','TeX Info')
-        end
-        if @opt.act[:psql][:bool]                                              #% --pg, -D DB postgresql
-          op('dbi','postgresql')
-        end
-        if @opt.act[:sqlite_discreet][:bool]                                            #% --sqlite, -d DB sqlite
-          op('dbi_discreet','sqlite')
-        end
-        if @opt.act[:sqlite][:bool]                                            #% --sqlite, -d DB sqlite
-          op('dbi','sqlite')
-        end
-        if @opt.act[:dal][:bool]                                               #% --dal, -m embedded content
-          op('embedded','Embedded Content')
-        end
-        if @opt.act[:manifest][:bool]                                          #% --manifest, -y
-          op('manifest','Manifest')
-        end
-        if @opt.act[:sitemap][:bool]                                           #% --sitemap, -Y
-          op('sitemaps','Sitemap')
-        end
-        if @opt.mod.inspect !~/--harvest/
-          if @opt.act[:scp][:bool]                                             #% -r copy to remote server
-            op('remote','scp')
+          if @opt.cmd =~/k/                                                      #% -T temporary tests
+            OptionLoopFiles.new(@opt).loop_files_on_given_option do
+              #requires('xml_scaffold')
+              #fix
+            end
           end
-          if @opt.act[:rsync][:bool]                                           #% -R copy to remote server
-            op('remote','rsync')
+          if @opt.act[:psql][:bool]                                              #% --pg, -D DB postgresql
+            op('dbi','postgresql')
           end
-        else
+          if @opt.act[:sqlite][:bool]                                            #% --sqlite, -d DB sqlite
+            op('dbi','sqlite')
+          end
+          if @opt.act[:manifest][:bool]                                          #% --manifest, -y
+            OptionLoopFiles.new(@opt).manifest_on_files_translated do
+              requires('manifest')
+              SiSU_Manifest::Source.new(@opt).read                               # -y     manifest.rb
+            end
+          end
+          if @opt.act[:sitemap][:bool]                                           #% --sitemap, -Y
+            OptionLoopFiles.new(@opt).loop_files_on_given_option do
+              requires('sitemaps')
+              SiSU_Sitemaps::Source.new(@opt).read                               # -Y     sitemaps.rb
+            end
+          end
+          if @opt.mod.inspect !~/--harvest/
+            if @opt.act[:scp][:bool]                                             #% -r copy to remote server
+              op('remote','scp')
+            end
+            if @opt.act[:rsync][:bool]                                           #% -R copy to remote server
+              op('remote','rsync')
+            end
+          else
+          end
+          op('urls','urls')
+        end
+        #if @opt.mod=~/^conf$/               # -C
+        if @opt.cmd=~/C/               # -C
+          requires('conf')                        # -s     conf.rb
+          SiSU_Initialize::Source.new(@opt).read
         end
-        op('urls','urls')
+        each_file_loop_options
+        loop_files_on_given_option_do
         @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.cmd =~/q/
         @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
         if defined? @@env.processing_path.processing \
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index 3db80231..0876604d 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -62,10 +62,10 @@ module SiSU_Commandline
   require_relative 'sysenv'                             # sysenv.rb
   @@base_path=nil
   class Options
-    attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what
+    attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what
     def initialize(a)
-      @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','',''
-      @f_pths,@files,@paths,@mod,@act=Array.new(5){[]}
+      @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','',''
+      @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]}
       @env=SiSU_Env::InfoEnv.new
       @lng_base=@env.language_default_set
       @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
@@ -448,6 +448,14 @@ module SiSU_Commandline
       else
         { bool: false, set: :na, inst: '' }
       end
+      act[:processing_path]=if mod.inspect =~/"--processing-path=/
+        base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+        { bool: true, set: :on, inst: base_pth }
+      elsif mod.inspect =~/"--processing-path/
+        { bool: true, set: :on, inst: @base_path }
+      else
+        { bool: false, set: :na, inst: nil }
+      end
       act[:dump]=if mod.inspect =~/"--dump=/
         base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
         { bool: true, set: :on, inst: base_pth }
@@ -753,6 +761,11 @@ module SiSU_Commandline
     def act
       @act
     end
+    def files_mod
+      files_mod=files
+      @files_mod=files_mod
+      @files_mod
+    end
     def f_pth
       @f_pth
     end
@@ -768,6 +781,9 @@ module SiSU_Commandline
     def lng_base
       @lng_base
     end
+    def fno
+      @fno
+    end
     def fns
       @fns
     end
@@ -780,12 +796,14 @@ module SiSU_Commandline
       end
     end
     def fnc
-      @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
+      @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/
+        fnb + '.ssm.sst'
       else @fns
       end
     end
     def fncb
-      @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst'
+      @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/
+        fnb + '.ssm.sst'
       else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
       end
     end
-- 
cgit v1.2.3