aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-04-19 21:39:06 -0400
committerRalph Amissah <ralph@amissah.com>2011-04-19 21:39:06 -0400
commitcc7bc6de70ca4dcfeee781803bc6a43dc7c273ea (patch)
tree02fb16f0a4502293d09d01ae30b58942c6ad726e
parentv3: param, md remove md.cmd and md.mod shortcut methods, use use md.opt (diff)
v3: harvest, sysenv, place with document manifests, variable directory path
* sysenv, variable directory path fixing (language, filetype, filname), making the stub for at least manifest and html available early for processing that do not or should not need to process individual markup files completely, such as the cgi search form and harvest * harvest * place with document manifests * variable directory path fixing (language, filetype, filname)
-rw-r--r--data/doc/sisu/CHANGELOG_v311
-rw-r--r--lib/sisu/v3/harvest.rb3
-rw-r--r--lib/sisu/v3/harvest_authors.rb39
-rw-r--r--lib/sisu/v3/harvest_topics.rb31
-rw-r--r--lib/sisu/v3/sysenv.rb30
5 files changed, 94 insertions, 20 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 9f06f48b..7dc4c980 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -41,7 +41,16 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.7.orig.tar.gz
* some option setting moved to options
* favor use of opt.act over opt.cmd where appropriate
- * sysenv, odf:odt paths adjusted for changes in maintenance and odt.zip
+ * sysenv
+ * variable directory path fixing (language, filetype, filname), making
+ the stub for at least manifest and html available early for processing
+ that do not or should not need to process individual markup files
+ completely, such as the cgi search form and harvest
+ * odf:odt paths adjusted for changes in maintenance and odt.zip
+
+ * harvest
+ * place with document manifests
+ * variable directory path fixing (language, filetype, filname)
* cgi, sample-search-form
* results still not right, (ruby1.9.2 libraries? double check script)
diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb
index 117028e2..aaec9046 100644
--- a/lib/sisu/v3/harvest.rb
+++ b/lib/sisu/v3/harvest.rb
@@ -96,6 +96,7 @@ require_relative 'sysenv' # sysenv.rb
argv=$*
opt=SiSU_commandline::Options.new(argv)
argv.shift
-mkdir_p(@env.path.output_md_harvest) unless FileTest.directory?(@env.path.output_md_harvest)
+harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}"
+mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)
cases(opt)
__END__
diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb
index dc36a06f..75d2a810 100644
--- a/lib/sisu/v3/harvest_authors.rb
+++ b/lib/sisu/v3/harvest_authors.rb
@@ -89,7 +89,8 @@ module HARVEST_authors
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
- puts "file://#{@env.path.output_md_harvest}/harvest_authors.html"
+ 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
@@ -174,7 +175,8 @@ module HARVEST_authors
end
def html_file_open
@output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w')
+ 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
@@ -193,9 +195,19 @@ module HARVEST_authors
html_file_close
end
def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
+ css_path=if @env.output_dir_structure.by_language_code?
+ css_path=(type !~/maintenance/) \
+ ? '../../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ elsif @env.output_dir_structure.by_filetype?
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ elsif @env.output_dir_structure.by_filename?
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ end
sv=SiSU_Env::Info_version.instance.get_version
<<WOK
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -286,9 +298,22 @@ WOK
@output[:html] << x
works=[]
a[1][:md].each do |x|
- work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
+ 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]}"
+ 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[:html_mnt].class==File) \
- ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \
+ ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{manifest_at_local}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \
: work
end
works.sort_by {|x| x[0]}.each do |x|
diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb
index f00fb7f3..3ca72326 100644
--- a/lib/sisu/v3/harvest_topics.rb
+++ b/lib/sisu/v3/harvest_topics.rb
@@ -90,7 +90,8 @@ module HARVEST_topics
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]/
HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet
- puts "file://#{@env.path.output_md_harvest}/harvest_topics.html"
+ 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
@@ -258,7 +259,8 @@ module HARVEST_topics
end
def html_file_open
@output={}
- @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_topics.html",'w')
+ 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')
end
@@ -277,9 +279,19 @@ module HARVEST_topics
html_file_close
end
def html_head_adjust(type='')
- css_path=(type !~/maintenance/) \
- ? '../_sisu/css/harvest.css' \
- : 'harvest.css'
+ css_path=if @env.output_dir_structure.by_language_code?
+ css_path=(type !~/maintenance/) \
+ ? '../../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ elsif @env.output_dir_structure.by_filetype?
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ elsif @env.output_dir_structure.by_filename?
+ css_path=(type !~/maintenance/) \
+ ? '../_sisu/css/harvest.css' \
+ : 'harvest.css'
+ end
sv=SiSU_Env::Info_version.instance.get_version
<<WOK
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -382,7 +394,14 @@ WOK
end
end
def do_hash_md(attrib,hash)
- html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
+ if @env.output_dir_structure.by_language_code?
+ manifest_at=hash[:file] + '.manifest.html'
+ elsif @env.output_dir_structure.by_filetype?
+ manifest_at=hash[:file] + '.manifest.html'
+ elsif @env.output_dir_structure.by_filename?
+ manifest_at="../#{hash[:file]}/#{hash[:page]}"
+ end
+ html=%{<a href="#{manifest_at}">#{hash[:title]}</a> - #{hash[:author]}}
do_string_default(attrib,html)
end
def do_hash_md_maintenance(attrib,hash)
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index e3aee003..6f69296a 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -902,6 +902,23 @@ module SiSU_Env
@stub_src= @stub_pwd + '/src'
@stub_pod= @stub_pwd + '/pod'
@stub_md= @stub_pwd + '/sisu_site_metadata'
+ pt=Pathname.new(Dir.pwd)
+ stub=if output_dir_structure.by_language_code?
+ stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(en|fr|es)$)/
+ lng=pt.split[-1].to_s
+ lng_part='/' + lng
+ base=pt.split[0].split[-1].to_s
+ else
+ lng_part='/' + 'en' #fix default language
+ base=pt.split[-1].to_s
+ end
+ base + lng_part
+ elsif output_dir_structure.by_filetype?
+ pt.split[-1].to_s
+ elsif output_dir_structure.by_filename?
+ ''
+ end
+ @stub_set_manifest=stub + '/manifest'
end
def user
@sys.user
@@ -968,8 +985,8 @@ module SiSU_Env
def stub_pwd #200412
@stub_pwd
end
- def stub_md_harvest
- @stub_md
+ def stub_md_harvest #watch
+ @stub_set_manifest
end
def stub_src
@stub_src
@@ -1387,6 +1404,9 @@ WOK
def stub_manifest
@stub_manifest
end
+ def stub_set_manifest
+ @stub_set_manifest
+ end
def stub_src
@stub_src
end
@@ -1394,7 +1414,7 @@ WOK
@stub_pod
end
def stub_md_harvest
- @stub_md
+ @stub_set_manifest
end
def etc
defaults[:sisu_etc] #live/dynamic
@@ -2408,7 +2428,7 @@ WOK
? "#{@env.path.output}/pod" \
: @env.path.output_pod)
@source_path_harvest=(@fnb && !(@fnb.empty?) \
- ? "#{@env.path.output}/sisu_site_metadata" \
+ ? "#{@env.path.output}/manifest" \
: @env.path.output_harvest)
@local_sisu_source=(@filetypes =~/\S/) \
? "#{@source_path}/#{@filetypes}" \
@@ -3425,7 +3445,7 @@ WOK
@env.processing_path.git + '/' + @md.fnb + '/' + ft
end
def md_harvest
- "#{output_path.base}/sisu_site_metadata"
+ manifest
end
def txt
ft='txt'