diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-12-02 23:55:55 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-12-02 23:55:55 -0500 |
commit | ca638d2857e4ae20d9c2a8d4d8a0c733c213ecd9 (patch) | |
tree | 6e353c182e8fa5fa163d4ac7864e76bcac6bbb1b /lib/sisu/v0/dal_idx.rb | |
parent | Merge branch 'upstream' into debian/sid (diff) | |
parent | sisu harvest, introduce module along with header syntax addition & modification (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v0/dal_idx.rb')
-rw-r--r-- | lib/sisu/v0/dal_idx.rb | 38 |
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| |