aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/html.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/html.rb')
-rw-r--r--lib/sisu/v5/html.rb70
1 files changed, 48 insertions, 22 deletions
diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb
index 7a1c4b60..f473f1b7 100644
--- a/lib/sisu/v5/html.rb
+++ b/lib/sisu/v5/html.rb
@@ -8,7 +8,8 @@
* Author: Ralph Amissah
* Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved.
+ 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah,
+ All Rights Reserved.
* License: GPL 3 or later:
@@ -258,12 +259,13 @@ module SiSU_HTML
toc=if dob_toc.is ==:heading \
|| dob.is==:heading_insert
toc=case dob_toc.ln
- when 1; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1
- when 2; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2
- when 3; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3
- when 4; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4
- when 5; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5
- when 6; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6
+ when 0 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_0
+ when 1 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1
+ when 2 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2
+ when 3 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3
+ when 4 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4
+ when 5 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5
+ when 6 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6
else nil
end
end
@@ -334,6 +336,29 @@ WOK
@@toc[:seg_mini] << format_head_toc.mini_concordance
end
# <-- not used
+ def level_0
+ dob=@data
+ linkname,link=dob.obj.strip,dob.ocn
+ if link \
+ and link !~/#/ #% keep eye on link
+ SiSU_HTML_Format::ParagraphNumber.new(@md,link)
+ end
+ title=linkname
+ toc={}
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
+ toc[:seg]=format_toc.lev0
+ toc[:seg_mini]=format_toc.mini_lev0
+ title=if dob.ocn ==0 then linkname
+ else
+ @@toc[:scr] << '<br />'
+ %{<b><a href="##{dob.ocn}">#{linkname}</a></b>}
+ end
+ txt_obj={ txt: title }
+ format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev0
+ toc
+ end
def level_1
dob=@data
linkname,link=dob.obj.strip,dob.ocn
@@ -341,7 +366,7 @@ WOK
and link !~/#/ #% keep eye on link
SiSU_HTML_Format::ParagraphNumber.new(@md,link)
end
- title=if dob.obj !~/Metadata/ then linkname
+ title=if dob.obj !~/^Metadata$/ then linkname
else
link='metadata'
%{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
@@ -369,16 +394,13 @@ WOK
end
else
@@toc[:scr] << '<br />'
- link=(dob.ln) \
- ? dob.ln
- : ''
- %{<b><a href="##{link}">#{linkname}</a></b>}
+ %{<b><a href="##{dob.ocn}">#{linkname}</a></b>}
end
txt_obj={ txt: title }
format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=if dob.name =~/^meta/ \
- and dob.obj =~/Document Information/
- format_toc.lev0
+ toc[:scr]=if dob.obj =~/^Metadata$/ then ''
+ elsif txt_obj[:txt] =~/<a href="#">/
+ format_toc.lev1.gsub(/<a href="#">|<\/a>/,'')
else format_toc.lev1
end
toc
@@ -400,7 +422,10 @@ WOK
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev2
+ toc[:scr]=if txt_obj[:txt] =~/<a href="#">/
+ format_toc.lev2.gsub(/<a href="#">|<\/a>/,'')
+ else format_toc.lev2
+ end
end
toc
end
@@ -421,7 +446,10 @@ WOK
title=%{#{p_num.goto}#{linkname}</a>}
txt_obj={ txt: title }
format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
- toc[:scr]=format_toc.lev3
+ toc[:scr]=if txt_obj[:txt] =~/<a href="#">/
+ format_toc.lev3.gsub(/<a href="#">|<\/a>/,'')
+ else format_toc.lev3
+ end
end
toc
end
@@ -563,9 +591,8 @@ WOK
format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
dochead=format_head_toc.head
dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
- ads=SiSU_HTML_Promo::Ad.new(@md)
- toc_shared << dochead << ads.div.major
- @segtoc << format_head_toc.head << ads.div.major
+ toc_shared << dochead
+ @segtoc << format_head_toc.head
if @make.build.html_top_band?
toc_shared << format_head_toc.scroll_head_navigation_band
end
@@ -628,8 +655,7 @@ WOK
#Segtoc tail added here
@segtoc << "</p>\n" #bugfix sort later DEBUGNOW
@segtoc << @seg_toc_band_bottom
- ads=SiSU_HTML_Promo::Ad.new(@md)
- @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close
+ @segtoc << format_head_toc.seg_navigation_tail << format_head_toc.html_close
@segtoc=@segtoc.flatten.compact #watch
if @md.opt.act[:html_seg][:set]==:on
SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc