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.rb60
1 files changed, 46 insertions, 14 deletions
diff --git a/lib/sisu/v0/harvest_authors.rb b/lib/sisu/v0/harvest_authors.rb
index 7a5e1cea..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
@@ -168,38 +173,57 @@ module HARVEST_authors
@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
+ end
+ def html_file_open
@output={}
@output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w')
@output[:html_mnt]= if @opt.cmd.inspect =~/-M/
File.new("#{@env.path.pwd}/harvest_authors.html",'w')
else nil
end
- @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
+ end
+ def html_file_close
+ @output[:html].close
+ @output[:html_mnt].close if @output[:html_mnt].class == File
end
def html_print
def html_songsheet
+ html_file_open
html_head
html_alph
html_body
html_tail
+ html_file_close
end
def html_head_adjust(type='')
css_path=if type !~/maintenance/
'../_sisu/css/harvest.css'
else 'harvest.css'
end
+ sv=SiSU_Env::Info_version.new.get_version
<<WOK
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SiSU Metadata Harvest - Authors</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="dc.title" content= "SiSU metadata harvest, Authors - SiSU information Structuring Universe, Structured information Serialised Units, 2008" />
+<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" />
+<meta name="generator" content="#{sv[:project]} #{sv[:version]} of #{sv[:date_stamp]} (n*x and Ruby!)" />
+<link rel="generator" href="http://www.jus.uio.no/sisu/SiSU" />
<link rel="stylesheet" href="#{css_path}" type="text/css" />
+<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
+<a name="top" id="top"></a>
+<a name="up" id="up"></a>
+<a name="start" id="start"></a>
<h1>SiSU Metadata Harvest - Authors</h1>
-<p>also see <a href="harvest_topics.html">SiSU Metadata Harvest - Topics</a></p>
+<p>[<a href="../index.html">&nbsp;HOME&nbsp;</a>] also see <a href="harvest_topics.html">SiSU Metadata Harvest - Topics</a></p>
<hr />
WOK
end
@@ -222,6 +246,14 @@ WOK
def html_tail
a=[]
a <<<<WOK
+<hr />
+<a name="bottom" id="bottom"></a>
+<a name="down" id="down"></a>
+<a name="end" id="end"></a>
+<a name="finish" id="finish"></a>
+<a name="stop" id="stop"></a>
+<a name="credits"></a>
+#{@vz.credits_sisu}
</body>
</html>
WOK
@@ -263,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