diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-03-19 22:07:29 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-03-19 22:07:33 -0400 |
commit | 6811ac91f21a434fc7d967c11e1b20f33918c6ea (patch) | |
tree | 30f39674ca96a79f8a604a9f02d571f24320e221 /lib/sisu/v3/dal_idx.rb | |
parent | v3: 3.2.0 version & changelog "opened" (diff) |
v3: 3.2 branch is main (v3dv --> v3); dev (v3dv) branch directories removed
* v3dv (3.2) "merged" into v3 (previously 3.1) (& removed)
* conf/sisu/v3dv --> conf/sisu/v3
* data/sisu/v3dv --> data/sisu/v3
* lib/sisu/v3dv --> lib/sisu/v3
* bin/sisu* (v3dv references changed to v3)
* (--dev modifier (superfluous for the time being) runs main v3 branch)
Diffstat (limited to 'lib/sisu/v3/dal_idx.rb')
-rw-r--r-- | lib/sisu/v3/dal_idx.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb index 5845437e..21567c14 100644 --- a/lib/sisu/v3/dal_idx.rb +++ b/lib/sisu/v3/dal_idx.rb @@ -56,14 +56,14 @@ ** Description: system environment, resource control and configuration details =end -module SiSU_book_index - class Book_index +module SiSU_DAL_BookIndex + class BookIndex def initialize(md,data,env=nil) @md,@data,@env=md,data,env @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ - @env ||=SiSU_Env::Info_env.new(@md.fns) + @env ||=SiSU_Env::InfoEnv.new(@md.fns) end def indexing_song data=@data @@ -75,8 +75,9 @@ module SiSU_book_index tuned_file=[] idx_array=[] data.each do |dob| - if dob.is =~/heading/ \ - and dob.ln==4 + if (dob.is ==:heading \ + || dob.is ==:heading_insert) \ + && dob.ln==4 @seg=dob.name end idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" if defined? dob.idx and not (dob.idx.nil? or dob.idx.empty?) @@ -101,21 +102,20 @@ module SiSU_book_index g=idx_list.scan(/[^;]+/) idxl=[] g.each do |i| - i.strip! + i=i.strip idxl << { rough_idx: i, ocn: ocn, seg: seg } end idxl else { rough_idx: idx_list, ocn: ocn, seg: seg } end end - idx_lst.flatten! - idx_lst + idx_lst=idx_lst.flatten end def construct_book_index(idx_array) the_idx={} idx_array.each do |idx| idx_lst=idx[:rough_idx].scan(/[^|:]+/) - idx_lst[0].strip! + idx_lst[0]=idx_lst[0].strip if idx_lst[0] =~/.+?\+\d+/ use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] else use=idx_lst[0] @@ -123,7 +123,7 @@ module SiSU_book_index use=use[0].chr.capitalize + use[1,use.length] the_idx[use]={} unless the_idx[use] and defined? the_idx[use] idx_lst.each do |i| - i.strip! + i=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]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1'] @@ -151,12 +151,12 @@ module SiSU_book_index the_idx end def clean_xml(str) - str.gsub!(/&/,'&') - str.gsub!(/\(/,'(') - str.gsub!(/\)/,')') - str.gsub!(/\*/,'*') - str.gsub!(/\+/,'+') - str.gsub!(/,/,',') + str=str.gsub(/&/,'&'). + gsub(/\(/,'('). + gsub(/\)/,')'). + gsub(/\*/,'*'). + gsub(/\+/,'+'). + gsub(/,/,',') str end def index(the_idx) @@ -164,15 +164,15 @@ module SiSU_book_index idx={} idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=[],[],[],[] h={obj: Mx[:br_page]} - o=SiSU_document_structure::Object_layout.new.break(h) + o=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o h={lv: '2', name: 'index', obj: "Index"} - o=SiSU_document_structure::Object_heading.new.heading(h) + o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"} - o=SiSU_document_structure::Object_heading.new.heading(h) + o=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o 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] @@ -347,7 +347,7 @@ module SiSU_book_index def clean_index(data) #check on use of dob tuned_file=[] data.each do |para| - para.gsub!(/\n*#{@rgx_idx}/m,'') + para=para.gsub(/\n*#{@rgx_idx}/m,'') tuned_file << para end tuned_file |