From 839f03743a261716e4c6b5f97f4bd5723ff97eb4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 5 Mar 2013 21:43:31 -0500 Subject: v4: html, epub, minor "cleaning" of output --- lib/sisu/v4/epub_format.rb | 15 ++++++++------- lib/sisu/v4/html_format.rb | 30 ++++++++++++------------------ lib/sisu/v4/html_scroll.rb | 2 +- lib/sisu/v4/html_segments.rb | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 49139667..683228c3 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -70,25 +70,26 @@ module SiSU_EPUB_Format make=SiSU_Env::ProcessingSettings.new(@md) if make.build.ocn? ocn_class='ocn' - if @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/,'') + if @ocn==nil \ + or @ocn.to_i==0 \ + or @ocn.empty? + %{} else @ocn.gsub(/^(\d+|)$/, %{}) end else - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/,'') + %{} end end def name - %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - (@ocn.empty?) ? '' : %{id="o#{@ocn}"} + (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end end class CSS diff --git a/lib/sisu/v4/html_format.rb b/lib/sisu/v4/html_format.rb index 25a8dbee..f96db380 100644 --- a/lib/sisu/v4/html_format.rb +++ b/lib/sisu/v4/html_format.rb @@ -70,27 +70,25 @@ module SiSU_HTML_Format make=SiSU_Env::ProcessingSettings.new(@md) if make.build.ocn? ocn_class='ocn' - if @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{ }) + if @ocn.to_i==0 \ + or @ocn.empty? + %{} else @ocn.gsub(/^(\d+|)$/, %{}) end else - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{}) + %{} end end def name - %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - %{id="o#{@ocn}"} + (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end end class HeadInformation @@ -517,15 +515,13 @@ WOK %{

Prefix: #{@md.prefix_b}

} end def scroll_head_title_banner_open - %{

-#{@md.icon} -
+ icon=@md.icon ? %{
\n#{@md.icon}\n
} : '' + %{#{icon} #{@vz.banner_instrument_cover_band_scr}} end def seg_head_title_banner_open - %{
- #{@md.icon} -
+ icon=@md.icon ? %{
\n#{@md.icon}\n
} : '' + %{#{icon} #{@vz.banner_instrument_cover_band_seg}} end def make_scroll @@ -619,8 +615,6 @@ WOK
- - } end def seg_navigation_tail #this is a bug area, look up and "tidy" @@ -1029,7 +1023,7 @@ WOK end def heading_normal(tag,attrib) section_break=(tag=~/h[1-4]/) \ - ? '


' + ? '


' : '' %{#{section_break}
diff --git a/lib/sisu/v4/html_scroll.rb b/lib/sisu/v4/html_scroll.rb index 84ec0515..f3711460 100644 --- a/lib/sisu/v4/html_scroll.rb +++ b/lib/sisu/v4/html_scroll.rb @@ -129,7 +129,7 @@ module SiSU_HTML_Scroll end elsif dob.is==:break \ and dob.from==:markup - '


' + '


' elsif dob.is==:heading_insert x=if dob.ln==1 unless dob.obj.empty? diff --git a/lib/sisu/v4/html_segments.rb b/lib/sisu/v4/html_segments.rb index 21fdc7cc..55335845 100644 --- a/lib/sisu/v4/html_segments.rb +++ b/lib/sisu/v4/html_segments.rb @@ -480,7 +480,7 @@ module SiSU_HTML_Seg sto.table elsif dob.is==:break \ and dob.from==:markup - '


' + '


' end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type -- cgit v1.2.3