diff options
-rw-r--r-- | lib/sisu/v0/html_segments.rb | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 7c97925e..fe2966df 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -70,6 +70,7 @@ module SiSU_HTML_seg @@tablehead,@@number_of_cols=0,0 @@flag_group=false @@dp,@@segtocband=nil,nil + @@fns_previous='' attr_reader :seg_name_html,:seg_name_html_tracker def initialize(data='',md='') @data,@md=data,md @@ -396,18 +397,24 @@ module SiSU_HTML_seg @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array @@seg_endnotes_array=[] if para=~/^4~/ + @@fns_previous=@md.fns if para=~/^1~meta/ end - end - if para =~/^4~/ #% EXTRACTION OF SUB-TOCs - @@seg_subtoc[@@fn]=@@seg_subtoc_array - @@seg_subtoc_array=[] - end - if para =~/^4~/ #% SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs - m=para[/^4~(\S+).+?<~(\d+);(?:[oh]|4:)\d+;\w\d+><#@dp:#@dp>$/] - if m; @@fn,@@to_lev4=$1,$2 if m # changed 2004w07 #endnotes and sub-tocs - else - m=para[/^4~(\S+)/] - @@fn,@@to_lev4=$1,'nonum' if m # changed 2005w13 + if para =~/^4~/ #% EXTRACTION OF SUB-TOCs + @@seg_subtoc[@@fn]=@@seg_subtoc_array + @@seg_subtoc_array=[] + end + if para =~/^4~/ #% SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs + if para !~/^4~metadata/ + m=para[/^4~(\S+).+?<~(\d+);(?:[oh]|4:)\d+;\w\d+><#@dp:#@dp>$/] + end + if m; @@fn,@@to_lev4=$1,$2 if m # changed 2004w07 #endnotes and sub-tocs + else + if para !~/^4~metadata/ + m=para[/^4~(\S+)/] + @@fn,@@to_lev4=$1,'nonum' if m # changed 2005w13 + else @@fn='' + end + end end end if para =~/^[56]~\S*\s+(.+)?<~(\d+);(?:h|[56]:)\d+;\w\d+><#@dp:#@dp>$/ |