aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal_idx.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-12-02 23:54:23 -0500
committerRalph Amissah <ralph@amissah.com>2008-12-02 23:54:23 -0500
commit0e6fc15ada3c5d9a86b227163f35a54993b32529 (patch)
tree90ac98f2dadf8a2731fac4921fb5d9263eeedeb9 /lib/sisu/v0/dal_idx.rb
parentsha256 for 0.69.4 (diff)
sisu harvest, introduce module along with header syntax addition & modification
* sisu markup, additional header and new format rule: * @creator: / @author: header field, introduced author name format rules for more usable metadata harvesting: surname comma other names, additional authors separated by semi-colon * param added meta-tag, @topic_register: formatting topic levels are separated from sub-levels by a colon, a semi-colon separates main topics if there are multiple topics at lowest sub-level, a pipe can be used to create multiple headings * harvest module, harvests metadata from document set currently extracts: (i) authors and their writings from document set; (ii) topics and associated writings from document set (topics use topic_register header). harvest (when run against documents common to a directory of a site) extracts metadata and organises the documents on a site by author and topic information provided (there is a new "topic_register" header, with formatting rules similar to those of the book index), results are placed in [output_path]/sisu_site_metadata. sisu --harvest *.sst * by author (see change in param @creator: / @author: header field) * by topic / subject index (see addition in param of @topic_register: header field) initially there should be an example samples here: http://www.jus.uio.no/sisu/sisu_site_metadata/harvest_authors.html http://www.jus.uio.no/sisu/sisu_site_metadata/harvest_topics.html together with update markup source files The authors and their writings list will be made to take on a more biblographical form, with the use of additional fields as required. (concept example, suitable for medium sized sites [to remove size constraint: implement SQL equivalent]) make feature more robust * css, for harvest output added * remote placement of sisu_site_metadata (output produced by metadata harvest) * sisu markup, update document samples accordingly * tidy copyright marks in program headers, remove repetition of dates [version bump because formatting rule introduced to author / creator header - where new site metadata harvest feature is used, (at present changes changes should not be noticed except when using metadata harvest)]
Diffstat (limited to 'lib/sisu/v0/dal_idx.rb')
-rw-r--r--lib/sisu/v0/dal_idx.rb38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb
index 0b5c74c7..8633579f 100644
--- a/lib/sisu/v0/dal_idx.rb
+++ b/lib/sisu/v0/dal_idx.rb
@@ -4,7 +4,6 @@
* Name: SiSU
* Description: a framework for document structuring, publishing and search
- #___#
* Author: Ralph Amissah
@@ -15,8 +14,7 @@
SiSU, a framework for document structuring, publishing and search
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007 Ralph Amissah
+ Copyright (C) Ralph Amissah
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
@@ -137,22 +135,22 @@ module SiSU_book_index
i.strip!
i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
x=if idx_lst.length == 1 or idx_lst[0].gsub(/\+\d+/,'') == i
- @the_idx[use]['a1']=[] unless @the_idx[use]['a1'] and defined? @the_idx[use]['a1']
+ @the_idx[use]['term_node_lev1']=[] unless @the_idx[use]['term_node_lev1'] and defined? @the_idx[use]['term_node_lev1']
x=if r
- @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
+ @the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
"#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
else
- @the_idx[use]['a1'] << { :ocn => idx[:ocn], :seg => idx[:seg] }
+ @the_idx[use]['term_node_lev1'] << { :ocn => idx[:ocn], :seg => idx[:seg] }
"#{i} #{idx[:ocn]}"
end
else
- @the_idx[use]['b1']={} unless @the_idx[use]['b1'] and defined? @the_idx[use]['b1']
- @the_idx[use]['b1'][i]=[] unless @the_idx[use]['b1'][i] and defined? @the_idx[use]['b1'][i]
+ @the_idx[use]['term_node_lev2']={} unless @the_idx[use]['term_node_lev2'] and defined? @the_idx[use]['term_node_lev2']
+ @the_idx[use]['term_node_lev2'][i]=[] unless @the_idx[use]['term_node_lev2'][i] and defined? @the_idx[use]['term_node_lev2'][i]
x=if r
- @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
+ @the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] }
"#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
else
- @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] }
+ @the_idx[use]['term_node_lev2'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] }
"#{idx_lst[0]}:#{i} #{idx[:ocn]}"
end
end
@@ -203,8 +201,8 @@ module SiSU_book_index
p 'array error? -->'
print x
elsif x.class == Hash
- if x['a1'].class == Array
- x['a1'].each do |a|
+ if x['term_node_lev1'].class == Array
+ x['term_node_lev1'].each do |a|
if a[:range]
@idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, }
@idx[:html][@q]=@idx[:html][@q] + %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:range]}</a>, }
@@ -218,11 +216,11 @@ module SiSU_book_index
end
@idx[:html][@q]=@idx[:html][@q] + '</p>'
end
- if x['b1']
- m=x['b1']
+ if x['term_node_lev2']
+ m=x['term_node_lev2']
m=m.sort
m.each do |k,y|
- if k !~/a1/
+ if k !~/term_node_lev1/
@idx[:sst][@o]=@idx[:sst][@o] + %{#{k}, }
@idx[:html][@q]=@idx[:html][@q] + %{\n<p class="book_index_lev2">#{k}, }
print "\n\t" + k + ', ' if @md.cmd =~/V/
@@ -259,8 +257,8 @@ module SiSU_book_index
p 'array error? -->'
print x
elsif x.class == Hash
- if x['a1'].class == Array
- x['a1'].each do |a|
+ if x['term_node_lev1'].class == Array
+ x['term_node_lev1'].each do |a|
if a[:range]
print a[:range] + ', '
elsif a[:ocn]
@@ -269,11 +267,11 @@ module SiSU_book_index
end
end
end
- if x['b1']
- m=x['b1']
+ if x['term_node_lev2']
+ m=x['term_node_lev2']
m=m.sort
m.each do |k,y|
- if k !~/a1/
+ if k !~/term_node_lev1/
print "\n\t" + k + ', '
#p y
y.each do |z|