diff options
Diffstat (limited to 'lib/sisu/v6/xml_format.rb')
-rw-r--r-- | lib/sisu/v6/xml_format.rb | 629 |
1 files changed, 19 insertions, 610 deletions
diff --git a/lib/sisu/v6/xml_format.rb b/lib/sisu/v6/xml_format.rb index 73a41efa..088b5d2b 100644 --- a/lib/sisu/v6/xml_format.rb +++ b/lib/sisu/v6/xml_format.rb @@ -60,8 +60,8 @@ =end module SiSU_XML_Format require_relative 'dp' # dp.rb - include SiSU_Param - include SiSU_Viz + require_relative 'xml_parts' # xml_parts.rb + include SiSU_Param class ParagraphNumber def initialize(md,paranum) @md=md @@ -86,6 +86,7 @@ module SiSU_XML_Format end end class HeadInformation + include SiSU_Parts_XML def initialize #dc rdf @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=@@md @@ -197,7 +198,6 @@ module SiSU_XML_Format if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.keywords}" />\n} if @md.keywords - @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end def meta_content_clean(content='') @@ -279,6 +279,7 @@ WOK end end class FormatTextObject + include SiSU_Parts_XML attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font def initialize(md,dob) @md,@dob=md,dob @@ -292,7 +293,6 @@ WOK @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx rgx=/~\{\d+\s+(.+?)\}~/ @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@txt}</endnote> " @@ -368,13 +368,12 @@ WOK end end class HeadInformation - include SiSU_Viz + include SiSU_Parts_XML attr_reader :md,:sfx,:pdf,:rdf,:vz def initialize(md) @md=md @rdf=SiSU_XML_Tags::RDF.new(md) # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @@ -389,7 +388,7 @@ WOK end def table_close %{ </font> -#{@vz.table_close}} +#{the_table_close}} end def html_close #moved %{</body> @@ -398,597 +397,8 @@ WOK end class XML end - class HeadToc < HeadInformation - def initialize(md) - super(md) - @md=md - @tocband_scroll,@tocband_segtoc=make_scroll,make_seg - end - def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - <<WOK -<td align="center" width="60%"> - #{make_seg_scroll_pdf} -</td> -WOK - else '' - end - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td>#{pdf} -<td width="20%"> - -#{@vz.table_close} -<p />} - end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_concordance} -</td> -<td width="20%" align="right"> - <a href="index.html" target="_top" alt="->"> - #{@vz.png_nav_toc} - </a> -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band_bottom(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def make_seg_scroll_pdf - wgt=Widget.new(@md) - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} -</td> -} - %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{scroll} - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf} - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_scroll_seg_pdf - seg='' - wgt=Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} -</td> -} - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{seg} - #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_concordance - wgt=Widget.new(@md) - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def head - %{#{doc_type} -<head> - <title> - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end - end - def links_guide_close #(type='horizontal') - insert='' - insert=if @md.sfx_src =~/s?/ - link='http://sisudoc.org' #get from defaults - url='sisudoc.org' - insert= %{ - <li class="ref"> - <a href="#{link}" target="_top"> - #{url} - </a> - </li> - </ul> -</div> -} - end - %{ #{insert} -<!- quick ref -!>} - end - def prefix_a - end - def rights - copyright=meta_content_clean(@md.rights.copyright.all) - rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') - %{<p class="small_left">Rights: #{rights}</p> -<p />} - end - def prefix_b - %{<p class="small_left">Prefix: #{@md.prefix_b}<p />} - end - def scroll_head_title_banner_open - %{<center> -#{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_scr}} - end - def seg_head_title_banner_open - %{<center> - #{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_seg}} - end - def make_scroll - concord=concordance_link(@vz.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} -</td> -<td align="center" bgcolor="white"> - #{concord} -#{@vz.table_close}} - end - def make_seg - concord=concordance_link(@vz.nav_txt_concordance) - %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} -</td> -<td align="center" bgcolor="white"> - <font size=2> - #{concord} -#{@vz.table_close}} - end - def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{manifest} - </font> -#{@vz.table_close}} - end - def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{concord} - </font> -#{@vz.table_close}} - end - def metadata - %{#{@vz.margin_css} - <h4 class="toc"> - <a href="#{@metalink}"> - <i>MetaData</i> - </a> - </h4> -#{@vz.table_close}} - end - def seg_tail - %{ -<div class="main_column"> -<p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%"> - <center> - #{@tocband_segtoc} - </center> -</td></tr> -</table> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def scroll_tail #debug - nav=scroll_head_navigation_band - %{ -<div class="main_column"> -#{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def seg_navigation_tail #this is a bug area, look up and "tidy" - #nav=scroll_head_navigation_band - %{ -<div class="main_column"> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - end - class HeadSeg < HeadInformation - def initialize(md) #(md='') - super(md) - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@vz.font_css_table_file} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_toc} - </a> -</td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_pre} - </a> -</td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_nxt} - </a> -</td>} if f_nxt==true - %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> -<tr> -#{pre} -#{toc} -#{nxt} -<td> -#{@vz.table_close}} - end - def toc_next2 - toc_nav(false,true).dup - end - def toc_pre_next2 - toc_nav(true,true).dup - end - def toc_pre2 - toc_nav(true,false,2).dup - end - def doc_types #used in seg_nav_band ### - wgt=Widget.new(@md) - #dir=SiSU_Env::InfoEnv.new(@md.fns) - if @md.concord_make - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - else - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - end - def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} 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"> -<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"> -<tr><td valign="top"> - <font size="2">} - end - def header_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="http://#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="external"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def credit - %{ -<div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits" id="credits"></a> -</div></div> -} - end - def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> -<td width="20%" align="left"> -#{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{doc_types} -</td> -<td width="20%" align="right"> - #{segtocband} -</td></tr> -</table> -#{seg_table_top_control}} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -<div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> - <td width="70%" align="center"> - #{doc_types} - </td> - <td width="30%" align="right"> - #{segtocband} - </td></tr> - </table> - #{seg_table_top_control} -</div> -} - end - def endnote_mark -%{ -<p class="center" id="endnotes"> - <hr class="endnote" /> -</p>} - end - def endnote_section_open -%{ -<div class="endnote"> -} - end - def endnote_section_close -%{ -</div> -} #revisit - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - %{ -<div class="summary"> - <p class="tiny"> - #{title} - </p> - <p class="tiny"> - #{subtitle} - </p> - <p class="tiny"> - #{creator} - </p> - <p class="tiny"> - copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} - </a> - </p> -</div> -} - end - end - class HeadScroll < HeadToc - def initialize(md) #(md='') - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - <a href="#owner.details"> - Owner Details - <font size="1" color="#777777"> - - </font> - </a> - </font> -#{@vz.table_close}} - end - def table - %{<table summary="scroll table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> -<tr><th width=#{@@indent['level_1']} align="right"> -</th> -<td valign="top"> -#{@vz.paragraph_txt}} - end - def table1 - %{<table summary="scroll table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table1} align="justify"> -<tr><td valign="top"> -#{@vz.paragraph_txt}} - end - def table2 - %{<table summary="scroll table2" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table2} align="justify"> -<tr><td valign="top"> -#{@vz.paragraph_txt}} - end - end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_XML attr_accessor :md,:dob,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1034,7 +444,6 @@ WOK end end @dob=t_o if defined? t_o.is - @vz=SiSU_Viz::Defaults.new end def endnote_body %{ @@ -1183,13 +592,13 @@ 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_header @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). @@ -1197,9 +606,9 @@ WOK %{<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} @@ -1215,9 +624,9 @@ WOK end end class FormatScroll < FormatTextObject + include SiSU_Parts_XML def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -1240,11 +649,11 @@ WOK <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev3 #change bold use css %{<p /> @@ -1252,11 +661,11 @@ WOK <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev4 %{<table summary="navigation segment level 4"> @@ -1266,7 +675,7 @@ WOK <p> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev5 end @@ -1344,7 +753,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_header5 %{<p class="bold"> |