From 2b884fb73428186df29bf22ff38d77e5d2f823cf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 Feb 2012 21:10:19 -0500 Subject: v3dv: --redirect (--redirect=dir_path) & --dump (--dump=dir_path) + consequences * --dump places output in directory specified, if none specified in the current directory (pwd). * --redirect places output in subdirectory under specified directory, subdirectory uses the filename (without the suffix). If no output directory is specified places the subdirectory under the current directory (pwd). * html, css incorporated into each file (concordance & manifest included) * html, xhtml & xmls, css copied into css subdirectory (not used by html as embedded) * html xmls, images copied to output directory * no links to manifest * manifest with relative links only * longer html filenames given to avoid names clashing (e.g. for toc, manifest, concordance) * html, epub, remove manifest toc links * -j copy images associated with file (images used by html & xmls) * automatically invoked by --dump & redirect * v3 v3dv: document --redirect, --dump, -j update sisu_commands.sst [documents not generated until v3.2.0 (when v3dv branch is merged into v3)] --- lib/sisu/v3dv/html_format.rb | 116 ++++++++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 29 deletions(-) (limited to 'lib/sisu/v3dv/html_format.rb') diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index 29d1bfcb..d8b44760 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -96,6 +96,7 @@ module SiSU_HTML_Format end end class HeadInformation + require_relative 'css' # css.rb require_relative 'shared_xml' # shared_xml.rb include SiSU_Viz attr_reader :md,:rdf,:vz @@ -103,12 +104,61 @@ module SiSU_HTML_Format @md=md # DublinCore 1 - title @vz=SiSU_Env::GetInit.instance.skin - @css=SiSU_Env::CSS_Stylesheet.new(md) @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) - @toc,@index='toc','index' @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil + @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @index='index' + @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" + end + def url_path_image_sys + (@o_str.dump_or_redirect?) \ + ? './image' + : "#{Xx[:html_relative2]}_sisu/image_sys" + end + def icon + def up + 'arrow_up_red.png' + end + def next + 'arrow_next_red.png' + end + def previous + 'arrow_prev_red.png' + end + def dot_clear + 'dot_clear.png' + end + def dot_white + 'dot_white.png' + end + def dot + dot_white + end + self + end + def png_nav + def toc + %{TOC} + end + def pre + %{<< previous} + end + def nxt + %{next >>} + end + def dot_toc + %{^} + end + def dot_pre + %{<} + end + def dot_nxt + %{>} + end + self end def doc_types #used in toc & seg_nav_band scroll=seg='' @@ -154,8 +204,9 @@ module SiSU_HTML_Format super(md) @md=md @cf_defaults=SiSU_Env::InfoProcessingFlag.new - @env=SiSU_Env::InfoEnv.new(@md.fns) - @file=SiSU_Env::FileOp.new(@md) + @env=SiSU_Env::InfoEnv.new(md.fns) + @file=SiSU_Env::FileOp.new(md) + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure end def home %{ @@ -187,16 +238,19 @@ module SiSU_HTML_Format env.widget.search_form('sisusearch',nil,nil,true) end def manifest - manifest_lnk=if @file.output_dir_structure.by_language_code? \ - or @file.output_dir_structure.by_filetype? - "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" - else @file.base_filename.manifest - end + if not @o_str.dump_or_redirect? + manifest_lnk=if @file.output_dir_structure.by_language_code? \ + or @file.output_dir_structure.by_filetype? + "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" + else @file.base_filename.manifest + end %{ #{@vz.nav_txt_manifest} } + else '' + end end def pdf #retired 2.7.9 pdf=if @md.programs[:pdf] \ @@ -267,6 +321,7 @@ module SiSU_HTML_Format def initialize(md) super(md) @md=md + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure end def scroll_head_navigation_band pdf=if @md.programs[:pdf] @@ -293,14 +348,14 @@ WOK   - #{@vz.png_nav_toc} + #{png_nav.toc}   #{@vz.table_close}

} end def seg_head_navigation_band(type='') firstseg=%{ - #{@vz.png_nav_nxt} + #{png_nav.nxt} } if @md.firstseg =~/\S+/ %{
@@ -319,7 +374,7 @@ WOK @tocband_segtoc=make_scroll_seg_pdf end firstseg=%{ - #{@vz.png_nav_nxt} + #{png_nav.nxt} } if @md.firstseg =~/\S+/ %{
@@ -394,7 +449,7 @@ WOK #{rdf.metatag_html} -#{@css.html}#{@css.html_seg} +#{@stylesheet.css_head} #{@vz.color_body} @@ -529,12 +584,15 @@ WOK #{@vz.table_close}} end def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} + if not @o_str.dump_or_redirect? + manifest=manifest_link(@vz.nav_txt_manifest) + %{#{@vz.margin_txt_3} #{@vz.paragraph_font_small} #{manifest} #{@vz.table_close}} + else '' + end end def concordance #check structure concord=concordance_link(@vz.nav_txt_concordance) @@ -618,14 +676,14 @@ WOK end end class HeadSeg < HeadInformation - def initialize(md) #(md='') + def initialize(md) super(md) end def title_banner(title,subtitle,creator) end def dot_control_pre_next pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}" - up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" + up=@toc nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" if nxt=~/sisu_manifest\.html/ @file=SiSU_Env::FileOp.new(@md) if @md @@ -637,56 +695,56 @@ WOK %{
- #{@vz.png_nav_dot_pre} + #{png_nav.dot_pre} - #{@vz.png_nav_dot_toc} + #{png_nav.dot_toc} - #{@vz.png_nav_dot_nxt} + #{png_nav.dot_nxt} #{@vz.table_close}} end def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" - up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" + up=@toc nxt="#{@md.file.base_filename.html_segtoc}" %{} pre=%{} if f_pre==true nxt=%{} if f_nxt==true if nxt =~/sisu_manifest.html/ @@ -853,7 +911,7 @@ WOK #{rdf.metatag_html} -#{@css.html_seg} +#{@stylesheet.css_head_seg} #{@vz.color_body} -- cgit v1.2.3
- #{@vz.png_nav_dot_pre} + #{png_nav.dot_pre} - #{@vz.png_nav_dot_toc} + #{png_nav.dot_toc} - #{@vz.png_nav_dot_nxt} + #{png_nav.dot_nxt} #{@vz.table_close}} end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{ - - #{@vz.png_nav_toc} + + #{png_nav.toc} - #{@vz.png_nav_pre} + #{png_nav.pre} - #{@vz.png_nav_nxt} + #{png_nav.nxt}