aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/harvest_authors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/harvest_authors.rb')
-rw-r--r--lib/sisu/v0/harvest_authors.rb27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/sisu/v0/harvest_authors.rb b/lib/sisu/v0/harvest_authors.rb
index 9586fcc3..9678e4f7 100644
--- a/lib/sisu/v0/harvest_authors.rb
+++ b/lib/sisu/v0/harvest_authors.rb
@@ -102,16 +102,18 @@ module HARVEST_authors
end
def extract_harvest
data,filename,idx_array=@data,@filename,@idx_array
- @publication_details,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
+ @orig_pub,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil
@authors=[]
rgx={}
rgx[:author]=/^@(?:author|creator):\s+(.+)/
rgx[:title]=/^@title:\s+(.+)/
rgx[:subtitle]=/^@subtitle:\s+(.+)/
- rgx[:publication_details]=/^@original_publication_details:\s+(.+)/
+ rgx[:date]=/^@subtitle:\s+(.+)/
+ rgx[:date]=/^@date:\s+(\d{4})/
+ rgx[:orig_pub]=/^@original_publication:\s+(.+)/
data.each do |para|
- if para=~ rgx[:publication_details]
- @publication_details=rgx[:publication_details].match(para)[1]
+ if para=~ rgx[:orig_pub]
+ @orig_pub=rgx[:orig_pub].match(para)[1]
end
if para=~ rgx[:title]
@title=rgx[:title].match(para)[1]
@@ -122,19 +124,22 @@ module HARVEST_authors
if para=~ rgx[:author]
@author_format=rgx[:author].match(para)[1]
end
- break if @title and @subtitle and @author and @publication_details
+ if para=~ rgx[:date]
+ @date=rgx[:date].match(para)[1]
+ end
+ break if @title and @subtitle and @author and @date and @orig_pub
end
@fulltitle=if @subtitle
@title + ' - ' + @subtitle
else @title
end
- if @title and @author_format #and @publication_details
+ 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, :publication_details => @publication_details, :title => @fulltitle, :author => creator }
+ idx_array <<= { :filename => filename, :file => file, :orig_pub => @orig_pub, :date => @date, :title => @fulltitle, :author => creator }
else
- #p "missing author field: #@filename title: #@title; author: #@author_format; idx: #@publication_details"
+ #p "missing author field: #@filename title: #@title; author: #@author_format; idx: #@orig_pub"
end
idx_array.flatten!
idx_array
@@ -156,7 +161,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] }
+ @@the_idx_authors[author][:md] << { :filename => idx[:filename], :file => idx[:file], :author => idx[:author], :title => idx[:title], :date => idx[:date] }
end
end
@the_idx=@@the_idx_authors
@@ -290,9 +295,9 @@ WOK
@output[:html] << x
a[1][:md].each do |x|
if @output[:html_mnt].class == File
- @output[:html_mnt] << %{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;<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>}
+ @output[:html_mnt] << %{<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>}
end
- @output[:html] << %{<p class="publication"><a href="../#{x[:file]}/#{@page}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>}
+ @output[:html] << %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{@page}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>}
end
end
end