diff options
Diffstat (limited to 'lib/sisu/v6/html_format.rb')
-rw-r--r-- | lib/sisu/v6/html_format.rb | 253 |
1 files changed, 97 insertions, 156 deletions
diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index abefdf2f..f02a51e1 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -58,7 +58,7 @@ =end module SiSU_HTML_Format - include SiSU_Viz + require_relative 'html_parts' # html_parts.rb class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @@ -71,10 +71,11 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' + elsif @make.build.html_strict? + %{<label class="ocn">#{@ocn}</label>} else - name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} - @ocn.gsub(/^(\d+|)$/, - %{<label class="ocn" id="#{@ocn}">\\1</label>}) + %{<label class="ocn"><a name="#{@ocn}" class="lnkocn">#{@ocn}</a></label>} + #%{<label class="ocn" id="#{@ocn}">#{@ocn}</label>} end else '' @@ -97,13 +98,13 @@ module SiSU_HTML_Format end class HeadInformation require_relative 'css' # css.rb + include SiSU_Parts_HTML require_relative 'xml_shared' # xml_shared.rb - include SiSU_Viz - attr_reader :md,:rdf,:vz + attr_reader :md,:rdf def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new + @bits=SiSU_Proj_HTML::Bits.new @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @tocband_scroll,@tocband_segtoc=nil,nil @@ -164,7 +165,7 @@ module SiSU_HTML_Format %{ <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest(page)} #{wgt.search} </tr></table>} @@ -172,14 +173,6 @@ module SiSU_HTML_Format def rdf SiSU_XML_Tags::RDF.new(md) end - def doc_type - %{<!DOCTYPE html> -<html>\n} - end - def table_close - %{ </font> -#{@vz.table_close}} - end def button_home(page=:seg) button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\n} if @md.make.home_button_image.is_a?(Hash) @@ -206,6 +199,7 @@ module SiSU_HTML_Format end end class Widget < HeadInformation + include SiSU_Parts_HTML def initialize(md) super(md) @md=md @@ -216,15 +210,15 @@ module SiSU_HTML_Format @make=SiSU_Env::ProcessingSettings.new(md) end def home - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="../index.html" target="_top"> - #{@vz.nav_txt_homepage}</a> + #{the_nav.txt_homepage}</a> </td> } end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top"> #{text} </a> @@ -257,16 +251,15 @@ module SiSU_HTML_Format end if page==:manifest manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}" - brace_url=SiSU_Viz::Defaults.new.url_decoration - %{<td align="center" bgcolor=#{@vz.color_band2}> - <font face="#{@vz.font_fonts}" size="2"> - #{brace_url.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{brace_url.xml_close} + %{<td align="center" bgcolor=#{the_color.band2}> + <font face="#{the_font.set_fonts}" size="2"> + #{the_url_decoration.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{the_url_decoration.xml_close} </font> </td>} else - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{manifest_lnk}" target="_top"> - #{@vz.nav_txt_manifest} + #{the_nav.txt_manifest} </a> </td>} end @@ -291,7 +284,7 @@ module SiSU_HTML_Format #{make_scroll_search_form_and_manifest_link} </td> WOK - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(:scroll)} </td> @@ -300,7 +293,7 @@ WOK </td> <td width="20%"> -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -316,14 +309,14 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home} </td> <td width="75%" align="center"> #{doc_types} #{up_button} -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -344,7 +337,7 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(page)} </td> @@ -353,7 +346,7 @@ WOK </td> <td width="5%" align="right"> #{firstseg} -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -376,8 +369,8 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - %{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} + %{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_doc_link} </td> } %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> @@ -389,13 +382,13 @@ WOK def make_scroll_seg_pdf seg='' wgt=SiSU_HTML_Format::Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} + seg=%{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_toc_link} </td> } %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} @@ -404,47 +397,49 @@ WOK wgt=SiSU_HTML_Format::Widget.new(@md) %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} end def head - %{#{doc_type} + rdf=SiSU_XML_Tags::RDF.new(@md) + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +#{rdf.metatag_html} #{@stylesheet.css_head} </head> -#{@vz.color_body} +<body lang="#{@md.opt.lng}"> <a name="top" id="top"></a>} end def concordance if @md.concord_make - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="./#{@md.file.base_filename.html_concordance}"> <i>Concordance</i> </a> </h4> -#{@vz.table_close}} +#{table_close}} else - %{#{@vz.margin_css} -#{@vz.table_close}} + %{#{the_margin.css} +#{table_close}} end end def links_guide_vertical_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="vertical_links"> <ul id="vertical"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -459,13 +454,12 @@ WOK end def links_guide_horizontal_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="horizontal_links"> <ul id="horizontal"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -519,69 +513,69 @@ WOK def scroll_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_scr}} +#{the_banner.instrument_cover_band_scr}} end def seg_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_seg}} +#{the_banner.instrument_cover_band_seg}} end def make_scroll - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc scroll" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white" border="0"> - #{@vz.nav_txt_doc_link} + #{the_nav.txt_doc_link} </td> <td align="center" bgcolor="white"> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def make_seg - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} + #{the_nav.txt_toc_link} </td> <td align="center" bgcolor="white"> <font size=2> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def manifest #check structure if not @o_str.dump_or_redirect? - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + manifest=manifest_link(the_nav.txt_manifest) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{manifest} </font> -#{@vz.table_close}} +#{the_table_close}} else '' end end def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + concord=concordance_link(the_nav.txt_concordance) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{concord} </font> -#{@vz.table_close}} +#{the_table_close}} end def metadata - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="#{@metalink}"> <i>MetaData</i> </a> </h4> -#{@vz.table_close}} +#{the_table_close}} end def seg_tail %{ <div class="main_column"> <p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> +<table summary="toc segment tail" bgcolor=#{the_color.band1}> <tr><td width="20%"> - #{@vz.banner_band} + #{the_banner.banner_band} </td> <td width="60%"> <center> @@ -590,8 +584,7 @@ WOK </td></tr> </table> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -604,8 +597,7 @@ WOK %{ <div class="main_column"> #{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -615,8 +607,7 @@ WOK %{ <div class="main_column"> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -640,7 +631,7 @@ WOK nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") end end - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -655,13 +646,13 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" up=@toc nxt="#{@md.file.base_filename.html_segtoc}" - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -676,21 +667,21 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> + toc=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@toc}" target="_top"> #{png_nav.toc} </a> </td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> + pre=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.pre} </a> </td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> + nxt=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.nxt} </a> @@ -708,7 +699,7 @@ WOK #{toc} #{nxt} <td> -#{@vz.table_close}} +#{the_table_close}} end def toc_next2 toc_nav(false,true).dup @@ -737,34 +728,33 @@ WOK end end def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> + %{<table summary="navigation segment table" width=#{the_width.table1} border="0" bgcolor="white" cellpadding="0"> <tr><th width="#{@@indent['leve_1']}" align="right"> </td> <td valign="top"> <font size=2>} end def navigation_table1 - %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left"> + %{<table summary="navigation segment table1" width=#{the_width.table1} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table1} align="left"> <tr><td valign="top"> <font size="2">} end def navigation_table2 - %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left"> + %{<table summary="navigation segment table2" width=#{the_width.table2} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table2} align="left"> <tr><td valign="top"> <font size="2">} end def credit %{ <div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div></div> } end def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> + %{<table summary="segment navigation band with banner" bgcolor=#{the_color.band1} width="100%"><tr> <td width="20%" align="left"> #{button_home} </td> @@ -780,7 +770,7 @@ WOK def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigation_band_bannerless %{ <div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> + <table summary="segment navigation band" bgcolor=#{the_color.band1} width="100%"><tr> <td width="70%" align="center"> #{doc_types} </td> @@ -809,7 +799,9 @@ WOK } #revisit end def head_seg - %{#{doc_type} + rdf=SiSU_XML_Tags::RDF.new(@md) + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> @@ -817,9 +809,10 @@ WOK #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> +#{rdf.metatag_html} #{@stylesheet.css_head_seg} </head> -#{@vz.color_body} +<body lang="#{@md.opt.lng}"> <a name="top" id="top"></a>} end def title_banner(title,subtitle,creator) @@ -836,8 +829,8 @@ WOK </p> <p class="tiny"> copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} + <a href="#{the_url.home}"> + #{the_text.txt_home} </a> </p> </div> @@ -849,8 +842,8 @@ WOK super(md) end def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} + %{#{the_margin.txt_3} +#{the_font.paragraph_font_small} <a href="#owner.details"> Owner Details <font size="1" color="#777777"> @@ -858,11 +851,11 @@ WOK </font> </a> </font> -#{@vz.table_close}} +#{the_table_close}} end end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_HTML attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -895,7 +888,6 @@ WOK @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Viz::Defaults.new end def nametags_scroll(dob) tags='' @@ -1123,21 +1115,21 @@ WOK end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0} <p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css} -#{@vz.table_close}} +#{the_table_close}} end def bold_heading %{<p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css} -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at %{<p class="center">#{@txt}</p>\n} @@ -1155,63 +1147,12 @@ WOK class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject def initialize(md,txt) super(md,txt) end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -<center> -#{@txt} -#{@two} -</a></center><p>} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{<p> -<table summary="navigation segment level 2"> -<tr><td width ="20"> -</td> -<td> - <font size="3" #{@vz.font_face}> - <b>#{@txt}</b> - </font> - </p> -#{@vz.table_close}} - end - def navigation_toc_lev3 #change bold use css - %{<p> -<table summary="navigation segment level 3"> -<tr><td width ="20"> -</td> -<td> - <font size="3" #{@vz.font_face}> - <b>#{@txt}</b> - </font> - </p> -#{@vz.table_close}} - end - def navigation_toc_lev4 - %{<table summary="navigation segment level 4"> -<tr><td width ="80"> -</td> -<td> -<p> - #{@txt} -</p> -#{@vz.table_close}} - end - def navigation_toc_lev5 - end - def navigation_toc_lev6 - end - def navigation_toc_lev7 - end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ @@ -1286,7 +1227,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{<p class="bold"> |