diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-07-09 11:42:50 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-07-09 11:42:50 -0400 |
commit | 788e0a8bb4c7259a0a5b6d85df4cc3c4ef0280cd (patch) | |
tree | b8ee9f50a913f6f1fc321dc05c75c989d912c493 /lib | |
parent | dal, manifest & metadata headings, non-substantive, ocn removed (diff) |
html_scroll, deals with index & endnotes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/html_scroll.rb | 44 |
1 files changed, 26 insertions, 18 deletions
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<a name="docinfo"></a>') end - if defined? dob.name and dob.name =~/^metadata/ and dob.obj =~/Metadata/ - dob.obj.gsub!(/(Metadata)/,'\1<a name="metadata"></a>') + 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") + '<hr width=90% />' + @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!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>') 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!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>') - end - book_idx.join("\n") + '<hr width=90% />' - elsif dob.is=='insert' and dob.obj=='Metadata' #use for metadata inject - metadata=Metadata::Summary.new(@md).xhtml.metadata end if dob =~/<a name="n\d+">/ \ and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though |