diff options
Diffstat (limited to 'lib/sisu/v3/epub_format.rb')
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 74 |
1 files changed, 21 insertions, 53 deletions
diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index c08ae492..70636fb1 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1233,7 +1233,7 @@ WOK end def doc_type_xhtml <<WOK -<?xml version="1.0" encoding="UTF-8"?> +<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> @@ -1277,7 +1277,7 @@ WOK #simple, make sure full-path of rootfile points to metadata.opf #epub_metadata.opf content.opf <<WOK -<?xml version="1.0" encoding="UTF-8"?> +<?xml version='1.0' encoding='utf-8'?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> @@ -1298,7 +1298,7 @@ WOK #{dob.obj} - #{@md.html_title} </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> #{@vz.color_body} @@ -1435,7 +1435,7 @@ WOK end def package_open <<WOK -<?xml version="1.0" encoding="UTF-8"?> +<?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0"> WOK end @@ -1658,25 +1658,10 @@ WOK end self end - def toc_head_escript - end - def seg_head_escript - end def table_close %{ </font> #{@vz.table_close}} end - def buttons_home - %{<!- home and index buttons -!> - #{@vz.banner_home_and_index_buttons} -<!- home and index buttons -!>} - end - def copyat - %{<p class="tiny">copy @ - <a href="#{@vz.url_home}" #{@vz.js_home}> - #{@vz.txt_home} - </a></p>} - end def xhtml_close %{#{@vz.credits_sisu_epub} </body> @@ -1689,28 +1674,12 @@ WOK @md=md @tocband_segtoc=make_seg end - def seg_head_navigation_band - firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top"> - #{@vz.epub_png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - DISABLE[:epub][:internal_navigation] \ - ? '' - : %{<p class="align_right">#{firstseg}</p>} - end - def seg_head_navigation_band_bottom - firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top"> - #{@vz.epub_png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - DISABLE[:epub][:internal_navigation] \ - ? '' - : %{<p class="align_right">#{firstseg}</p>} - end def manifest_link(text) - %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>} + %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top">#{text}</a>} end def concordance_link(text) if @md.concord_make - %{<a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> + %{<a href="#{@md.file.base_filename.html_concordance}" target="_top"> #{text} </a>} else '' @@ -1719,17 +1688,16 @@ WOK def head %{#{doc_type} <head> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> -#{@vz.color_body} -#{@vz.js_top}} +#{@vz.color_body}} end def concordance if @md.concord_make %{#{@vz.margin_css} <h4 class="toc"> - <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}> + <a href="./#{@md.file.base_filename.html_concordance}"> <i>Concordance</i> </a> </h4> @@ -1740,9 +1708,9 @@ WOK end end def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end + (type=='vertical') \ + ? links_guide_vertical_open + : links_guide_horizontal_open end def prefix_a end @@ -1787,7 +1755,7 @@ WOK def metadata %{#{@vz.margin_css} <h4 class="toc"> - <a href="#{@metalink}" #{@vz.js_metalink}> + <a href="#{@metalink}"> <i>MetaData</i> </a> </h4> @@ -1805,7 +1773,7 @@ WOK #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - #{@md.html_title} </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> #{@vz.color_body}} @@ -1838,7 +1806,7 @@ WOK 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 - if t_o.class==Hash + if t_o.is_a?(Hash) @txt =t_o[:txt] || nil @ocn =t_o[:ocn] || nil @ocn_display =t_o[:ocn_display] || nil @@ -1853,12 +1821,12 @@ WOK if @format and not @format.empty? if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ headname=$1 #format[/\d~(\S+)/m,1] - @headname=if headname =~/^[a-zA-Z]/; %{<id="#{headname}">} #consider: h_#{headname} - else %{<id="h#{headname}"></a>} - end - @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname} - else %{<a name="h#{headname}" id="h#{headname}"></a>} - end + @headname=(headname =~/^[a-zA-Z]/) \ + ? %{<id="#{headname}">} + : %{<id="h#{headname}"></a>} + @headname=(headname =~/^[a-zA-Z]/) \ + ? %{<a name="#{headname}" id="#{headname}"></a>} + : %{<a name="h#{headname}" id="h#{headname}"></a>} end end elsif t_o.class.inspect =~/Object/ |