aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv/epub_format.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-02-03 20:02:32 -0500
committerRalph Amissah <ralph@amissah.com>2012-02-03 20:26:44 -0500
commit145f3092505f614ca5c81a4cbcfea9f22329e745 (patch)
tree9bc696e29f1d8df43f65279c7e1dc4b696cc9007 /lib/sisu/v3dv/epub_format.rb
parentv3 v3dv: vim syntax highlighting, patch from Thilo Six <T.Six@gmx.de> applied (diff)
v3 v3dv: path & url links, updates for multiple output directory structures
Diffstat (limited to 'lib/sisu/v3dv/epub_format.rb')
-rw-r--r--lib/sisu/v3dv/epub_format.rb281
1 files changed, 7 insertions, 274 deletions
diff --git a/lib/sisu/v3dv/epub_format.rb b/lib/sisu/v3dv/epub_format.rb
index c1987fa0..344e4e7e 100644
--- a/lib/sisu/v3dv/epub_format.rb
+++ b/lib/sisu/v3dv/epub_format.rb
@@ -1718,50 +1718,12 @@ WOK
</html>}
end
end
- class Widget < HeadInformation
- def initialize(md)
- super(md)
- @md=md
- @cf_defaults=SiSU_Env::InfoProcessingFlag.new
- end
- def home
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="../index.html" target="_top">
- #{@vz.png_homepage}</a>
-</td>
-}
- end
- def search
- env=SiSU_Env::InfoEnv.new(@md.fns,@md)
- env.widget.search_form('sisusearch',nil,nil,true)
- end
- def manifest
- %{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{@vz.nav_txt_manifest}
- </a>
-</td>}
- end
- end
- class XML
- end
class HeadToc < HeadInformation
def initialize(md)
super(md)
@md=md
@tocband_segtoc=make_seg
end
- def concordance_navigation_band(type='')
- if type=~/pdf/
- @tocband_concordance=make_concordance
- end
- %{<p class="align_right">
- <a href="index.html" target="_top">
- #{@vz.epub_png_nav_toc}
- </a>
-</p>
-}
- end
def seg_head_navigation_band
firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top">
#{@vz.epub_png_nav_nxt}
@@ -1778,30 +1740,17 @@ WOK
? ''
: %{<p class="align_right">#{firstseg}</p>}
end
- def manifest_link(text) #watch fix removed font size 2
- %{ <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>}
+ def manifest_link(text)
+ %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>}
end
- def concordance_link(text) #watch fix removed font size 2
+ def concordance_link(text)
if @md.concord_make
- %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
+ %{<a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}>
#{text}
</a>}
else ''
end
end
- def make_concordance
- manifest=scroll=seg=''
- wgt=SiSU_EPUB_Format::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>
@@ -1815,7 +1764,7 @@ WOK
if @md.concord_make
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}>
+ <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}>
<i>Concordance</i>
</a>
</h4>
@@ -1879,10 +1828,6 @@ WOK
</h4>
#{@vz.table_close}}
end
- def seg_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- metadata
- end
end
class HeadSeg < HeadInformation
def initialize(md)
@@ -1896,227 +1841,15 @@ WOK
#{@md.html_title}
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@vz.font_css_table_file}
+#{@css.xhtml_epub}
</head>
-#{@vz.color_body}
-#{@vz.js_top}}
- 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_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def dot_control_pre
- %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
-<tr><td align="left">
- <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
- </a>
-</td>
-<td align="center">
- <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
- </a>
-</td>
-<td align="right">
- <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
- </a>
-#{@vz.table_close}}
- end
- def toc_nav(f_pre=false,f_nxt=false,use=1)
- pre=nxt=''
- toc=%{<a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}>
- #{@vz.epub_png_nav_toc}
-</a>
-}
- pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}>
- #{@vz.epub_png_nav_pre}
-</a>
-} if f_pre==true
- nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}>
- #{@vz.epub_png_nav_nxt}
- </a>
-} if f_nxt==true
- DISABLE[:epub][:internal_navigation] \
- ? ''
- : %{<p class="align_right">
-#{pre}
-#{toc}
-#{nxt}
-</p>
-}
- end
- def toc_next2
- pre,nxt=false,true
- toc_nav(false,true).dup
- end
- def toc_pre_next2
- toc_nav(true,true).dup
- end
- def toc_pre2
- toc_nav(true,false).dup
- end
- def manifest_link(text)
- %{<a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>
- #{text}
- </a>}
- end
- def concordance_link(text)
- if @md.concord_make
- %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}>
- #{text}
- </a>}
- else ''
- end
- end
- def doc_types #used in seg_nav_band ###
- scroll=seg=''
- wgt=SiSU_EPUB_Format::Widget.new(@md)
- x=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 heading_advert_local_1
- dir=SiSU_Env::InfoEnv.new(@fns)
- %{ <p class="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[:epub_xhtml]}" target="_top">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def heading_advert_local_2
- dir=SiSU_Env::InfoEnv.new(@fns)
- %{ <p class="center">
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def heading_advert_external
- dir=SiSU_Env::InfoEnv.new(@fns)
- %{ <p class="center">
-<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center">
-<tr><td align="center" bgcolor="white">
- <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="external">
- <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" />
- </a>
-#{@vz.table_close}
-</p>}
- end
- def navigation_band(segtocband) #change name to navigaion_band_banner
- %{#{segtocband}
-}
- 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>
-}
+#{@vz.color_body}}
end
def endnote_mark
%{
<hr class="endnote" />
}
end
- def endnote_section_open
-%{
-<div class="endnote">
-}
- end
- def endnote_section_close
-%{
-</div>
-} #revisit
- end
- def head
- %{#{doc_type}
-<head>
- <title>
- #{@seg_name_xhtml[@seg_name_xhtml_tracker]} -
- #{@md.html_title}
- </title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-#{@css.xhtml_epub}
-</head>
-#{@vz.color_body}}
- end
- def toc_metadata
- @metalink=%{./#{@md.fn[:metadata]}}
- toc_metadata
- end
- def title_banner(title,subtitle,creator)
- end
end
class HeadScroll < HeadToc
def initialize(md)