diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-08-23 12:01:59 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-08-23 12:01:59 -0400 |
commit | 08c69d074001507d64cd5960c8679ec91a5a8353 (patch) | |
tree | af52d5986b3108abc5edbd943ea287455c89deb3 /lib/sisu/v0/html.rb | |
parent | a bit of a cleanup, and change reference to null to ordinary (diff) |
pass Hash to Format classes; some match tuning in dal
Diffstat (limited to 'lib/sisu/v0/html.rb')
-rw-r--r-- | lib/sisu/v0/html.rb | 99 |
1 files changed, 61 insertions, 38 deletions
diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index fd2294ba..2dc75d60 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -201,7 +201,8 @@ module SiSU_HTML else '_top' end s_lnk_url,s_lnk_lnk=l[:url],l[:say] - lev_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,s_lnk_url,s_lnk_lnk,target) + txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target} + lev_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) @links_guide_toc << lev_para_ocn.links_guide if s_lnk_lnk end end @@ -236,7 +237,8 @@ module SiSU_HTML endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m) end endnote_array.flatten.each do |note| - format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,note) + txt_obj={:txt =>note} + format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,txt_obj) @scr_endnotes << format_scroll.endnote_body end end @@ -318,12 +320,17 @@ WOK @@toc[:scr] << format_head_scroll.toc_owner_details end end +#not used --> def level_endnotes if @md.flag_endnotes format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) @@toc[:scr] << format_head_scroll.toc_endnote end end + def level_concordance + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + @@toc[:seg_mini] << format_head_toc.mini_seg_concordance + end def level_metadata format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) @@toc[:scr] << format_head_toc.metadata @@ -336,6 +343,7 @@ WOK @@toc[:seg] << format_head_toc.concordance @@toc[:seg_mini] << format_head_toc.mini_concordance end +# <-- not used def level_1 para=@data unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -353,7 +361,8 @@ WOK %{<b><a href="#{@md.fnl[:pre]}#{link}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}">#{linkname}</a></b>} end toc={} - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -379,7 +388,8 @@ WOK end %{<b><a href="##{link}">#{linkname}</a></b>} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -392,12 +402,13 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 toc[:seg_mini]=format_toc.mini_lev2 @@ -407,7 +418,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}</a>} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev2 toc end @@ -416,12 +428,13 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') para.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 toc[:seg_mini]=format_toc.mini_lev3 @@ -431,7 +444,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}</a>} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev3 toc end @@ -441,8 +455,8 @@ WOK unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') para[@pat_heading] - linkname,link=$1.strip,$2 if $& - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link + linkname,ocn=$1.strip,$2 if $& + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn end para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') if para =~/^#{Mx[:lv_o]}4:/ @@ -460,8 +474,9 @@ WOK %{<a href="#{@md.fnl[:pre]}\\2#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}" } + %{target="_top">\\1 \\2 \\3</a> }) end - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link - format_toc=SiSU_HTML_Format::Format_toc.new(@md,seg_link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn + txt_obj={:txt =>seg_link} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 toc[:seg_mini]=format_toc.mini_lev4 @@ -471,7 +486,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}</a>} if p_num end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev4 toc end @@ -482,10 +498,10 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -493,15 +509,17 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}##{link}"> + lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}##{ocn}"> #{linkname} </a>} - format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}</a>} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev5 toc end @@ -511,10 +529,10 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -522,15 +540,17 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}##{link}"> + lnk_n_txt=%{ <a href="#{@md.fnl[:pre]}#{@@seg_url}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}##{ocn}"> #{linkname} </a>} - format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}</a>} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev6 toc end @@ -592,20 +612,23 @@ WOK tmp_head=nil doc_title_endnote=@md.title.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>') tmp_head=doc_title_endnote + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if not @md.subtitle.nil? \ and not @md.subtitle.empty? tmp_head=@md.subtitle + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt=>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end if @md.dc_creator creator_endnote=@md.dc_creator.gsub(/(\*+)/,%{ <sup><a href="#notes">\\1</a></sup>}) tmp_head=creator_endnote + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end |