From 788e0a8bb4c7259a0a5b6d85df4cc3c4ef0280cd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 9 Jul 2010 11:42:50 -0400 Subject: html_scroll, deals with index & endnotes --- lib/sisu/v2/html_scroll.rb | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/html_scroll.rb b/lib/sisu/v2/html_scroll.rb index b0581ead..049eb922 100644 --- a/lib/sisu/v2/html_scroll.rb +++ b/lib/sisu/v2/html_scroll.rb @@ -81,17 +81,18 @@ module SiSU_HTML_scroll @rcdc=false @scr={ :body=>[],:metadata=>[],:owner_details=>[] } data.each do |dob| - if defined? dob.name and dob.name =~/^meta/ and dob.obj =~/Document Information/ + if defined? dob.name and dob.name =~/^meta/ \ + and dob.obj =~/Document Information/ dob.obj.gsub!(/(Document Information(?: \(metadata\))?)/,'\1') end - if defined? dob.name and dob.name =~/^metadata/ and dob.obj =~/Metadata/ - dob.obj.gsub!(/(Metadata)/,'\1') + if dob.obj =~/^Metadata$/ \ + and dob.lv =='B' + dob.obj.gsub!(/Metadata/,'') end - if @rcdc==false \ - and dob.is =='heading_insert' \ - and dob.ln ==1 \ + if defined? dob.name \ and dob.name =~/^metadata/ \ - and dob.obj =~/Document Information/ #fix no current match + and dob.lv =='1' \ + and dob.obj =~/SiSU Metadata, document information/ @rcdc=true end dob.obj.gsub!(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1') # internal document links @@ -125,11 +126,26 @@ module SiSU_HTML_scroll sto.heading_body2 elsif dob.ln==3 sto.heading_body3 - elsif dob.ln==4 + elsif dob.ln==4 \ + and dob.obj !~/^(?:Endnotes|Index|Metadata|Manifest)$/ + sto.heading_body4 + elsif dob.ln==4 \ + and dob.obj=='Endnotes' sto.heading_body4 - if dob.obj=='Endnotes' - @endnotes.join("\n") + '
' + @endnotes.join("\n") + elsif dob.ln==4 \ + and dob.obj=='Index' + sto.heading_body4 + book_idx=SiSU_Particulars::Combined_singleton.instance.get_idx_html(@md.opt).html_idx + book_idx.each do |x| #takes book index prepared for segments and strips segment identifying info + x.gsub!(/(\1(?:-\d+)?)<\/a>/,'\2') end + book_idx.join("\n") + #elsif dob.ln==4 \ + #and dob.obj=~/Meta/ + #p __LINE__ + ##and dob.obj=='Metadata' + #metadata=Metadata::Summary.new(@md).xhtml.metadata elsif dob.ln==5 sto.heading_body5 elsif dob.ln==6 @@ -158,14 +174,6 @@ module SiSU_HTML_scroll sto.code elsif dob.is=='table' sto.table - elsif dob.is=='insert' and dob.obj=='Index' - book_idx=SiSU_Particulars::Combined_singleton.instance.get_idx_html(@md.opt).html_idx - book_idx.each do |x| #takes book index prepared for segments and strips segment identifying info - x.gsub!(/(\1(?:-\d+)?)<\/a>/,'\2') - end - book_idx.join("\n") + '
' - elsif dob.is=='insert' and dob.obj=='Metadata' #use for metadata inject - metadata=Metadata::Summary.new(@md).xhtml.metadata end if dob =~// \ and dob =~/^(?:\^~\d+\s|)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though -- cgit v1.2.3