diff options
Diffstat (limited to 'lib/sisu/v4/html.rb')
-rw-r--r-- | lib/sisu/v4/html.rb | 114 |
1 files changed, 63 insertions, 51 deletions
diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index 57ac79c1..9e6ec0fa 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -101,16 +101,22 @@ module SiSU_HTML data=nil tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions data=tuned_file_array - scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll + if @opt.act[:html_scroll][:set]==:on + scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll + end toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc data=tuned_file_array scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch - SiSU_HTML::Source::Seg.new(@md,data).songsheet + if @opt.act[:html_seg][:set]==:on + SiSU_HTML::Source::Seg.new(@md,data).songsheet + end data=tuned_file_array - scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet - scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish - SiSU_HTML::Source::Output.new(scroll,@md).scroll + if @opt.act[:html_scroll][:set]==:on + scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet + scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish + SiSU_HTML::Source::Output.new(scroll,@md).scroll + end rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -541,14 +547,16 @@ WOK toc_shared << format_head_toc.scroll_head_title_banner_open @segtoc << format_head_toc.seg_head_title_banner_open tmp_head=nil - doc_title_endnote=@md.title.full.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>') + doc_title_endnote=@md.title.full.gsub(/(\*+)/, + '<sup><a href="#endnotes">\1</a></sup>') tmp_head=doc_title_endnote + "\n" txt_obj={ txt: tmp_head } format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if defined? @md.creator.author - creator_endnote=@md.creator.author.gsub(/(\*+)/,%{ <sup><a href="#notes">\\1</a></sup>}) + creator_endnote=@md.creator.author.gsub(/(\*+)/, + %{ <sup><a href="#notes">\\1</a></sup>}) tmp_head=creator_endnote + "\n" txt_obj={ txt: tmp_head } format_txt_obj=SiSU_HTML_Format::FormatTextObject.new(@md,txt_obj) @@ -587,7 +595,9 @@ WOK 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=@segtoc.flatten.compact #watch - SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc + if @md.opt.act[:html_seg][:set]==:on + SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc + end @segtoc=[] @toc[:scr],@toc[:seg]=[],[] toc_shared @@ -616,56 +626,58 @@ WOK @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure end def scroll - begin - @filename_html_scroll=@file.write_file.html_scroll - @data.each do |para| - para=para.strip. - gsub(/<:.+?>/,''). - gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). - gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). - #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). - gsub(/#{Rx[:mx_fa_clean]}/,'') - unless para =~/\A\s*\Z/ - @filename_html_scroll.puts para,"\n" + if @md.opt.act[:html_scroll][:set]==:on + begin + @filename_html_scroll=@file.write_file.html_scroll + @data.each do |para| + para=para.strip. + gsub(/<:.+?>/,''). + gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). + gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). + #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). + gsub(/#{Rx[:mx_fa_clean]}/,'') + unless para =~/\A\s*\Z/ + @filename_html_scroll.puts para,"\n" + end end + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure + @filename_html_scroll.close end - rescue - SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do - __LINE__.to_s + ':' + __FILE__ - end - ensure - @filename_html_scroll.close end end def segtoc - begin - @filename_html_segtoc=@file.write_file.html_segtoc - @data.each do |para| - para=para.strip. - gsub(/<!.+?!>/,''). - gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). - gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) - unless para =~/\A\s*\Z/ - @filename_html_segtoc.puts para,"\n" + if @md.opt.act[:html_seg][:set]==:on + begin + @filename_html_segtoc=@file.write_file.html_segtoc + @data.each do |para| + para=para.strip. + gsub(/<!.+?!>/,''). + gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). + gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1) + unless para =~/\A\s*\Z/ + @filename_html_segtoc.puts para,"\n" + end end + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end + ensure + @filename_html_segtoc.close + pwd_set=Dir.pwd + idx_lnk=(@o_str.dump_or_redirect?) \ + ? @file.base_filename.manifest + : @file.base_filename.html_segtoc + mlnk=@file.base_filename.html_seg_index + Dir.chdir(@file.output_path.html_seg.dir) + FileUtils::rm_f(mlnk) + FileUtils::ln_s(idx_lnk,mlnk) + Dir.chdir(pwd_set) end - rescue - SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do - __LINE__.to_s + ':' + __FILE__ - end - ensure - @filename_html_segtoc.close - pwd_set=Dir.pwd - idx_lnk=if @o_str.dump_or_redirect? - @file.base_filename.manifest - else - @file.base_filename.html_segtoc - end - mlnk=@file.base_filename.html_seg_index - Dir.chdir(@file.output_path.html_seg.dir) - FileUtils::rm_f(mlnk) - FileUtils::ln_s(idx_lnk,mlnk) - Dir.chdir(pwd_set) end end end |