From 21117c49c8d8ca5b94b2d6dcfa9e390654f2d88e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 29 May 2011 23:05:28 -0400 Subject: sha256 (3.0.11) --- 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 1385aeb5..3b113963 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -16,9 +16,9 @@ v3 branch once stable will supersede & replace current stable v2 branch %% 3.0.11.orig.tar.gz (2011-05-29:21/7) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.11-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz - sisu_3.0.11.orig.tar.gz - sisu_3.0.11-1.dsc - sisu_3.0.11-1.debian.tar.gz + b3ff82d967565a35f9693ad95812adcb850ac4f58f60f4cf9e5a9d613d886fcc 1940955 sisu_3.0.11.orig.tar.gz + 69d15d75fbf3670b8609dd8d9ee65a10b2eddfbcddd9ee206cbc48cfde6eb899 1223 sisu_3.0.11-1.dsc + 2a11d94922d6810b5a786d51a148cc955d8c676932b9341b8a30bf114cab4cee 288354 sisu_3.0.11-1.debian.tar.gz * sysenv, url webserver link (manifest) fix -- cgit v1.2.3 From 93d66090f1389abab497b87c148fd29fb3140f53 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 7 Jun 2011 20:05:55 -0400 Subject: v2 v3: 2.9.6 & 3.0.12 version & changelog "opened" --- data/doc/sisu/CHANGELOG_v2 | 3 +++ data/doc/sisu/CHANGELOG_v3 | 7 +++++++ data/sisu/v2/v/version.yml | 6 +++--- data/sisu/v3/v/version.yml | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2 index d204e9a2..049165fc 100644 --- a/data/doc/sisu/CHANGELOG_v2 +++ b/data/doc/sisu/CHANGELOG_v2 @@ -12,6 +12,9 @@ Reverse Chronological: %% STABLE Branch +%% 2.9.6.orig.tar.gz (2011-06-07:23/2) [see 3.0.12] +http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.12-1 + %% 2.9.5.orig.tar.gz (2011-05-17:20/2) [see 3.0.10] http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.10-1 diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 3b113963..b4a38c9e 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,6 +13,13 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch +%% 3.0.12.orig.tar.gz (2011-06-07:23/2) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.12-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz + sisu_3.0.12.orig.tar.gz + sisu_3.0.12-1.dsc + sisu_3.0.12-1.debian.tar.gz + %% 3.0.11.orig.tar.gz (2011-05-29:21/7) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.11-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz diff --git a/data/sisu/v2/v/version.yml b/data/sisu/v2/v/version.yml index 85cdd471..562ae361 100644 --- a/data/sisu/v2/v/version.yml +++ b/data/sisu/v2/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 2.9.4 -:date_stamp: 2011w19/7 -:date: "2011-05-15" +:version: 2.9.6 +:date_stamp: 2011w23/2 +:date: "2011-06-07" :project: SiSU diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index 1e3c4e22..671dca27 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.0.11-beta-rb1.9.2p180 -:date_stamp: 2011w29/7 -:date: "2011-05-29" +:version: 3.0.12-beta-rb1.9.2p180 +:date_stamp: 2011w23/2 +:date: "2011-06-07" :project: SiSU -- cgit v1.2.3 From 5f4c703727efcb6d272c1df7e74f83187596f40f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 7 Jun 2011 20:10:02 -0400 Subject: v2 v3: help, s/Bul garian/Bulgarian/ (Closes: #619068) --- data/doc/sisu/CHANGELOG_v2 | 2 ++ data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v2/help.rb | 2 +- lib/sisu/v3/help.rb | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v2 b/data/doc/sisu/CHANGELOG_v2 index 049165fc..f621f7be 100644 --- a/data/doc/sisu/CHANGELOG_v2 +++ b/data/doc/sisu/CHANGELOG_v2 @@ -15,6 +15,8 @@ Reverse Chronological: %% 2.9.6.orig.tar.gz (2011-06-07:23/2) [see 3.0.12] http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.12-1 + * help, s/Bul garian/Bulgarian/ (Closes: #619068) + %% 2.9.5.orig.tar.gz (2011-05-17:20/2) [see 3.0.10] http://git.sisudoc.org/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/3.0.10-1 diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index b4a38c9e..24335adb 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -20,6 +20,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz sisu_3.0.12-1.dsc sisu_3.0.12-1.debian.tar.gz + * help, s/Bul garian/Bulgarian/ (Closes: #619068) + %% 3.0.11.orig.tar.gz (2011-05-29:21/7) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.11-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz diff --git a/lib/sisu/v2/help.rb b/lib/sisu/v2/help.rb index 85bb898c..8413aff1 100644 --- a/lib/sisu/v2/help.rb +++ b/lib/sisu/v2/help.rb @@ -637,7 +637,7 @@ This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.c #{@cX.fuschia}@source:#{@cX.off} -#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings are not available for all of the languages listed.] +#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.] #{@cX.fuschia}@language.original:#{@cX.off} original language in which the work was published diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb index 477e93e9..ea27dcb3 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v3/help.rb @@ -637,7 +637,7 @@ This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.c #{@cX.fuschia}@source:#{@cX.off} -#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however, encodings are not available for all of the languages listed.] +#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.] #{@cX.fuschia}@language.original:#{@cX.off} original language in which the work was published -- cgit v1.2.3 From 7bf74c7fb5d70b4880c11f782c07cf9e78127779 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 8 Jun 2011 22:00:27 -0400 Subject: v3: options, restrict glob rule checks to glob & find; carry lang info * restrict glob rule checks to when --glob (-G) or --find (-f) requested * carry information on document language (from filename and or directory) * (additional test) --- data/doc/sisu/CHANGELOG_v3 | 7 ++- data/sisu/v3/v/version.yml | 4 +- lib/sisu/v3/options.rb | 111 +++++++++++++++++++++++++-------------------- 3 files changed, 69 insertions(+), 53 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 24335adb..8a1da39a 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,13 +13,18 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch -%% 3.0.12.orig.tar.gz (2011-06-07:23/2) +%% 3.0.12.orig.tar.gz (2011-06-08:23/3) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.12-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz sisu_3.0.12.orig.tar.gz sisu_3.0.12-1.dsc sisu_3.0.12-1.debian.tar.gz + * options + * restrict glob rule checks to when --glob (-G) or --find (-f) requested + * carry information on document language (from filename and or directory + * (additional test) + * help, s/Bul garian/Bulgarian/ (Closes: #619068) %% 3.0.11.orig.tar.gz (2011-05-29:21/7) diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index 671dca27..526b9b46 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- :version: 3.0.12-beta-rb1.9.2p180 -:date_stamp: 2011w23/2 -:date: "2011-06-07" +:date_stamp: 2011w23/3 +:date: "2011-06-08" :project: SiSU diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 96ec3c4a..81d12db8 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,14 +62,17 @@ 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,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what def initialize(a) - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path='','','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path,@base_stub='','','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by? @@base_path ||=Dir.pwd @base_path=@@base_path + r=Px[:lng_lst].join('|') + u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ + @base_stub=@base_path.gsub(u,'\1') @a=sisu_glob_rules(a) @a.freeze init @@ -97,7 +100,6 @@ module SiSU_commandline else Dir.glob("*#{g}*.ss[tm]") end - Px[:lng_lst].each do |d| if FileTest.directory?(d) x <<=if g =~/.ss[tm]/ @@ -113,40 +115,40 @@ module SiSU_commandline end end def sisu_glob_rules(a) - b=[] - f=[] - find_flag=false - a.each do |y| - if y =~ /^-/ \ - or y =~ /\.ss[tm]$/ - if y =~/^-/ \ - && y =~/[fG]|--find|--glob/ - find_flag=true + a=if a.inspect =~/"-\S*[fG]/ \ + or a.inspect =~/"--find"|"--glob"/ + b,f=[],[] + find_flag=false + a.each do |y| + if y =~ /^-/ + if y =~/^-/ \ + && y =~/[fG]|--find|--glob/ + find_flag=true + end + b << y + end + if find_flag \ + && y !~ /^-/ \ + && y =~ /\S+/ + f << y end - b << y - end - if find_flag \ - && y !~ /^-/ \ - && y =~ /\S+/ - f << y - elsif y =~ /^-/ - b << y end - end - r=Px[:lng_lst].join('|') - r.gsub!(/\|en\|/,'|') - @lang_regx=%r{(?:#{r})} - z=if find_flag - if f.length > 0 - b + find_select(find_flag,f) - else - find_all(find_flag,b) + r=Px[:lng_lst].join('|') + r.gsub!(/\|en\|/,'|') + @lang_regx=%r{(?:#{r})} + z=if find_flag + if f.length > 0 + b + find_select(find_flag,f) + else + find_all(find_flag,b) + end + elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ + && a.inspect =~/"#{@lang_regx}\/?"/ \ + && a.inspect =~/"en\/\S+?\.ss[tm]"/ + init_selected_lang_dirs(a) + else b end - elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ - && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"en\/\S+?\.ss[tm]"/ - init_selected_lang_dirs(a) - else b + else a end end def init_selected_lang_dirs(a) @@ -164,20 +166,22 @@ module SiSU_commandline end def init a=@a - s=expand_numeric_shortcuts(a) - q=set_files_and_paths_and_general_extract(s) - @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod]) - @what=q[:what] unless q[:what].empty? - @paths = q[:paths] - @files = q[:files] - @f_pths = q[:f_pths] - @lngs = q[:lngs] - if @files.length > 0 \ - and @cmd.empty? \ - and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default - @cmd=shortcut.cf_0 - end - SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ + if a.length > 0 + s=expand_numeric_shortcuts(a) + q=set_files_and_paths_and_general_extract(s) + @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod]) + @what=q[:what] unless q[:what].empty? + @paths = q[:paths] + @files = q[:files] + @f_pths = q[:f_pths] + @lngs = q[:lngs] + if @files.length > 0 \ + and @cmd.empty? \ + and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default + @cmd=shortcut.cf_0 + end + SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ + end # @files.uniq! @act=opt_act @files @@ -187,7 +191,7 @@ module SiSU_commandline c,w='','' m,f,pth,z,lng,lngs=[],[],[],[],[],[] a=s.split(/\s+/) - a.each do |x| + a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ or x =~/^--\S+/ if x =~/^-([a-z0-5]+)/i; c << $1 @@ -215,13 +219,20 @@ module SiSU_commandline $1 else 'en' end + lng_is =if l_p + l_p + elsif x =~/~(#{r})\.ss[tm]/ + $1 + else 'en' + end f_pths << { pth: pt.split[0].realpath.to_s, f: pt.split[1].to_s, pth_stub: pt.split[0].realpath.to_s[u,1], lng: (pt.split[0].realpath.to_s[t,1]) \ ? pt.split[0].realpath.to_s[t,1] \ - : nil + : nil, + lng_is: lng_is } # Dir.chdir(pt.split[0].realpath) else puts "file not found: #{x}" -- cgit v1.2.3 From 6a7c87dc0fbaba0bb3ae2ea4fa913d3af31cafdb Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 8 Jun 2011 22:16:47 -0400 Subject: v3: --help language, provides list of available languages * language (ISO 639-1 code (as varied by po4a) & name) --- data/doc/sisu/CHANGELOG_v3 | 5 ++++- lib/sisu/v3/help.rb | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 8a1da39a..6a2813d3 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -25,7 +25,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * carry information on document language (from filename and or directory * (additional test) - * help, s/Bul garian/Bulgarian/ (Closes: #619068) + * help + * --help language, provides list of available languages (ISO 639-1 code (as + varied by po4a) & name) + * s/Bul garian/Bulgarian/ (Closes: #619068) %% 3.0.11.orig.tar.gz (2011-05-29:21/7) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.11-1 diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb index ea27dcb3..27822e20 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v3/help.rb @@ -61,6 +61,7 @@ module SiSU_Help include SiSU_Screen require_relative 'param' # param.rb class Help + require_relative 'i18n' # i18n.rb def initialize(request='',color='') @request,@color=request,color if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX @@ -1163,12 +1164,27 @@ on the positive side: (a) the A,B,C,1,2,3 alternative makes explicit an aspect o WOK end def languages - puts < Date: Wed, 8 Jun 2011 22:18:48 -0400 Subject: v3: manifest, fix a full name --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/manifest.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 6a2813d3..73960544 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -25,6 +25,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * carry information on document language (from filename and or directory * (additional test) + * manifest, fix a full name + * help * --help language, provides list of available languages (ISO 639-1 code (as varied by po4a) & name) diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 0c6d5460..a21b31f9 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -152,7 +152,7 @@ module SiSU_Manifest url=@f.output_path.base.url manifests={} mp,mn,mt,mr=nil,nil,nil,nil - ln=SiSU_i18n::Languages.new.list + ln=SiSU_i18n::Languages.new.language.list Px[:lng_lst].each do |lc| if @env.output_dir_structure.by_language_code? mp="#{@f.output_path.base.dir}/#{lc}/manifest" -- cgit v1.2.3 From a011db38da1999b9eb137927b47d21568ab8b078 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 8 Jun 2011 22:23:26 -0400 Subject: v3: html, texpdf, syslink to default, adjusted & made similar --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/html.rb | 9 ++++++--- lib/sisu/v3/texpdf.rb | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 73960544..291be8df 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -27,6 +27,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * manifest, fix a full name + * html, index.html syslink, remove and remake syslink + * texpdf, index.html syslink, made similar + * help * --help language, provides list of available languages (ISO 639-1 code (as varied by po4a) & name) diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index d586c25d..d77d3df6 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -652,10 +652,13 @@ WOK ## only works properly for directory_structure_by language, fix unless FileTest.file?("#{@file.output_path.html.dir}/index.html") pwd_set=Dir.pwd + idx_lnk=@file.base_filename.html_segtoc + mlnk='index.html' Dir.chdir(@file.output_path.html.dir) - system(" - ln -s #{@file.base_filename.html_segtoc} index.html - ") + system(" + rm #{mlnk} + ln -s #{idx_lnk} #{mlnk} + ") Dir.chdir(pwd_set) end end diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index eff07f19..918e00a2 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -249,11 +249,13 @@ module SiSU_TeX "#{@md.fnb}.landscape.pdf" else 'landscape.pdf' end + pwd_set=Dir.pwd + Dir.chdir(@md.file.output_path.pdf.dir) system(" - cd #{@md.file.output_path.pdf.dir} rm #{mklnk} ln -s #{pdf_l} #{mklnk} ") + Dir.chdir(pwd_set) end else SiSU_Screen::Ansi.new(@md.opt.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn -- cgit v1.2.3 From 2aba456f56f2ebee338bba9dd0e37c972f4b758c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 Jun 2011 22:01:28 -0400 Subject: v3: param, remove unused class variable '@@symlnk' --- data/doc/sisu/CHANGELOG_v3 | 4 +++- data/sisu/v3/v/version.yml | 4 ++-- lib/sisu/v3/param.rb | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 291be8df..866bd075 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,7 +13,7 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch -%% 3.0.12.orig.tar.gz (2011-06-08:23/3) +%% 3.0.12.orig.tar.gz (2011-06-09:23/4) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.12-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz sisu_3.0.12.orig.tar.gz @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * html, index.html syslink, remove and remake syslink * texpdf, index.html syslink, made similar + * param, remove unused class variable '@@symlnk' + * help * --help language, provides list of available languages (ISO 639-1 code (as varied by po4a) & name) diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index 526b9b46..a997c557 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- :version: 3.0.12-beta-rb1.9.2p180 -:date_stamp: 2011w23/3 -:date: "2011-06-08" +:date_stamp: 2011w23/4 +:date: "2011-06-09" :project: SiSU diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 5d35bf3d..22b711df 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -65,7 +65,6 @@ module SiSU_Param require_relative 'help' # help.rb include SiSU_Help @@date=SiSU_Env::Info_date.new - @@symlnk=Create_system_link.new @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil @doc={ initialise: nil, markup: '', lnks: '', stmp: '', req: {} } @@yaml=@@yamladdr=nil @@ -1459,7 +1458,6 @@ module SiSU_Param class Instantiate def param_instantiate @@date=SiSU_Env::Info_date.new - @@symlnk=SiSU_Env::Create_system_link.new @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil @doc={ initialise: nil, -- cgit v1.2.3 From d0fd14adeb55b4dfffed43c413207b2328c654dd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 Jun 2011 22:05:51 -0400 Subject: v3: sysenv, limit/prevent the creation of spurious language output directories --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/embedded.rb | 4 ++-- lib/sisu/v3/sysenv.rb | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 866bd075..c80dfc33 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -25,6 +25,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * carry information on document language (from filename and or directory * (additional test) + * sysenv, limit/prevent the creation of spurious output directories (based on + language subdirectories), revisit + * manifest, fix a full name * html, index.html syslink, remove and remake syslink diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index fad1fb29..fb2245c9 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -87,8 +87,8 @@ module SiSU_Embedded def images src="#{@base_src_dir}/_sisu/image" src_img='_sisu/image' - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}" - img_dir="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + ldest=@env.path.output + img_dir="#{@env.path.output}/_sisu/image" @rhost.each do |remote_conn| rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 944df010..d0c88deb 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -1642,7 +1642,10 @@ WOK "#{path.webserv}/#{images}" end def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names - "#{path.webserv}/#{@stub_pwd}" + r=Px[:lng_lst].join('|') + u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ + base_stub=@sys.pwd.gsub(u,'\1') + "#{path.webserv}/#{base_stub}" end def feed (defined? @rc['webserv']['feed']) \ -- cgit v1.2.3 From a6651effc29a5805599657e3cbeb6c44de62be1e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 Jun 2011 22:12:11 -0400 Subject: v3: harvest, work for alt output structures; for each language * paths to document manifests etc. for the possible output dir structures * author and topic lists for available documents, by availability in each language --- data/doc/sisu/CHANGELOG_v3 | 6 + lib/sisu/v3/harvest.rb | 80 +++---- lib/sisu/v3/harvest_authors.rb | 233 ++++++++++++--------- lib/sisu/v3/harvest_topics.rb | 458 ++++++++++++++++++++++++----------------- lib/sisu/v3/hub.rb | 2 +- 5 files changed, 452 insertions(+), 327 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index c80dfc33..bb9309f5 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -20,6 +20,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz sisu_3.0.12-1.dsc sisu_3.0.12-1.debian.tar.gz + * harvest + * correct paths to document manifests etc. for the possible output dir + structures + * produce authors and topics lists for the documents that are available, + according to availability in each language + * options * restrict glob rule checks to when --glob (-G) or --find (-f) requested * carry information on document language (from filename and or directory diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb index aaec9046..47380c2e 100644 --- a/lib/sisu/v3/harvest.rb +++ b/lib/sisu/v3/harvest.rb @@ -58,45 +58,51 @@ ** Description: system environment, resource control and configuration details =end -def help - puts <> ") - end - files.each do |filename| - file_array=[] + puts 'authors:' + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + name=y[:f] + filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|date):(?:\s|$)/m - file_array << line + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line elsif line =~/^@\S+?:(?:\s|$)/m \ or line =~/^(?:\s*\n|%+ )/ else break end end end - idx_array=HARVEST_authors::Harvest.new(file_array,filename,idx_array).extract_harvest + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||= [] + idx_array=HARVEST_authors::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest + end end the_idx=HARVEST_authors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index HARVEST_authors::Output_index.new(@opt,the_idx).html_print.html_songsheet - harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" - puts "file://#{harvest_pth}/harvest_authors.html" - puts "file://#{@env.path.pwd}/harvest_authors.html" if @opt.cmd.inspect =~/M/ end end class Harvest - def initialize(data,filename,idx_array) - @data,@filename,@idx_array=data,filename,idx_array + 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 end def extract_harvest - data,filename,idx_array=@data,@filename,@idx_array + data,filename,name,idx_array,lang=@data,@filename,@name,@idx_array,@lang @title,@subtitle,@fulltitle,@author,@author_format,@date=nil,nil,nil,nil,nil,nil @authors=[] rgx={} @@ -123,22 +121,25 @@ module HARVEST_authors break if @title and @subtitle and @author and @date end @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title - if @title and @author_format + if @title \ + and @author_format creator=FORMAT::Author.new(@author_format.strip).author_details @authors,@authorship=creator[:authors],creator[:authorship] - file=if filename=~/~[a-z]{2,3}\.ss[mt]$/ - lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1] - filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') else - lang='' - filename.sub(/\.ss[mt]$/,'') + name.sub(/\.ss[mt]$/,'') end - page="sisu_manifest#{lang}.html" - idx_array <<= { filename: filename, file: file, date: @date, title: @fulltitle, author: creator, page: page } + page=if @env.output_dir_structure.by_language_code? + "#{lang}/sisu_manifest.html" + else + "sisu_manifest.#{lang}.html" + end + idx_array[lang] <<= { filename: filename, file: file, date: @date, title: @fulltitle, author: creator, page: page, lang: lang } else #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}" end - idx_array.flatten! + idx_array[lang].flatten! idx_array end end @@ -152,38 +153,55 @@ module HARVEST_authors end def construct_book_author_index idx_array=@idx_array - idx_array.each do |idx| - idx[:author][:last_first_format_a].each do |author| - author.strip! - if @@the_idx_authors[author].class==NilClass - @@the_idx_authors[author]={ md: [] } + idx_array.each_pair do |lang,idx_array| + @@the_idx_authors[lang] ||= {} + idx_array.each do |idx| + idx[:author][:last_first_format_a].each do |author| + author.strip! + if @@the_idx_authors[lang][author].class==NilClass + @@the_idx_authors[lang][author]={ md: [] } + end + @@the_idx_authors[lang][author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page], lang: idx[:lang] } end - @@the_idx_authors[author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page] } end end @the_idx=@@the_idx_authors end end class Output_index + require_relative 'i18n' # i18n.rb + require 'fileutils' + include FileUtils def initialize(opt,the_idx) @opt,@the_idx=opt,the_idx @env=SiSU_Env::Info_env.new - @rc=Get_init.instance.sisu_yaml.rc + @rc=SiSU_Env::Get_init.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] @letter=@alph.shift @vz=SiSU_Env::Get_init.instance.skin end def html_file_open - @output={} - harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" - @output[:html]=File.new("#{harvest_pth}/harvest_authors.html",'w') - @output[:html_mnt]=(@opt.cmd.inspect =~/M/) \ - ? File.new("#{@env.path.pwd}/harvest_authors.html",'w') \ - : nil + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by_language_code? + harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest" + file="#{harvest_pth}/authors.html" + else + harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest" + file="#{harvest_pth}/authors.#{lng}.html" + end + mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) + puts "file://#{file}" + @output[lng][:html]=File.new(file,'w') + end end def html_file_close - @output[:html].close - @output[:html_mnt].close if @output[:html_mnt].class==File + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close if @output[lng][:html_mnt].class==File + end end def html_print def html_songsheet @@ -194,19 +212,36 @@ module HARVEST_authors html_tail html_file_close end - def html_head_adjust(type='') - css_path=if @env.output_dir_structure.by_language_code? + def html_head_adjust(lng,type='') + css_path,topics='','' + if @env.output_dir_structure.by_language_code? css_path=(type !~/maintenance/) \ ? '../../_sisu/css/harvest.css' \ : 'harvest.css' + topics='topics.html' 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? css_path=(type !~/maintenance/) \ ? '../_sisu/css/harvest.css' \ : 'harvest.css' + topics="topics.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lng| + if @env.output_dir_structure.by_language_code? + harvest_pth="../../#{lng}/manifest" + file="#{harvest_pth}/authors.html" + else @env.output_dir_structure.by_filetype? + harvest_pth='.' + file="#{harvest_pth}/authors.#{lng}.html" + end + l=ln[lng][:t] + harvest_languages += %{#{l}   } end sv=SiSU_Env::Info_version.instance.get_version <

SiSU Metadata Harvest - Authors

-

[ HOME ] also see SiSU Metadata Harvest - Topics

+

[ HOME ] also see SiSU Metadata Harvest - Topics

#{@env.widget_static.search_form}


+

#{harvest_languages}

+
WOK end def html_head - @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/ - @output[:html] << html_head_adjust + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.cmd.inspect =~/M/ + @output[lng][:html] << html_head_adjust(lng) + end end def html_alph a=[] a << '

' @alph.each do |x| - a << ((x =~/[0-9]/) ? '' : %{#{x}, }) + a << ((x =~/[0-9]/) \ + ? '' \ + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a if @opt.cmd.inspect =~/M/ + @output[lng][:html] << a end - @output[:html_mnt] << a.join if @output[:html_mnt].class==File - @output[:html] << a.join end def html_tail - a=[] - a <<< @@ -260,27 +303,25 @@ WOK WOK - @output[:html_mnt] << a if @output[:html_mnt].class==File - @output[:html] << a - end - def do_html(html) - @output[:html_mnt] << html if @output[:html_mnt].class==File - @output[:html] << html + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a if @output[lng][:html_mnt].class==File + @output[lng][:html] << a + end end - def do_string(attrib,string) - html=%{

#{string}

} - do_html(html) + def do_html(lng,html) + @output[lng][:html_mnt] << html if @output[lng][:html_mnt].class==File + @output[lng][:html] << html end - def do_string_name(attrib,string) + def do_string_name(lng,attrib,string) f=/^(\S)/.match(string[0])[1] if @letter < f while @letter < f if @alph.length > 0 @letter=@alph.shift - if @output[:html_mnt].class==File - @output[:html_mnt] << %{\n

#{@letter}

} + if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << %{\n

#{@letter}

} end - @output[:html] << %{\n

#{@letter}

} + @output[lng][:html] << %{\n

#{@letter}

} else break end end @@ -288,37 +329,35 @@ WOK end def html_body the_idx=@the_idx - the_idx.sort.each do |a| - do_string_name('',a) - name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - x = %{

#{a[0]}

} - if @output[:html_mnt].class==File - @output[:html_mnt] << x - end - @output[:html] << x - works=[] - a[1][:md].each do |x| - if @env.output_dir_structure.by_language_code? - manifest_pth="#{@env.path.output}/#{x[:file]}" - manifest_at_local=@env.path.output + '/' + 'en' + '/' + 'manifest/' + x[:file] + '.manifest.html' - manifest_at=x[:file] + '.manifest.html' - elsif @env.output_dir_structure.by_filetype? - #manifest_pth_2="#{@env.path.output}/#{x[:file]}" - manifest_name=x[:file] - manifest_at_local=manifest_name + 'manifest.html' - manifest_at=x[:file] + '.manifest.html' - elsif @env.output_dir_structure.by_filename? - manifest_at_local="#{@env.path.output}/#{x[:file]}/#{x[:page]}" - manifest_at="../#{x[:file]}/#{x[:page]}" + the_idx.each_pair do |lng,lng_array| + lng_array.sort.each do |a| + do_string_name(lng,'',a) + name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') + x = %{

#{a[0]}

} + if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << x + end + @output[lng][:html] << x + works=[] + a[1][:md].each do |x| + if @env.output_dir_structure.by_language_code? + manifest_pth="#{@env.path.output}/#{x[:file]}" + manifest_at=x[:file] + '.html' + elsif @env.output_dir_structure.by_filetype? + manifest_name=x[:file] + manifest_at=x[:file] + '.' + lng + '.html' + elsif @env.output_dir_structure.by_filename? + manifest_at="../#{x[:file]}/#{x[:page]}" + end + work=[ "#{x[:date]} #{x[:title]}", %{

#{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

} ] + works<<=(@output[lng][:html_mnt].class==File) \ + ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) \ + : work + end + works.sort_by {|x| x[0]}.each do |x| + @output[lng][:html] << x[1] + @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].class==File end - work=[ "#{x[:date]} #{x[:title]}", %{

#{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

} ] - works<<=(@output[:html_mnt].class==File) \ - ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) \ - : work - end - works.sort_by {|x| x[0]}.each do |x| - @output[:html] << x[1] - @output[:html_mnt] << x[2] if @output[:html_mnt].class==File end end end diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb index 3ca72326..c3204de9 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v3/harvest_topics.rb @@ -60,47 +60,46 @@ =end module HARVEST_topics require_relative 'author_format' # author_format.rb + include SiSU_Viz class Songsheet - def initialize(opt) - @opt=opt + @@the_idx_topics={} + def initialize(opt,env) + @opt,@env=opt,env @file_list=opt.files - @env=SiSU_Env::Info_env.new end def songsheet - files,idx_array=[],[] - @file_list.each do |f| - (f =~/.+?\.ss[tm]$/) \ - ? (files << f[/(.+?\.ss[tm])$/,1]) \ - : (print "not .sst or .ssm ? << #{f} >> ") - end - files.each do |filename| - file_array=[] + puts 'topics:' + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + name=y[:f] + filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|classify):(?:\s|$)/m - file_array << line + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line elsif line =~/^@\S+?:(?:\s|$)/m \ or line =~/^(?:\s*\n|%+ )/ else break end end end - idx_array=HARVEST_topics::Harvest.new(@opt,file_array,filename,idx_array).extract_harvest + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||= [] + idx_array=HARVEST_topics::Harvest.new(@opt,@env,a,filename,name,idx_array,lang).extract_harvest + end end - the_idx=HARVEST_topics::Index.new(idx_array,@@the_idx_topics).construct_book_topic_index - #HARVEST_topics::Output_index.new('',the_idx).screen_print.cycle if @opt.cmd.inspect =~/[VM]/ + the_idx=HARVEST_topics::Index.new(@opt,@env,idx_array,@@the_idx_topics).construct_book_topic_index HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet - harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" - puts "file://#{harvest_pth}/harvest_topics.html" - puts "file://#{@env.path.pwd}/harvest_topics.html" if @opt.cmd.inspect =~/M/ end end class Harvest - def initialize(opt,data,filename,idx_array) - @opt,@data,@filename,@idx_array=opt,data,filename,idx_array + 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 end def extract_harvest - data,filename,idx_array=@data,@filename,@idx_array + data,filename,name,idx_array,lang=@data,@filename,@name,@idx_array,@lang @idx_lst,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil rgx={} rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m @@ -128,118 +127,130 @@ module HARVEST_topics and @idx_list creator=FORMAT::Author.new(@author_format.strip).author_details @authors,@authorship=creator[:authors],creator[:authorship] - file=if filename=~/~[a-z]{2,3}\.ss[mt]$/ - lang='.' + /~([a-z]{2,3})\.ss[mt]$/.match(filename)[1] - filename.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + else + name.sub(/\.ss[mt]$/,'') + end + page=if @env.output_dir_structure.by_language_code? + #fix + end + page=if @env.output_dir_structure.by_language_code? + "#{lang}/sisu_manifest.html" else - lang='' - filename.sub(/\.ss[mt]$/,'') + "sisu_manifest.#{lang}.html" end - page="sisu_manifest#{lang}.html" - idx_array <<=if @idx_list =~/;/ + idx_array[lang] <<=if @idx_list =~/;/ g=@idx_list.scan(/[^;]+/) idxl=[] g.each do |i| i.strip! - idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page } + idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page, lang: lang } end idxl - else { filename: filename, file: file, rough_idx: @idx_list, title: @fulltitle, author: creator, page: page } + else { filename: filename, file: file, rough_idx: @idx_list, title: @fulltitle, author: creator, page: page, lang: lang } end else p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/ end - idx_array.flatten! + idx_array[lang].flatten! idx_array end end class Index - def initialize(idx_array,the_idx) - @idx_array,@the_idx=idx_array,the_idx + 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 end def capital(txt) txt[0].chr.capitalize + txt[1,txt.length] end - def contents(hash,idx) + def contents(lang,hash,idx) names='' idx[:author][:last_first_format_a].each do |n| s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - names += %{#{n}, } + names=if @env.output_dir_structure.by_language_code? + names += %{#{n}, } + else + names += %{#{n}, } + end end hash << { filename: idx[:filename], file: idx[:file], author: names, title: idx[:title], page: idx[:page] } end def construct_book_topic_index idx_array=@idx_array - 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[lv0].class==NilClass - @@the_idx_topics[lv0]={ md: [] } + 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 end - @lv0=lv0 if lev0.length==1 - j=@@the_idx_topics[lv0][:md] - contents(j,idx) if idx_lst_alt.length - 1 == t - end - when 1 - lev1=idx_lst_alt[t] - lev1.each do |lv1| - lv1=capital(lv1) - if @@the_idx_topics[@lv0][lv1].class==NilClass - @@the_idx_topics[@lv0][lv1]={ md: [] } + 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: [] } + 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 - @lv1=lv1 if lev1.length==1 - j=@@the_idx_topics[@lv0][lv1][:md] - contents(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[@lv0][@lv1][lv2].class==NilClass - @@the_idx_topics[@lv0][@lv1][lv2]={ md: [] } + 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 + @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 - @lv2=lv2 if lev2.length==1 - j=@@the_idx_topics[@lv0][@lv1][lv2][:md] - contents(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[@lv0][@lv1][@lv2][lv3].class==NilClass - @@the_idx_topics[@lv0][@lv1][@lv2][lv3]={ md: [] } + 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 + @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 - @lv3=lv3 if lev3.length==1 - j=@@the_idx_topics[@lv0][@lv1][@lv2][lv3][:md] - contents(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[@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass - @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4]={ md: [] } + 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: [] } + 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 - @lv4=lv4 if lev4.length==1 - j=@@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4][:md] - contents(j,idx) if idx_lst_alt.length - 1 == t end end end @@ -249,25 +260,42 @@ module HARVEST_topics end end class Output_index + require_relative 'i18n' # i18n.rb + require 'fileutils' + include FileUtils def initialize(opt,the_idx) @opt,@the_idx=opt,the_idx @env=SiSU_Env::Info_env.new - @rc=Get_init.instance.sisu_yaml.rc + @rc=SiSU_Env::Get_init.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] @letter=@alph.shift @vz=SiSU_Env::Get_init.instance.skin end def html_file_open - @output={} - harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" - @output[:html]=File.new("#{harvest_pth}/harvest_topics.html",'w') - if @opt.cmd.inspect =~/-M/ - @output[:html_mnt]=File.new("#{@env.path.pwd}/harvest_topics.html",'w') + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by_language_code? + harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/#{lng}/manifest" + file="#{harvest_pth}/topics.html" + else @env.output_dir_structure.by_filetype? + harvest_pth="#{@env.path.webserv}/#{@opt.base_stub}/manifest" + file="#{harvest_pth}/topics.#{lng}.html" + end + mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) + puts "file://#{file}" + @output[lng][:html]=File.new(file,'w') + if @opt.cmd.inspect =~/-M/ + @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') + end end end def html_file_close - @output[:html].close - @output[:html_mnt].close if @output[:html_mnt].class==File + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close if @output[lng][:html_mnt].class==File + end end def html_print def html_songsheet @@ -278,19 +306,36 @@ module HARVEST_topics html_tail html_file_close end - def html_head_adjust(type='') - css_path=if @env.output_dir_structure.by_language_code? + def html_head_adjust(lng,type='') + css_path,authors='','' + if @env.output_dir_structure.by_language_code? css_path=(type !~/maintenance/) \ ? '../../_sisu/css/harvest.css' \ : 'harvest.css' + authors='authors.html' 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? css_path=(type !~/maintenance/) \ ? '../_sisu/css/harvest.css' \ : 'harvest.css' + authors="authors.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lng| + if @env.output_dir_structure.by_language_code? + harvest_pth="../../#{lng}/manifest" + file="#{harvest_pth}/topics.html" + else @env.output_dir_structure.by_filetype? + harvest_pth='.' + file="#{harvest_pth}/topics.#{lng}.html" + end + l=ln[lng][:t] + harvest_languages += %{#{l}   } end sv=SiSU_Env::Info_version.instance.get_version <

SiSU Metadata Harvest - Topics

-

[ HOME ] also see SiSU Metadata Harvest - Authors

+

[ HOME ] also see SiSU Metadata Harvest - Authors

#{@env.widget_static.search_form}


+

#{harvest_languages}

+
WOK end def html_head - @output[:html_mnt] << html_head_adjust('maintenance') if @opt.cmd.inspect =~/M/ - @output[:html] << html_head_adjust + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.cmd.inspect =~/M/ + @output[lng][:html] << html_head_adjust(lng) + end end def html_alph a=[] a << '

' @alph.each do |x| - a << (x =~/[0-9]/) \ + a << ((x =~/[0-9]/) \ ? '' \ - : %{#{x}, } + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a if @opt.cmd.inspect =~/M/ + @output[lng][:html] << a end - @output[:html_mnt] << a if @opt.cmd.inspect =~/M/ - @output[:html] << a.join end def html_tail - a=[] - a <<< @@ -346,107 +397,116 @@ WOK WOK - @output[:html_mnt] << a if @output[:html_mnt].class==File - @output[:html] << a + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a if @output[lng][:html_mnt].class==File + @output[lng][:html] << a + end end - def do_html(html) - @output[:html] << html + def do_html(lng,html) + @output[lng][:html] << html end - def do_html_maintenance(html) - @output[:html_mnt] << html if @output[:html_mnt].class==File + def do_html_maintenance(lng,html) + @output[lng][:html_mnt] << html if @output[lng][:html_mnt].class==File end - def do_string(attrib,string) + def do_string(lng,attrib,string) html=%{

#{string}

} - do_html(html) - do_html_maintenance(html) if @output[:html_mnt].class==File + do_html(lng,html) + do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File end - def do_string_default(attrib,string) + def do_string_default(lng,attrib,string) html=%{

#{string}

} - do_html(html) + do_html(lng,html) end - def do_string_maintenance(attrib,string) + def do_string_maintenance(lng,attrib,string) html=%{

#{string}

} - do_html_maintenance(html) if @output[:html_mnt].class==File + do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File end - def do_string_name(attrib,string) + def do_string_name(lng,attrib,string) f=/^(\S)/.match(string)[1] if @letter < f while @letter < f if @alph.length > 0 @letter=@alph.shift - if @output[:html_mnt].class==File - @output[:html_mnt] << %{\n

#{@letter}

} + if @output[lng][:html_mnt].class==File + @output[lng][:html_mnt] << %{\n

#{@letter}

} end - @output[:html] << %{\n

#{@letter}

} + @output[lng][:html] << %{\n

#{@letter}

} else break end end end name=string.strip.gsub(/\s+/,'_') html=%{

#{string}

} - do_html(html) - do_html_maintenance(html) if @output[:html_mnt].class==File + do_html(lng,html) + do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File end - def do_array(lv,array) + def do_array(lng,lv,array) lv+=1 array.each do |b| - do_case(lv,b) + do_case(lng,lv,b) end end - def do_hash_md(attrib,hash) + def do_hash_md(lng,attrib,hash) if @env.output_dir_structure.by_language_code? - manifest_at=hash[:file] + '.manifest.html' + manifest_at=hash[:file] + '.html' elsif @env.output_dir_structure.by_filetype? - manifest_at=hash[:file] + '.manifest.html' + manifest_at=hash[:file] + '.' + lng + '.html' elsif @env.output_dir_structure.by_filename? manifest_at="../#{hash[:file]}/#{hash[:page]}" end html=%{#{hash[:title]} - #{hash[:author]}} - do_string_default(attrib,html) + do_string_default(lng,attrib,html) end - def do_hash_md_maintenance(attrib,hash) - if @output[:html_mnt].class==File #should not be run for presentation output + def do_hash_md_maintenance(lng,attrib,hash) + if @output[lng][:html_mnt].class==File #should not be run for presentation output html=%{[src]  #{hash[:title]} - #{hash[:author]}} - do_string_maintenance(attrib,html) + do_string_maintenance(lng,attrib,html) end end - def do_hash(lv,hash) + def do_hash(lng,lv,hash) lv+=1 key=[] hash.each_key do |m| if m == :md - do_case(lv,hash[m]) - elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page + 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('work',hash) - do_hash_md_maintenance('work',hash) + do_hash_md(lng,'work',hash) + do_hash_md_maintenance(lng,'work',hash) end end if key.length > 0 key.sort.each do |m| attrib="lev#{lv}" - lv==0 ? do_string_name(attrib,m) : do_string(attrib,m) - do_case(lv,hash[m]) + lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m) + do_case(lng,lv,hash[m]) end end end - def do_case(lv,a) + def do_case(lng,lv,a) y = a.class case when y==String attrib="lev#{lv}" - lv==0 ? do_string_name(attrib,a) : do_string(attrib,a) + lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a) when y==Array - do_array(lv,a) + do_array(lng,lv,a) when y==Hash - do_hash(lv,a) + do_hash(lng,lv,a) end end def html_body the_idx=@the_idx - the_idx.sort.each do |a| - do_case(-1,a) + the_idx.each_pair do |lng,lng_array| + lng_array.sort.each do |a| + do_case(lng,-1,a) + end end end self @@ -456,102 +516,116 @@ WOK s=' '*4 puts s*lv + string end - def do_array(lv,array) + def do_array(lng,lv,array) lv+=1 array.each do |b| - do_case(lv,b) + do_case(lng,lv,b) end end - def do_hash_md(lv,hash) + def do_hash_md(lng,lv,hash) string=hash[:title] + ' - ' + hash[:author] - do_string(lv,string) + do_string(lng,lv,string) end - def do_hash(lv,hash) + def do_hash(lng,lv,hash) lv+=1 key=[] hash.each_key do |m| if m == :md - do_case(lv,hash[m]) - elsif m != :title and m != :author and m != :filename and m != :file and m != :rough_idx and m != :page + 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(lv,hash) + do_hash_md(lng,lv,hash) end end if key.length > 0 key.sort.each do |m| - do_string(lv,m) - do_case(lv,hash[m]) + do_string(lng,lv,m) + do_case(lng,lv,hash[m]) end end end - def do_case(lv,a) + def do_case(lng,lv,a) s=' '*4 y = a.class case when y==String - do_string(lv,a) + do_string(lng,lv,a) when y==Array - do_array(lv,a) + do_array(lng,lv,a) when y==Hash - do_hash(lv,a) + do_hash(lng,lv,a) end end def cycle the_idx=@the_idx - the_idx.each do |a| - do_case(-1,a) + 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(lv,string) + def do_string(lng,lv,string) s=' '*4 puts s*lv + string end - def do_array(lv,array) + def do_array(lng,lv,array) lv+=1 array.each do |b| - do_case(lv,b) + do_case(lng,lv,b) end end - def do_hash_md(lv,hash) + def do_hash_md(lng,lv,hash) string=hash[:title] + ' - ' + hash[:author] - do_string(lv,string) + do_string(lng,lv,string) end - def do_hash(lv,hash) + def do_hash(lng,lv,hash) lv+=1 hash.each_key do |m| if m == :md - do_case(lv,hash[m]) + 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(lv,m) - do_case(lv,hash[m]) + 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(lv,hash) + do_hash_md(lng,lv,hash) else end end end end - def do_case(lv,a) + def do_case(lng,lv,a) s=' '*4 y = a.class case when y==String - do_string(lv,a) + do_string(lng,lv,a) when y==Array - do_array(lv,a) + do_array(lng,lv,a) when y==Hash - do_hash(lv,a) + do_hash(lng,lv,a) end end def cycle the_idx=@the_idx - the_idx.each do |a| - do_case(-1,a) + the_idx.keys.each do |lng| + the_idx[lng].each do |a| + do_case(lng,-1,a) + end end end self diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 5eac0b03..7b847d4f 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -290,13 +290,13 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end if @opt.act[:harvest] require_relative 'harvest' # harvest.rb + SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ require_relative 'sst_convert_markup' # sst_convert_markup.rb elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ - @@tell=SiSU_Screen::Ansi.new(@opt.cmd) @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX flag=SiSU_Env::Info_processing_flag.new if @opt.cmd =~/[vVM]/ #% version information -- cgit v1.2.3 From 74c346fa583cd93f05b7701dbce2d5bb178ee5c9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 Jun 2011 23:01:57 -0400 Subject: v3: cgi, sample search form reverted to '#!/usr/bin/env ruby' * appears to be a fix in libdbi-ruby1.9.1, see comments in sisu-3.0.8 changelog --- data/doc/sisu/CHANGELOG_v3 | 11 ++++++++++- lib/sisu/v3/cgi.rb | 6 +++--- lib/sisu/v3/cgi_pgsql.rb | 2 +- lib/sisu/v3/cgi_sqlite.rb | 3 +-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index bb9309f5..89d301a9 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -26,6 +26,14 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz * produce authors and topics lists for the documents that are available, according to availability in each language + * cgi generated sample search form + * use ruby 1.9.2 shebang/header (sisu-pgsql, sisu-sqlite) recent upload + of libdbi-ruby1.9.1 fixes bug reported as #596103 (against + libdbd-pg-ruby1.9.1), search forms (pgsql & sqlite) can now use ruby + 1.9.2, so cgi headers changed back to #!/usr/bin/env ruby [however must + use ruby >=1.9.2] (from #!/usr/bin/ruby1.8) [see sisu-3.0.8 NOTE & + "sample search form" solution, (now superseded)] + * options * restrict glob rule checks to when --glob (-G) or --find (-f) requested * carry information on document language (from filename and or directory @@ -183,7 +191,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.8.orig.tar.gz * title, src_filename and language_document_char fields mandatory (title, title_main, src_filename, language_document_char) - * NOTE: cgi sample search form caught by Ruby/DBI libdbi-ruby1.9.1 reported + * NOTE: [libdbi-ruby1.9.1 fixed in unstable 2011-06-06, & for sisu-3.0.12] + cgi sample search form caught by Ruby/DBI libdbi-ruby1.9.1 reported reported as libdbd-pg-ruby1.9.1 bug #596103, where "select_all fails". The cgi sample search scripts for postgresql and sqlite3 are almost identical, both work in ruby 1.8.7, both have the same error in ruby 1.9.2... a very diff --git a/lib/sisu/v3/cgi.rb b/lib/sisu/v3/cgi.rb index f1d628d2..bdecb6ed 100644 --- a/lib/sisu/v3/cgi.rb +++ b/lib/sisu/v3/cgi.rb @@ -64,14 +64,14 @@ module SiSU_CGI class SiSU_search def initialize(opt) @opt=opt - @webserv=@opt.files[0].to_s.strip #verify @opt.files[0].class + @webserv=@opt.files[0].to_s.strip end def search_info a=%{ For help on sisu search, type: sisu --help search - } - SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey + } + SiSU_Screen::Ansi.new(@opt.cmd,a).print_grey end def read SiSU_CGI_sqlite::SiSU_search_sqlite.new(@opt,@webserv).sqlite diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index aa4a02e8..41be70d4 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -120,7 +120,7 @@ module SiSU_CGI_pgsql end def header0 <<-WOK_SQL -#!/usr/bin/ruby1.8 +#!/usr/bin/env ruby =begin #{about} * Description: generates naive cgi search form for search of sisu database (pgsql) diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index c0ecaeb5..64124cc8 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -88,7 +88,6 @@ module SiSU_CGI_sqlite f2 << %{ when /#{Db[:name_prefix]}#{x}/; ''\n} end f2 << " end\n" - #f3 f3 << %{ db_name='sisu_sqlite.db'\n} f3 << %{ db_sqlite=case cgi['db']\n} serve.each do |x| @@ -120,7 +119,7 @@ module SiSU_CGI_sqlite end def header0 <<-WOK_SQL -#!/usr/bin/ruby1.8 +#!/usr/bin/env ruby =begin #{about} * Description: generates naive cgi search form for search of sisu database (sqlite) -- cgit v1.2.3 From 5a1e3ba75950045f600e5667fb09a1131da2b790 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 Jun 2011 23:09:12 -0400 Subject: v3: cgi, sample search form, force utf-8 character encoding to avoid issues --- data/doc/sisu/CHANGELOG_v3 | 3 +++ lib/sisu/v3/cgi_sql_common.rb | 53 ++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 89d301a9..5af32fc2 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -33,6 +33,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.12.orig.tar.gz 1.9.2, so cgi headers changed back to #!/usr/bin/env ruby [however must use ruby >=1.9.2] (from #!/usr/bin/ruby1.8) [see sisu-3.0.8 NOTE & "sample search form" solution, (now superseded)] + * force utf-8 character encoding to avoid issues, fix + (incompatible character encodings: UTF-8 and US-ASCII) + * correction of a variable name, fix * options * restrict glob rule checks to when --glob (-G) or --find (-f) requested diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index c782d48f..8dce0743 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -842,6 +842,15 @@ module SiSU_CGI_sql def path_html_seg(fn,ln=nil) "#{@hostpath}/#{ln}/html/#{fn}" end + def path_toc(fn,ln=nil) + "#{path_html_seg(fn,ln)}/toc.html" + end + def path_filename(fn,seg,ln=nil) + "#{path_html_seg(fn,ln)}/#{seg}.html" + end + def path_endnotes(fn,ln=nil) + "#{path_html_seg(fn,ln)}/endnotes.html" + end def path_html_doc(fn,ln=nil) "#{@hostpath}/#{ln}/html/#{fn}.html" end @@ -849,25 +858,43 @@ module SiSU_CGI_sql when /filetype/ <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/manifest/#{fn}.html" + "#{@hostpath}/manifest/#{fn}.#{ln}.html" end def path_html_seg(fn,ln=nil) "#{@hostpath}/html/#{fn}" end + def path_toc(fn,ln=nil) + "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + end + def path_filename(fn,seg,ln=nil) + "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + end + def path_endnotes(fn,ln=nil) + "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + end def path_html_doc(fn,ln=nil) - "#{@hostpath}/html/#{fn}.html" + "#{@hostpath}/html/#{fn}.#{ln}.html" end WOK_SQL else <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/#{fn}/manifest.html" + "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" end def path_html_seg(fn,ln=nil) "#{@hostpath}/#{fn}" end + def path_toc(fn,ln=nil) + "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + end + def path_filename(fn,seg,ln=nil) + "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + end + def path_endnotes(fn,ln=nil) + "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + end def path_html_doc(fn,ln=nil) - "#{@hostpath}/#{fn}/doc.html" + "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" end WOK_SQL end @@ -890,7 +917,7 @@ module SiSU_CGI_sql can_txt_srch=(cgi['view']=~/index/) \ ? %{search } \ : %{search } - title=%{toc html #{ti} [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{toc html #{ti} [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ ? '

'+title \ : '
'+title @@ -927,7 +954,7 @@ module SiSU_CGI_sql matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ ? (c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1})) \ : c['body'] - %{

ocn #{c['ocn']}:

#{matched_para}} + %{

ocn #{c['ocn']}:

#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}

ocn #{c['ocn']}:#{c['body']}} end @@ -935,7 +962,7 @@ module SiSU_CGI_sql output=title+text else #elsif cgi['view']=~/index/ #% idx body if c['suffix'] !~/1/ #seg - index=%{#{c['ocn']}, } if @text_search_flag + index=%{#{c['ocn']}, } if @text_search_flag elsif c['suffix'] =~/1/ #doc #FIX index=%{#{c['ocn']}, } end @@ -981,9 +1008,9 @@ module SiSU_CGI_sql if e['metadata_tid'].to_i != oldtid.to_i ti=e['title'] can_txt_srch=(cgi['view']=~/index/) \ - ? %{search } \ - : %{search } - title=%{


toc html #{ti} [#{c['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ + ? %{search } \ + : %{search } + title=%{

toc html #{ti} [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -994,10 +1021,10 @@ module SiSU_CGI_sql matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ ? matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) \ : e['body'] - output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} + output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes @counter_endn_ocn+=1 - output=%{#{title}#{e['nr']}#{e['ocn']}], } + output=%{#{title}#{e['nr']}#{e['ocn']}], } end @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ @@ -1021,7 +1048,7 @@ module SiSU_CGI_sql ? dbi_statement.pre_next(true,@image_src).to_s \ : dbi_statement.pre_next(false,@image_src).to_s limit=dbi_statement.sql_match_limit.to_s - cgi.out{@header + @counters_txt + @counters_endn + canned + @body_main + @endnotes + canned + @tail} #% print cgi_output_header+counters+body+endnotes + cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes end rescue Exception => e s='
' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
-- 
cgit v1.2.3