aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/html_format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/html_format.rb')
-rw-r--r--lib/sisu/v0/html_format.rb555
1 files changed, 492 insertions, 63 deletions
diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb
index 8b6fc28a..87988ec1 100644
--- a/lib/sisu/v0/html_format.rb
+++ b/lib/sisu/v0/html_format.rb
@@ -55,7 +55,7 @@
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: base formatting template for html generation
+ ** Description: html formating, css template
=end
module SiSU_HTML_Format
@@ -98,7 +98,8 @@ module SiSU_HTML_Format
class Paragraph_id_ocn #used by table version #work area 2003w48
attr_accessor :paranum,:font,:p_num
def initialize(md,paranum)
- @paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,SiSU_HTML_Format::Paragraph_number.new(md,paranum) #font
+ @paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,Paragraph_number.new(md,paranum) #font
+ #@paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,SiSU_HTML_Format::Paragraph_number.new(md,paranum) #font
end
def txt
%{ <p #{@p_num.id} align="justify">#{@p_num.name}
@@ -140,7 +141,6 @@ module SiSU_HTML_Format
end
class Head_information
include SiSU_Viz
- include SiSU_HTML_Format
attr_reader :md,:sfx,:pdf,:rdf,:vz
def initialize(md='')
@md=md
@@ -184,6 +184,10 @@ module SiSU_HTML_Format
#{@vz.txt_home}
</a></h1>}
end
+ def html_close #moved
+ %{</body>
+</html>}
+ end
end
class Widget < Head_information
def initialize(md)
@@ -268,6 +272,8 @@ module SiSU_HTML_Format
end
end
end
+ class XML
+ end
class Head_toc < Head_information
def initialize(md)
super(md)
@@ -397,16 +403,30 @@ WOK
<title>
#{@md.html_title}
</title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- #{@rdf.rdftoc}
- #{@rdf.metatag_html}
- #{@vz.font_css_table_file}
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+#{@rdf.rdftoc}
+#{@rdf.metatag_html}
+#{@css.html}
</head>
#{@vz.color_body}
- <a name="top" id="top"></a>
- <a name="up" id="up"></a>
- <a name="start" id="start"></a>
- #{@vz.js_top}}
+<a name="top" id="top"></a>
+<a name="up" id="up"></a>
+<a name="start" id="start"></a>
+#{@vz.js_top}}
+ end
+ def concordance
+ if @md.concord_make
+ %{#{@vz.margin_css}
+ <h4 class="toc">
+ <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
+ <i>Concordance</i>
+ </a>
+ </h4>
+#{@vz.table_close}}
+ else
+ %{#{@vz.margin_css}
+#{@vz.table_close}}
+ end
end
def links_guide_vertical_open #???
url=(defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home
@@ -539,15 +559,12 @@ WOK
#{@vz.table_close}}
end
def metadata
- %{#{@vz.margin_txt_3}
-#{@vz.paragraph_font_small}
- <a href="#@metalink" #{@vz.js_metalink}>
- <i>MetaData</i>
- <font size="1" color="#777777">
- &nbsp;&nbsp;&nbsp;
- </font>
- </a>
- </font>
+ %{#{@vz.margin_css}
+ <h4 class="toc">
+ <a href="#@metalink" #{@vz.js_metalink}>
+ <i>MetaData</i>
+ </a>
+ </h4>
#{@vz.table_close}}
end
def seg_metadata
@@ -602,48 +619,8 @@ WOK
<a name="credits"></a>}
end
end
- def html_close
- %{</body>
-</html>}
- end
- class Head_scroll < Head_toc
- def initialize(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">
- &nbsp;&nbsp;&nbsp;
- </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
- def title_endnote
- end
- end
class Head_seg < Head_information
- def initialize(md)
+ def initialize(md) #(md='')
super(md)
end
def head
@@ -817,6 +794,21 @@ WOK
#{@vz.table_close}}
end
def title_endnote(title,subtitle,creator,table_top_control)
+# %{#{@vz.banner_instrument_cover_band_seg}
+# <h1 class="banner">
+# #{title}
+# </h1>
+# <h1 class="subbanner">
+# #{subtitle}
+# </h1>
+# <h1 class="subbanner">
+# #{creator}
+# </h1>
+# <h4 class="banner">
+# Endnotes
+# </h4>
+##{@vz.table_close}
+#<h1>Endnotes</h1>}
end
def navigation_table
%{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0">
@@ -918,6 +910,135 @@ WOK
%{<p class="center" id="endnotes">
</p>} #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}
+#{@css.html}
+</head>
+#{@vz.color_body}
+<a name="top" id="top"></a>
+<a name="up" id="up"></a>
+<a name="start" id="start"></a>
+#{@vz.js_top}}
+ end
+ def toc_metadata
+ @metalink=%{./#{@md.fn[:meatadata]}}
+ toc_metadata
+ end
+ def title_banner(title,subtitle,creator)
+ %{<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>}
+ end
+ end
+ class Head_scroll < Head_toc
+ 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">
+ &nbsp;&nbsp;&nbsp;
+ </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
+## def toc_endnote
+## %{#{@vz.margin_txt_3}
+## #{@vz.paragraph_font_small}
+## <a href="#endnotes">
+## Endnotes
+## </a>
+## #{@vz.table_close}}
+## end
+# def toc_endnote
+# %{#{@vz.margin_css}
+# <h4 class="toc">
+# <a href="#endnotes">
+# Endnotes
+# </a>
+# </h4>
+##{@vz.table_close}}
+# end
+ def title_endnote
+# %{#{@vz.margin_txt_0}
+# #{@vz.paragraph_txt}
+# <a name="endnotes" id="endnotes"></a>
+##{@vz.margin_num}
+# &nbsp;
+##{@vz.table_close}}
+ end
+# def tail
+# %{<br />
+##{@vz.margin_txt_0}
+#<table summary="scroll tail" bgcolor="#777777">
+#<tr><td width="20%">
+##{@vz.banner_band}
+#</td>
+#<td width="60%">
+#<center>#@tocband_scroll</center>
+#</td></tr>
+#</table>
+#<br />
+##{@vz.paragraph_txt}
+# <center>
+# #{@vz.credits_splash}
+# #{@vz.credits_sisu}
+# </center>
+##{@vz.margin_num}
+##{@vz.table_close}
+#<a name="bottom id="finish"></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>
+#<font color="white" size="0">
+# #{@md.title*10}
+#</font>
+#</body>
+#</html>}
+# end
end
class Format_text_object
@vz=SiSU_Env::Get_init.instance.skin
@@ -941,7 +1062,8 @@ WOK
#end
if txt[2]=~/\d+/
@paranum=txt[2][/(\d+)/m,1] # unless paranum =~/#/
- @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,@paranum)
+ @p_num=Paragraph_number.new(@md,@paranum)
+ #@p_num=SiSU_HTML_Format::Paragraph_number.new(@md,@paranum)
@para_id=Paragraph_id_ocn.new(@md,@paranum) #used by table version
end
@headname=''
@@ -1048,7 +1170,314 @@ WOK
%{<p class="centerbold">#@one</p>\n}
end
end
- class XML
+ class Format_scroll < Format_text_object
+ def initialize(md='',*txt)
+ super(md,*txt)
+ @vz=SiSU_Env::Get_init.instance.skin
+ end
+ def endnote_body
+ %{
+<div class="substance">
+ <label class="ocn">&nbsp;</label>
+ <p class="endnote">
+ #@one
+ </p>
+</div>
+}
+ end
+ def header_normal
+ %{
+<div class="substance">
+ #{@p_num.ocn_display}
+ <#@tag class="#@class" #{@p_num.id}>#{@p_num.name}
+ #@headname
+ #@parablock
+ </#@tag>
+</div>
+}
+ end
+ def heading_body
+ @tag,@class='p','norm'
+ header_normal
+ end
+ def heading_body1
+ @tag,@class='h1','norm'
+ header_normal
+ end
+ def heading_body2
+ @tag,@class='h2','norm'
+ header_normal
+ end
+ def heading_body3
+ @tag,@class='h3','norm'
+ header_normal
+ end
+ def heading_body4
+ @tag,@class='h4','norm'
+ header_normal
+ end
+ def heading_body5
+ @tag,@class='h5','norm'
+ header_normal
+ end
+ def heading_body6
+ @tag,@class='h6','norm'
+ header_normal
+ end
+ end
+ class Format_seg < Format_text_object
+ def initialize(md='',*txt)
+ super(md,*txt)
+ end
+ def navigation_toc_lev1_advert
+ %{#{@banner.home_button}\n
+<center>
+#@one
+#@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>#@one</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>#@one</b>
+ </font>
+ </p>
+#{@vz.table_close}}
+ end
+ def navigation_toc_lev4
+ %{<table summary="navigation segment level 4">
+<tr><td width ="80">
+</td>
+<td>
+<p>
+ #@one
+</p>
+#{@vz.table_close}}
+ end
+ def navigation_toc_lev5
+ end
+ def navigation_toc_lev6
+ end
+ def endnote_body_seg_tail #FIX
+ %{
+<div class="endnote">
+ <p class="endnote">
+ #@one
+ </p>
+</div>
+}
+ end
+ def endnote_body_seg_tail_indent
+ %{
+<div class="endnote">
+ <p class="endnote_indent">
+ #@one
+ </p>
+</div>
+}
+ end
+ def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408
+ fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info
+ %{
+<div class="endnote">
+ <p class="endnote">
+ #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three
+ </p>
+</div>
+}
+ end
+ def title_header
+ %{
+<div class="substance">
+ #@two
+<#@tag class="#@class">
+ #@one
+ </#@tag>
+</div>
+}
+ end
+ def title_header1
+ @tag,@class='h1','banner'
+ title_header
+ end
+ def title_header2
+ @tag,@class='h2','banner'
+ title_header
+ end
+ def title_header3
+ @tag,@class='h3','banner'
+ title_header
+ end
+ def title_header4
+ %{
+<div class="substance">
+ <label class="ocn">&nbsp;</label>
+ <h4 class="banner">
+ #@one
+ </h4>
+</div>
+}
+ end
+ def subtoc_lev
+ one=if @one \
+ and @one =~/<\/?i>|<a\s+name="\S+?">/mi
+ @one.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
+ else @one
+ end
+ note=''
+ if one =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream
+ note=$1
+ note.gsub!(/[\n\s]+/m,' ')
+ one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
+ one.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
+ end
+ %{<#@tag class="#@class">
+ <a href="##@two">
+ <i>#{one}</i>
+ </a> #{note}
+ </#@tag>}
+ end
+ def subtoc_lev5
+ @tag,@class='h5','subtoc'
+ subtoc_lev if @one
+ end
+ def subtoc_lev6
+ @tag,@class='h6','subtoc'
+ subtoc_lev if @one
+ end
+ #% para sisu
+ def header4
+ %{
+<div class="substance">
+#{@p_num.ocn_display}
+ <h1 class="norm" #{@p_num.id}>#{@p_num.name}
+ #@format
+ #@parablock
+ </h1>
+</div>
+}
+ end
+ def header_sub
+ @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ')
+ %{
+<div class="substance">
+ #{@p_num.ocn_display}
+ <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname}
+ #{@parablock}
+ </#@tag>
+</div>
+}
+ end
+ def header5
+ @tag,@class='p','bold'
+ header_sub
+ end
+ def header6
+ @tag,@class='p','bold'
+ header_sub
+ end
+ def navigation_header4
+ %{<table summary="navigation segment header 4" width=100% bgcolor="#08163f" border="0">
+<tr><td align="center">
+<p class="bold">
+ #@parablock
+</p>
+#{@vz.table_close}}
+ end
+ def navigation_header5
+ %{<p class="bold">
+ #@parablock
+</p>}
+ end
+ def navigation_header6
+ %{<p class="bold">
+ #@parablock
+</p>}
+ end
+ def navigation_center
+ "<center>#@parablock</center>"
+ end
+ end
+ class Format_toc < Format_text_object
+ def initialize(md='',*txt)
+ super(md,*txt)
+ end
+ def links_guide
+ #@three distinguishes between _top and external, can be used e.g. for different colour scheme
+ %{ <li class="doc">
+ <a href="#@link" target="_top">
+ #@linkname
+ </a>
+ </li>
+}
+ end
+ def lev(tag,attrib)
+ %{<#{tag} class="#{attrib}">
+ #@one
+ </#{tag}>
+}
+ end
+ def lev1
+ lev('h1','toc')
+ end
+ def lev2
+ lev('h2','toc')
+ end
+ def lev3
+ lev('h3','toc')
+ end
+ def lev4
+ lev('h4','toc')
+ end
+ def lev5
+ lev('h5','toc')
+ end
+ def lev6
+ lev('h6','toc')
+ end
+ def lev0 #docinfo
+ lev('h0','toc')
+ end
+ def mini_lev1
+ lev('h1','minitoc')
+ end
+ def mini_lev2
+ lev('h2','minitoc')
+ end
+ def mini_lev3
+ lev('h3','minitoc')
+ end
+ def mini_lev4
+ lev('h4','minitoc')
+ end
+ def mini_lev5
+ lev('h5','minitoc')
+ end
+ def mini_lev6
+ lev('h6','minitoc')
+ end
+ def mini_lev0 #docinfo
+ lev('h0','minitoc')
+ end
end
end
__END__