aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/db_import.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-08-08 00:34:25 -0400
committerRalph Amissah <ralph@amissah.com>2014-08-08 00:36:15 -0400
commit6bc3b814011e829db684ec96bb3abd1e4abb29c3 (patch)
tree72d759c1d89a72c4fc5e3c46f6917f69e72699e6 /lib/sisu/v6/db_import.rb
parentv5: merged v6 libraries (diff)
v5 v6: extend document structure, headings A - D, 1 - 4
* sql db table structure changed (needs to be rebuilt)
Diffstat (limited to 'lib/sisu/v6/db_import.rb')
-rw-r--r--lib/sisu/v6/db_import.rb37
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb
index 5b44b173..54a2f434 100644
--- a/lib/sisu/v6/db_import.rb
+++ b/lib/sisu/v6/db_import.rb
@@ -118,7 +118,7 @@ module SiSU_DbImport
puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on
end
@id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty?
- @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0
+ @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=@col[:lv7]=0
@db=SiSU_Env::InfoDb.new
@pdf_fn=SiSU_Env::FileOp.new(@md).base_filename
@@dl ||=SiSU_Env::InfoEnv.new.digest.length
@@ -390,6 +390,7 @@ module SiSU_DbImport
when /1/ then @col[:lv1]+=1
when /2/ then @col[:lv2]+=1
when /3/ then @col[:lv3]+=1
+ when /4/ then @col[:lv4]+=1
end
@col[:lev]=@col[:plaintext]=@col[:body]=''
elsif data.is==:heading \
@@ -480,7 +481,8 @@ module SiSU_DbImport
@col[:lev]=@col[:plaintext]=@col[:body]=''
elsif data.is==:heading \
&& data.ln==6
- txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
+ txt, @col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=
+ data.obj,data.ocn, data.lv, data.odv, data.osp, data.of, data.is, data.node, data.parent, '', ''
@@seg_full=data.name if data.is==:heading && data.ln==6 && data.name #check data.name
@@seg ||='' #nil # watch
@col[:seg]=@@seg
@@ -508,6 +510,37 @@ module SiSU_DbImport
t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@col[:lev]=@col[:plaintext]=@col[:body]=''
+ elsif data.is==:heading \
+ && data.ln==7
+ txt, @col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=
+ data.obj,data.ocn, data.lv, data.odv, data.osp, data.of, data.is, data.node, data.parent, '', ''
+ @@seg_full=data.name if data.is==:heading && data.ln==7 && data.name #check data.name
+ @@seg ||='' #nil # watch
+ @col[:seg]=@@seg
+ @col[:lv7]+=1
+ @col[:lid]+=1
+ @col[:lev]=7
+ @hname=if @col[:seg] \
+ and not @col[:seg].to_s.empty?
+ @@hname=@col[:seg].to_s
+ else @@hname
+ end
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
+ txt=endnotes(txt).extract_any
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=book_idx_hash_to_str(data.idx)
+ @col[:book_idx]=clean_searchable_text(book_idx)
+ @en_a,@en_z=@en[0].first,@en[0].last if @en[0]
+ @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
+ @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
+ t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
+ @tuple_array << t.tuple
+ @col[:lev]=@col[:plaintext]=@col[:body]=''
#% :structure :layout :comment
elsif data.of==:structure \
|| data.of==:layout \