diff options
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 21 | ||||
| -rw-r--r-- | data/sisu/v3/v/version.yml | 6 | ||||
| -rw-r--r-- | lib/sisu/v3/harvest_authors.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v3/harvest_topics.rb | 137 | ||||
| -rw-r--r-- | lib/sisu/v3/options.rb | 9 | 
5 files changed, 123 insertions, 65 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 70bf8967..a3e8b54d 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,13 +13,28 @@ Reverse Chronological:  %% Development branch UNSTABLE  v3 branch once stable will supersede & replace current stable v2 branch +%% 3.2.9.orig.tar.xz (2012-05-19:20/6) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.9 +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.9-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.9.orig.tar.xz +  sisu_3.2.9.orig.tar.xz +  sisu_3.2.9-1.dsc +  sisu_3.2.9-1.debian.tar.gz + +* v3: harvest +  * harvest by filename output paths +  * harvest_topics, add level +  * harvest_topics, alternative headings, fix + +* v3: options, create manifest touched +  %% 3.2.8.orig.tar.xz (2012-05-12:19/6)  http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.8  http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.8-1  http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.8.orig.tar.xz -  sisu_3.2.8.orig.tar.xz -  sisu_3.2.8-1.dsc -  sisu_3.2.8-1.debian.tar.gz +  5138595d489f36c1cf0f64a014bb47bbbc3c38a36fb1f6d686f09933a29ca86d 1685524 sisu_3.2.8.orig.tar.xz +  eb828ddde0f9b98e23713d430a6356a756120f624244a9d6acd46a4134867c6f 1382 sisu_3.2.8-1.dsc +  b869ef3e9c23ef43dab0321400ba3bd6cb4c8f0ddc3e9cf649db77080a4a5378 296097 sisu_3.2.8-1.debian.tar.gz  * v3: sisupod make, re-fixed, check again diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index 992132db..e2a57cda 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@  --- -:version: 3.2.8 -:date_stamp: 2012w19/6 -:date: "2012-05-12" +:version: 3.2.9 +:date_stamp: 2012w20/6 +:date: "2012-05-19"  :project: SiSU diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb index 2c541c48..c4107139 100644 --- a/lib/sisu/v3/harvest_authors.rb +++ b/lib/sisu/v3/harvest_authors.rb @@ -187,9 +187,12 @@ module SiSU_HarvestAuthors          if @env.output_dir_structure.by? == :language            harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest"            file="#{harvest_pth}/authors.html" -        else +        elsif @env.output_dir_structure.by? == :filetype            harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest"            file="#{harvest_pth}/authors.#{lng}.html" +        elsif @env.output_dir_structure.by? == :filename +          harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}" +          file="#{harvest_pth}/authors.#{lng}.html"          end          FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)          puts "file://#{file}" @@ -235,7 +238,7 @@ module SiSU_HarvestAuthors            if @env.output_dir_structure.by? == :language              harvest_pth="../../#{lng}/manifest"              file="#{harvest_pth}/authors.html" -          else @env.output_dir_structure.by? == :filetype +          elsif @env.output_dir_structure.by? == :filetype              harvest_pth='.'              file="#{harvest_pth}/authors.#{lng}.html"            end @@ -344,14 +347,14 @@ WOK              @output[lng][:html] << x              works=[]              a[1][:md].each do |x| -              if @env.output_dir_structure.by? == :language +              manifest_at=if @env.output_dir_structure.by? == :language                  manifest_pth="#{@env.path.output}/#{x[:file]}" -                manifest_at=x[:file] + '.html' +                x[:file] + '.html'                elsif @env.output_dir_structure.by? == :filetype                  manifest_name=x[:file] -                manifest_at=x[:file] + '.' + lng +  '.html' +                x[:file] + '.' + lng +  '.html'                elsif @env.output_dir_structure.by? == :filename -                manifest_at="../#{x[:file]}/#{x[:page]}" +                "../#{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>} ]                works<<=(@output[lng][:html_mnt].class==File) \ diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb index 30155e5f..f6966331 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v3/harvest_topics.rb @@ -133,9 +133,6 @@ module SiSU_HarvestTopics            name.sub(/\.ss[mt]$/,'')          end          page=if @env.output_dir_structure.by? == :language -          #fix -        end -        page=if @env.output_dir_structure.by? == :language            "#{lang}/sisu_manifest.html"          else            "sisu_manifest.#{lang}.html" @@ -165,8 +162,6 @@ module SiSU_HarvestTopics      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+/) @@ -179,7 +174,7 @@ module SiSU_HarvestTopics      def capital_(txt)        txt[0].chr.capitalize + txt[1,txt.length]      end -    def contents(idx) +    def contents(idx,lang)        names=''        idx[:author][:last_first_format_a].each do |n|          s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') @@ -194,28 +189,26 @@ module SiSU_HarvestTopics      def capital_(txt)        txt[0].chr.capitalize + txt[1,txt.length]      end -    def key_create(c) +    def key_create(c,alt)        x=nil -      x=if c.length==5 +      x=if c.length==6 +        c[0].to_s + '|' + +          capital(c[1][0].to_s) + '|' + +          capital(c[2][0].to_s) + '|' + +          capital(c[3][0].to_s) + '|' + +          capital(alt.to_s) +      elsif 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] : '') +          capital(alt.to_s)        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] : '') +          capital(alt.to_s)        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 +          capital(alt.to_s)        end      end      def construct_book_topic_keys @@ -235,51 +228,54 @@ module SiSU_HarvestTopics            idx_lst.each do |c|              idx_a << c.scan(/[^|\n]+/m)            end -          idx_a << contents(idx) +          idx_a << contents(idx,lang)            @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 +            c[1].each do |alt| +              v=key_create(c,alt) +              @the_a << [v, c[2]] if v +            end            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 +            c[2].each do |alt| +              v=key_create(c,alt) +              @the_a << [v, c[3]] if v +            end            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 +            c[3].each do |alt| +              v=key_create(c,alt) +              @the_a << [v, c[4]] if v +            end            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 +            c[4].each do |alt| +              v=key_create(c,alt) +              @the_a << [v, c[5]] if v +            end +          end +        end +        if c.length > 5 \ +        and c.class == Array +          if c[6].class == Hash +            c[5].each do |alt| +              v=key_create(c,alt) +              @the_a << [v, c[6]] if v +            end            end          end        end @@ -345,8 +341,19 @@ module SiSU_HarvestTopics                              if extract == 4                                @the_h[x0][x1][x2][x3][x4] ||={ md: [] }                                @the_h[x0][x1][x2][x3][x4][:md] << y +                            else +                              @the_h[x0][x1][x2][x3][x4] ||={}                              end                              #puts '  '*4 + x4   +                            if extract == 5 +                              y.each_pair do |x5,y| +                                if extract == 5 +                                  @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } +                                  @the_h[x0][x1][x2][x3][x4][x5][:md] << y +                                end +                                #puts '  '*5 + x5   +                              end +                            end                            end                          end                        end @@ -376,6 +383,11 @@ module SiSU_HarvestTopics                      if y.class == Hash                        y.each_pair do |x4,y|                          puts '  '*4 + x4 if x4.class == String +                        if y.class == Hash +                          y.each_pair do |x5,y| +                            puts '  '*5 + x5 if x5.class == String +                          end +                        end                        end                      end                    end @@ -413,6 +425,14 @@ module SiSU_HarvestTopics                        end                        y.each_pair do |x4,y|                          puts '  '*4 + x4 if x4.class == String +                        if y.class == Hash +                          if y.has_key?(:md) +                            y[:md].each { |x| puts '  '*5 + x[:title] } +                          end +                          y.each_pair do |x5,y| +                            puts '  '*5 + x4 if x4.class == String +                          end +                        end                        end                      end                    end @@ -446,6 +466,9 @@ module SiSU_HarvestTopics          elsif @env.output_dir_structure.by? == :filetype            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"          end          FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)          puts "file://#{file}" @@ -526,6 +549,20 @@ module SiSU_HarvestTopics                              do_string(lng,'lev3',x4)                              #puts '  '*4 + x4                            end +                          if y.class == Hash +                            if y.has_key?(:md) +                              y[:md].each do |x| +                                do_hash(lng,3,x) +                                #puts '  '*5 + x[:title] +                              end +                            end +                            y.each_pair do |x5,y| +                              if x5.class == String +                                do_string(lng,'lev4',x5) +                                #puts '  '*5 + x5 +                              end +                            end +                          end                          end                        end                      end @@ -550,7 +587,7 @@ module SiSU_HarvestTopics            authors="authors.#{lng}.html"          elsif @env.output_dir_structure.by? == :filename            css_path=(type !~/maintenance/) \ -          ? '../_sisu/css/harvest.css' +          ? './_sisu/css/harvest.css'            : 'harvest.css'            authors="authors.#{lng}.html"          end @@ -560,7 +597,10 @@ module SiSU_HarvestTopics            if @env.output_dir_structure.by? == :language              harvest_pth="../../#{lng}/manifest"              file="#{harvest_pth}/topics.html" -          else @env.output_dir_structure.by? == :filetype +          elsif @env.output_dir_structure.by? == :filetype +            harvest_pth='.' +            file="#{harvest_pth}/topics.#{lng}.html" +          elsif @env.output_dir_structure.by? == :filename              harvest_pth='.'              file="#{harvest_pth}/topics.#{lng}.html"            end @@ -682,12 +722,13 @@ WOK          end        end        def do_hash_md(lng,attrib,hash) -        if @env.output_dir_structure.by? == :language -          manifest_at=hash[:file] + '.html' +        manifest_at=if @env.output_dir_structure.by? == :language +          hash[:file] + '.html'          elsif @env.output_dir_structure.by? == :filetype -          manifest_at=hash[:file] + '.' + lng +  '.html' +          hash[:file] + '.' + lng +  '.html'          elsif @env.output_dir_structure.by? == :filename -          manifest_at="../#{hash[:file]}/#{hash[:page]}" +          "./#{hash[:file]}/#{hash[:page]}" +        else '' #error          end          html=%{<a href="#{manifest_at}">#{hash[:title]}</a> - #{hash[:author]}}          do_string_default(lng,attrib,html) diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index a193c093..c4dbf812 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -535,12 +535,15 @@ module SiSU_Commandline        elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \        || act[:switch][:off].inspect =~/"manifest"/          { bool: false, set: :off } +      elsif act[:manifest]=(cmd =~/y/ \ +      || mod.inspect =~/"--manifest"/) +        { bool: true, set: :on }        else { bool: true, set: :na }        end        act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/          { bool: true, set: :on }        elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ -      || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"/ \ +      || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \        || mod.inspect =~/"--(?:redirect|dump)/          { bool: false, set: :off }        else { bool: true, set: :na } @@ -750,10 +753,6 @@ module SiSU_Commandline        || mod.inspect =~/"--qrcode"/) \        ? { bool: true, set: :on }        : { bool: false, set: :na } -      act[:manifest]=(cmd =~/y/ \ -      || mod.inspect =~/"--manifest"/) \ -      ? { bool: true, set: :on } -      : { bool: false, set: :na }        act[:help]=(mod.inspect =~/"--help/) \        ? { bool: true, set: :on }        : { bool: false, set: :na } | 
