aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/html_segments.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-01-06 23:02:50 -0500
committerRalph Amissah <ralph@amissah.com>2014-01-06 23:03:02 -0500
commit5fb49b575a548313b827fd66fd7ecce514fe0e45 (patch)
treee7541789806c1bc086c05d06f0af2b9d54abb1c1 /lib/sisu/v5/html_segments.rb
parentv5: vim syntax, v5.2 match heading level D~ (diff)
v5: heading recalibration, code (downstream) changessisu_4.2.17
* here no doubt remains breakage (test, fix & test again)
Diffstat (limited to 'lib/sisu/v5/html_segments.rb')
-rw-r--r--lib/sisu/v5/html_segments.rb56
1 files changed, 32 insertions, 24 deletions
diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb
index 94df2eba..b710db81 100644
--- a/lib/sisu/v5/html_segments.rb
+++ b/lib/sisu/v5/html_segments.rb
@@ -144,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
@@ -187,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
@@ -234,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 \
@@ -258,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
@@ -284,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
@@ -353,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
@@ -372,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(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/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(/&nbsp;<a name="-[\d*+]+" href="#_[\d*+]+">&nbsp;<sup>[\d*+]+<\/sup>&nbsp;<\/a>/,'')
@@ -554,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