summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2009-01-02 00:22:47 +0000
committerRalph Amissah <ralph@amissah.com>2009-01-02 00:22:47 +0000
commitc0f250241b62175e242715ef5ea93b96935635b2 (patch)
tree41e665a396d47940cd9ab20cfe193f760abf7773
parentyear rollover (diff)
downloadsisu-c0f250241b62175e242715ef5ea93b96935635b2.zip
sisu-c0f250241b62175e242715ef5ea93b96935635b2.tar.xz
harvest, other language filenames
-rw-r--r--lib/sisu/v0/harvest_authors.rb18
-rw-r--r--lib/sisu/v0/harvest_topics.rb26
2 files changed, 28 insertions, 16 deletions
diff --git a/lib/sisu/v0/harvest_authors.rb b/lib/sisu/v0/harvest_authors.rb
index 0cecd9d..151696c 100644
--- a/lib/sisu/v0/harvest_authors.rb
+++ b/lib/sisu/v0/harvest_authors.rb
@@ -136,8 +136,15 @@ module HARVEST_authors
if @title and @author_format #and @orig_pub (publication details)
creator=FORMAT::Author.new(@author_format.strip).author_details
@authors,@authorship=creator[:authors],creator[:authorship]
- file=filename.sub(/\.ss[mt]$/,'')
- idx_array <<= { :filename => filename, :file => file, :orig_pub => @orig_pub, :date => @date, :title => @fulltitle, :author => creator }
+ 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]$/,'')
+ else
+ lang=''
+ filename.sub(/\.ss[mt]$/,'')
+ end
+ page="sisu_manifest#{lang}.html"
+ idx_array <<= { :filename => filename, :file => file, :orig_pub => @orig_pub, :date => @date, :title => @fulltitle, :author => creator, :page => page }
else
#p "missing author field: #@filename title: #@title; author: #@author_format; idx: #@orig_pub"
end
@@ -161,7 +168,7 @@ module HARVEST_authors
if @@the_idx_authors[author].class==NilClass
@@the_idx_authors[author]={:md => []}
end
- @@the_idx_authors[author][:md] << { :filename => idx[:filename], :file => idx[:file], :author => idx[:author], :title => idx[:title], :date => idx[:date] }
+ @@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
@@ -172,7 +179,6 @@ module HARVEST_authors
@opt,@the_idx=opt,the_idx
@env=SiSU_Env::Info_env.new
@rc=Get_init.instance.yamlrc
- @page='sisu_manifest.html'
@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
@@ -295,9 +301,9 @@ 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]}/#{@page}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
+ work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
works<<=if @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]}/#{@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://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])
else work
end
end
diff --git a/lib/sisu/v0/harvest_topics.rb b/lib/sisu/v0/harvest_topics.rb
index 7e11dbf..11d7aa9 100644
--- a/lib/sisu/v0/harvest_topics.rb
+++ b/lib/sisu/v0/harvest_topics.rb
@@ -132,16 +132,23 @@ module HARVEST_topics
if @title and @author_format and @idx_list
creator=FORMAT::Author.new(@author_format.strip).author_details
@authors,@authorship=creator[:authors],creator[:authorship]
- file=filename.sub(/\.ss[mt]$/,'')
+ 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]$/,'')
+ else
+ lang=''
+ filename.sub(/\.ss[mt]$/,'')
+ end
+ page="sisu_manifest#{lang}.html"
idx_array <<=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 }
+ idxl << { :filename => filename, :file => file, :rough_idx => i, :title => @fulltitle, :author => creator, :page => page}
end
idxl
- else { :filename => filename, :file => file, :rough_idx => @idx_list, :title => @fulltitle, :author => creator }
+ else { :filename => filename, :file => file, :rough_idx => @idx_list, :title => @fulltitle, :author => creator, :page => page }
end
else
p "missing author field: #@filename title: #@title; author: #@author_format; idx: #@idx_list"
@@ -164,7 +171,7 @@ module HARVEST_topics
s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
names += %{<a href="harvest_authors.html##{s}">#{n}</a>, }
end
- hash << { :filename => idx[:filename], :file => idx[:file], :author => names, :title => idx[:title] }
+ 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
@@ -250,7 +257,6 @@ module HARVEST_topics
@opt,@the_idx=opt,the_idx
@env=SiSU_Env::Info_env.new
@rc=Get_init.instance.yamlrc
- @page='sisu_manifest.html'
@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
@@ -382,12 +388,12 @@ WOK
end
end
def do_hash_md(attrib,hash)
- html=%{<a href="../#{hash[:file]}/#{@page}">#{hash[:title]}</a> - #{hash[:author]}}
+ html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
do_string_default(attrib,html)
end
def do_hash_md_maintenance(attrib,hash)
if @output[:html_mnt].class == File #should not be run for presentation output
- html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{@page}">#{hash[:title]}</a> - #{hash[:author]}}
+ html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
do_string_maintenance(attrib,html)
end
end
@@ -397,7 +403,7 @@ WOK
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
+ 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)
@@ -460,7 +466,7 @@ WOK
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
+ 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)
@@ -514,7 +520,7 @@ WOK
if m == :md
do_case(lv,hash[m])
else
- if m != :title and m != :author and m != :filename and m != :file and m != :rough_idx
+ 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])
elsif m == :title