diff options
Diffstat (limited to 'lib/sisu/v0/html.rb')
-rw-r--r-- | lib/sisu/v0/html.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5b9639dd..5f0d0de9 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -106,7 +106,7 @@ module SiSU_HTML toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc data=@tuned_file_array - scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(data,@md,toc,links_guide).in_common #watch + scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(@md,toc,links_guide).in_common #watch SiSU_HTML::Source::Seg.new(data,@md).songsheet data=@tuned_file_array scr=SiSU_HTML::Source::Scroll.new(data,@md).songsheet @@ -246,7 +246,7 @@ module SiSU_HTML end end class Toc <Links_guide - @@toc={ :seg=>[],:scr=>[] } + @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @@seg_url='' @@dp,@@firstseg=nil,nil def initialize(data='',md=nil) @@ -255,12 +255,13 @@ module SiSU_HTML @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @pat_heading=/^(?:#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*)?(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/ - @tell=SiSU_Screen::Ansi.new(@md.cmd) + @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ toc=nil @@firstseg=nil + @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @data.each do |para| if para =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/ para_toc=para.dup @@ -282,6 +283,7 @@ module SiSU_HTML if toc begin @@toc[:seg] << toc[:seg] if toc[:seg] + @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] @@toc[:scr] << toc[:scr] if toc[:scr] rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error end @@ -291,6 +293,10 @@ module SiSU_HTML @md.firstseg=@@firstseg @@toc end + def minitoc + minitoc=@@toc[:seg_mini].to_s + '<div class="toc">' + minitoc + '</div>' + end protected def rss #sort all wrong, disabled but kept @@toc[:seg] <<<<WOK @@ -322,11 +328,13 @@ WOK format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) @@toc[:scr] << format_head_toc.metadata @@toc[:seg] << format_head_toc.seg_metadata + @@toc[:seg_mini] << format_head_toc.mini_seg_metadata end def level_word_index format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@d0c) @@toc[:scr] << format_head_toc.concordance @@toc[:seg] << format_head_toc.concordance + @@toc[:seg_mini] << format_head_toc.mini_concordance end def level_1 para=@data @@ -350,6 +358,10 @@ WOK format_toc.lev0 else format_toc.lev1 end + toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ + format_toc.lev0 + else format_toc.mini_lev1 + end title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') @@ -385,6 +397,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev2 + toc[:seg_mini]=format_toc.mini_lev2 if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') @@ -408,6 +421,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev3 + toc[:seg_mini]=format_toc.mini_lev3 if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ m=/#{$1}/ para.gsub!(m,'') @@ -433,6 +447,10 @@ WOK %{ <a href="#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}" target="_top"> \\2 </a> }) + if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m + m=/#{$1}/m + seg_link.gsub!(m,'') + end @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, @@ -443,6 +461,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,seg_link) toc={} toc[:seg]=format_toc.lev4 + toc[:seg_mini]=format_toc.mini_lev4 if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ m=/#{$1}/ para.gsub!(m,'') @@ -476,6 +495,7 @@ WOK </a>} format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev5 + toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}</a>} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -504,6 +524,7 @@ WOK </a>} format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev6 + toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}</a>} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -535,8 +556,8 @@ WOK end end class Scroll_head_and_segtoc < Toc - def initialize(data,md='',toc='',links_guide_toc='') - @data,@md,@toc,@links_guide_toc=data,md,toc,links_guide_toc + def initialize(md='',toc='',links_guide_toc='') + @md,@toc,@links_guide_toc=md,toc,links_guide_toc @vz=SiSU_Env::Get_init.instance.skin end def in_common |