diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-01-06 23:05:26 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-01-06 23:05:26 -0500 |
commit | 4075d476731a7a1c29e399d60f6baa210f3d1cb4 (patch) | |
tree | b0fab3d856f64f0562b7b7da317cf79c3b3e05f1 /lib/sisu/v5/html_segments.rb | |
parent | debian/changelog (4.2.16-1) (diff) | |
parent | v5: heading recalibration, code (downstream) changes (diff) |
Merge tag 'sisu_4.2.17' into debian/sid
SiSU 4.2.17
Diffstat (limited to 'lib/sisu/v5/html_segments.rb')
-rw-r--r-- | lib/sisu/v5/html_segments.rb | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index d6b341ac..b710db81 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.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: @@ -143,8 +144,8 @@ module SiSU_HTML_Seg @@seg_name,@@seg_name_html=[],[] @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 - @@is4=@@is3=@@is2=@@is1=0 - @@heading1=@@heading2=@@heading3=@@heading4=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 + @@heading0=@@heading1=@@heading2=@@heading3=@@heading4=0 @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(11){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@ -186,7 +187,7 @@ module SiSU_HTML_Seg protected def articles(data) tracking,newfile=0,0 - @@is4=@@is3=@@is2=@@is1=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 printed_endnote_seg='n' idx_html=nil if @md.book_idx @@ -233,10 +234,7 @@ module SiSU_HTML_Seg if (dob.is==:heading \ || dob.is==:heading_insert) \ && dob.ln==4 - if dob.ocn==0 - @@heading4=dob.obj - else @@heading4=dob.obj - end + @@heading4=dob.obj @@is4=newfile=1 end if (dob.is==:heading \ @@ -257,10 +255,16 @@ module SiSU_HTML_Seg @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==0 + @@heading0=dob.obj + @@is4,@@is3,@@is2,@@is1,@@is0=0,0,0,0,1 + end if (@@is1 && !@@is2 && !@@is3 && !@@is4) if not (dob.is==:heading \ || dob.is==:heading_insert) \ - && dob.ln==1 + && dob.ln==0 $_ #; check end end @@ -283,9 +287,7 @@ module SiSU_HTML_Seg fn=@md.file.base_filename.html_seg(fnh) segfilename="#{@file.output_path.html_seg.dir}/#{fn}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - minitoc=(@make.build.html_minitoc?) \ - ? @minitoc - : '' + minitoc=(@make.build.html_minitoc?) ? @minitoc : '' if dob.is==:heading \ || (@@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/) SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output @@ -352,7 +354,7 @@ module SiSU_HTML_Seg && (@make.build.html_navigation_bar?) x=if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1-6]/) + && (dob.ln.to_s =~/^[0-6]/) x=if @@tracker < @@seg_total-1 format_head_seg.dot_control_pre_next else @@ -371,31 +373,38 @@ module SiSU_HTML_Seg if @make.build.html_navigation? if @@tracker < @@seg_total-1 @@segtocband=if @@tracker==0 - format_head_seg.toc_next2 #if format_head_seg.toc_next2 + format_head_seg.toc_next2 else - format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2 + format_head_seg.toc_pre_next2 end - else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 + else @@segtocband=format_head_seg.toc_pre2 end else @@segtocband='' end @p_num ||= '' - if @@is1==1 + if @@is0==1 @author=%{<b>#{@md.author}</b>\n} if @md.author.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - conditional_div_close=if @@get_hash_fn =~/metadata/ #watch - '</div>' - else '' - end - @@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << '<br />' << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) if @title_banner_ @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') end - ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ocn=(@@heading0[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' + @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) + txt_obj={ txt: @@heading0, ocn_display: @p_num.ocn_display } + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading0.gsub(clean,'') + @@heading0=@@heading0.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') + end + if @@is1==1 + heading1=@@heading1 + ocn=(heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ ? $1 : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } + txt_obj={ txt: heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') @@ -553,7 +562,7 @@ module SiSU_HTML_Seg if @md.flag_auto_endnotes if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1234]/) \ + && (dob.ln.to_s =~/^[0-4]/) \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array |