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/concordance.rb | 4 +- lib/sisu/v3dv/css.rb | 92 ++++++++++++ lib/sisu/v3dv/defaults.rb | 2 +- lib/sisu/v3dv/html.rb | 27 ++-- lib/sisu/v3dv/html_format.rb | 116 +++++++++++---- lib/sisu/v3dv/hub.rb | 8 +- lib/sisu/v3dv/manifest.rb | 70 +++++++--- lib/sisu/v3dv/options.rb | 30 +++- lib/sisu/v3dv/param.rb | 2 - lib/sisu/v3dv/shared_images.rb | 125 +++++++++++++++++ lib/sisu/v3dv/sisupod_make.rb | 2 +- lib/sisu/v3dv/sysenv.rb | 310 ++++++++++++++++++++++++++++------------- lib/sisu/v3dv/xhtml.rb | 4 +- lib/sisu/v3dv/xml.rb | 4 +- lib/sisu/v3dv/xml_dom.rb | 4 +- lib/sisu/v3dv/xml_format.rb | 6 +- 16 files changed, 625 insertions(+), 181 deletions(-) create mode 100644 lib/sisu/v3dv/shared_images.rb (limited to 'lib') diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb index 82c53e7a..7ec234bc 100644 --- a/lib/sisu/v3dv/concordance.rb +++ b/lib/sisu/v3dv/concordance.rb @@ -121,7 +121,7 @@ WOK def create head_banner=SiSU_HTML_Format::HeadToc.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n") - @css=SiSU_Env::CSS_Stylesheet.new(@md) + stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet toc='
' + minitoc + '
' < @@ -136,7 +136,7 @@ WOK - #{@css.html_seg} + #{stylesheet.css_head_seg} #{@vz.js_head} diff --git a/lib/sisu/v3dv/css.rb b/lib/sisu/v3dv/css.rb index 522aae7e..cdcd16cd 100644 --- a/lib/sisu/v3dv/css.rb +++ b/lib/sisu/v3dv/css.rb @@ -59,6 +59,98 @@ module SiSU_Style require_relative 'sysenv' # sysenv.rb require_relative 'defaults' # defaults.rb + class CSS_HeadInfo + def initialize(md,ft='html') + @md,@ft=md,ft + @env=SiSU_Env::InfoEnv.new('',md) + @fn_css ||=SiSU_Env::CSS_Default.new + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + css_copy + end + def stylesheet + def css_path + SiSU_Env::CSS_Stylesheet.new(@md) + end + def css_embed_content + @css_embed_content ||=SiSU_Style::CSS.new + end + def css_embed? + if @ft=='html' \ + && @o_str.dump_or_redirect? + true + else + false + end + end + def css_embed(css) + <<-WOK + + WOK + end + def css_action + style_css=SiSU_Style::CSS.new + css=case @ft + when 'html' + css=css_embed_content.html + css_embed(css) + when 'xhtml' + css_path.xhtml + when 'xml_sax' + css_path.xml_sax + when 'xml_dom' + css_path.xml_dom + else + css_embed_content.html + end + end + def css_head + (css_embed?) \ + ? css_action\ + : "#{css_path.html}#{css_path.html_seg}" + end + def css_head_seg + (css_embed?) \ + ? css_action \ + : css_path.html_seg + end + def css_head_xml + css_action + end + self + end + def css_copy + if @o_str.dump_or_redirect? + css=SiSU_Style::CSS.new + if @o_str.dump? + css_pth="#{@md.opt.opt_act[:dump][:inst]}/#{@env.path.style}" + elsif @o_str.redirect? + css_pth="#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}/#{@env.path.style}" + end + FileUtils::mkdir_p(css_pth) unless FileTest.directory?(css_pth) + case @ft + when 'html' + style=File.new("#{css_pth}/#{@fn_css.html}",'w') + style << css.html + style.close + when 'xhtml' + style=File.new("#{css_pth}/#{@fn_css.xhtml}",'w') + style << css.xhtml + style.close + when 'xml_sax' + style=File.new("#{css_pth}/#{@fn_css.xml_sax}",'w') + style << css.xml_sax + style.close + when 'xml_dom' + style=File.new("#{css_pth}/#{@fn_css.xml_dom}",'w') + style << css.xml_dom + style.close + css_path.xml_dom + end + end + end + end class CSS def initialize @vz=SiSU_Env::GetInit.instance.skin diff --git a/lib/sisu/v3dv/defaults.rb b/lib/sisu/v3dv/defaults.rb index 1c9dd94f..eab42b71 100644 --- a/lib/sisu/v3dv/defaults.rb +++ b/lib/sisu/v3dv/defaults.rb @@ -1040,7 +1040,7 @@ module SiSU_Viz def png_book %{Cameron May Books} end - #% png_nav + #% png_nav #not currently used def png_nav_home end def png_nav_toc diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index ec7b0573..75d89382 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -138,14 +138,10 @@ module SiSU_HTML def link_images @symlnk.images end - def directories - title=File.basename(@md.fns,'.rb') - end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') - @md.file_type='html' if @md.opt.cmd =~/[hon]/ - directories + @md.file_type='html' if @md.opt.cmd =~/[hw]/ newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/ dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @@ -611,7 +607,8 @@ WOK class Output def initialize(data='',md='') @data,@md=data,md - @file=SiSU_Env::FileOp.new(@md) + @file=SiSU_Env::FileOp.new(md) + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure end def scroll begin @@ -646,15 +643,17 @@ WOK rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @filename_html_segtoc.close - unless FileTest.file?("#{@file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg_index}") - pwd_set=Dir.pwd - idx_lnk=@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) + 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 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} diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb index 4924297a..fd7909ec 100644 --- a/lib/sisu/v3dv/hub.rb +++ b/lib/sisu/v3dv/hub.rb @@ -202,7 +202,7 @@ module SiSU when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s share_src.rb when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb # when /^source_kdissert$/; SiSU_KdiSource::Source.new(@opt).read # -S share_src_kdissert.rb - when /^digests$/; SiSU_DigestView::Source.new(@opt).read # -N digests.rb + when /^digests$/; SiSU_DigestView::Source.new(@opt).read # -N digests.rb when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a plaintext.rb when /^po4a$/; SiSU_Po4a::Source.new(@opt).read # -P po4a.rb #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g @@ -216,6 +216,7 @@ module SiSU when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b xhtml.rb when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x xml.rb when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X xml_dom.rb + when /^shared_images$/; SiSU_Images::Source.new(@opt).read # -j shared_images.rb #when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f when /^xml_scaffold$/; SiSU_XML_Scaffold::Source.new(@opt).read # -k xml_scaffold.rb when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check @@ -357,7 +358,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ require_relative 'sst_convert_markup' # sst_convert_markup.rb - elsif @opt.cmd =~/([abCcDdeFGgHhIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ + elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ @@ -518,6 +519,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml op('xhtml','xhtml sax') end + if @opt.act[:images][:bool] #% --images, -j + op('shared_images','images') + end if @opt.act[:concordance][:bool] #% --concordance, -w op('concordance','Concordance') end diff --git a/lib/sisu/v3dv/manifest.rb b/lib/sisu/v3dv/manifest.rb index 3310fa98..19fdc65c 100644 --- a/lib/sisu/v3dv/manifest.rb +++ b/lib/sisu/v3dv/manifest.rb @@ -106,6 +106,12 @@ module SiSU_Manifest @fnb=@md.fnb @base_url="#{@env.url.root}/#{@fnb}" @f=SiSU_Env::FileOp.new(@md) + @o_str=SiSU_Env::OutputStructure.new(md).output_dir_structure + @image_path=if @o_str.dump_or_redirect? + %{./image} + else + %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys} + end @base_path=@f.output_path.manifest.dir @@dg ||=SiSU_Env::InfoEnv.new.digest.type @dg=@@dg @@ -113,6 +119,7 @@ module SiSU_Manifest @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @brace_url=SiSU_Viz::Skin.new.url_decoration + @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet end def output manifest=@f.write_file.manifest @@ -122,17 +129,26 @@ module SiSU_Manifest manifest << x end end + def url_make(url,file,src=nil) + if @o_str.dump_or_redirect? + '' + elsif :src + %{
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}} + else + %{

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

} + end + end def summarize(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} + @manifest[:html] << %{\n} end def summarize_html_seg(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} + @manifest[:html] << %{\n} end def summarize_sources(id,file,pth,rel,url) sys=SiSU_Env::SystemCall.new @@ -143,7 +159,7 @@ module SiSU_Manifest size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{\n} if kb and kb =~/\d+/ + @manifest[:html] << %{\n} if kb and kb =~/\d+/ end def published_manifests? @f=SiSU_Env::FileOp.new(@md) #.base_filename @@ -153,7 +169,13 @@ module SiSU_Manifest mp,mn,mt,mr=nil,nil,nil,nil ln=SiSU_i18n::Languages.new.language.list Px[:lng_lst].each do |lc| - if @env.output_dir_structure.by_language_code? + if @o_str.dump_or_redirect? #does not work for --redirect or --dump + mp="#{@f.output_path.base.dir}" + mn="#{@md.fnb}.html" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{mn}" + elsif @env.output_dir_structure.by_language_code? mp="#{@f.output_path.base.dir}/#{lc}/manifest" mn="#{@md.fnb}.html" mt="#{mp}/#{mn}" @@ -212,7 +234,7 @@ module SiSU_Manifest end def output_tests if FileTest.file?(@f.place_file.html_segtoc.dir)==true - img=%{TOC linked } + img=%{TOC linked } pth=@f.output_path.html_seg.dir rel=@f.output_path.html_seg.rel_sm url=@f.output_path.html_seg.url @@ -220,7 +242,7 @@ module SiSU_Manifest summarize_html_seg(id,file,pth,rel,url,img) end if FileTest.file?(@f.place_file.html_scroll.dir)==true - img=%{Full Text } + img=%{Full Text } pth=@f.output_path.html_scroll.dir rel=@f.output_path.html_scroll.rel_sm url=@f.output_path.html_scroll.url @@ -242,7 +264,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url) end if FileTest.file?(@f.place_file.epub.dir)==true - img=%{EPUB } + img=%{EPUB } id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub pth=@f.output_path.epub.dir rel=@f.output_path.epub.rel_sm @@ -250,7 +272,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true - img=%{PDF portrait } + img=%{PDF portrait } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -258,7 +280,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true - img=%{PDF landscape } + img=%{PDF landscape } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -266,7 +288,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true - img=%{PDF portrait } + img=%{PDF portrait } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -274,7 +296,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true - img=%{PDF landscape } + img=%{PDF landscape } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -282,7 +304,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true - img=%{PDF portrait } + img=%{PDF portrait } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -290,7 +312,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true - img=%{PDF landscape } + img=%{PDF landscape } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -298,7 +320,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true - img=%{PDF portrait } + img=%{PDF portrait } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -306,7 +328,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true - img=%{PDF landscape } + img=%{PDF landscape } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -314,7 +336,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true - img=%{PDF portrait } + img=%{PDF portrait } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -322,7 +344,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true - img=%{PDF landscape } + img=%{PDF landscape } pth=@f.output_path.pdf.dir rel=@f.output_path.pdf.rel_sm url=@f.output_path.pdf.url @@ -330,7 +352,7 @@ module SiSU_Manifest summarize(id,file,pth,rel,url,img) end if FileTest.file?(@f.place_file.odt.dir)==true - img=%{ODF/ODT } + img=%{ODF/ODT } pth=@f.output_path.odt.dir rel=@f.output_path.odt.rel_sm url=@f.output_path.odt.url @@ -416,8 +438,11 @@ module SiSU_Manifest end def qrc_image fn=@md.fnb - img_md="qrcode/#{fn}.md.png" - img_title="qrcode/#{fn}.title.png" + pth=(@o_str.dump_or_redirect?) \ + ? '.' \ + : 'qrcode' + img_md="#{pth}/#{fn}.md.png" + img_title="#{pth}/#{fn}.title.png" if FileTest.file?(@f.place_file.qrcode_md.dir)==true @manifest[:html] <<<
- #{@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}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{img}#{id}

#{file}

#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{id}

#{file}   #{dgst[1]}
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}

#{kb}

#{id}

#{file}   #{dgst[1]}#{url_make(url,file,:src)}

#{kb}

@@ -763,13 +788,14 @@ SiSU manifest: #{@md.title.full} - +#{@stylesheet.css_head} #{banner_table} WOK if @env.manifest_minitoc? - if @env.output_dir_structure.by_language_code? \ + if @o_str.dump_or_redirect? + elsif @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? minitoc=minitoc.gsub(/. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: common file for xml generation +=end +module SiSU_Images + class Source + def initialize(opt) + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + end + def read + SiSU_Images::Source::Place.new(@particulars).songsheet + end + class Place + def initialize(particulars) + @particulars=particulars + @md=@particulars.md + @env=@particulars.env + @o_str ||=SiSU_Env::OutputStructure.new(@md).output_dir_structure + end + def songsheet + images_set.select_sisu_base + images_set.select_with_document + end + def images_set + @pwd=ENV['PWD'] + def copy(src_path,dest_path,images=nil) + if FileTest.directory?(src_path) + FileUtils::cd(src_path) + unless images + images=Dir.glob("*.{png,jpg,gif,ico}") + end + FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) + FileUtils::chmod(0755,dest_path) + if images.length > 0 + images.each do |i| + FileUtils::cp_r(i,"#{dest_path}/#{i}") + FileUtils::chmod(0644,"#{dest_path}/#{i}") + end + end + FileUtils::cd(@pwd) + else puts "\tWARN, did not find - #{src_path}" + end + end + def dest_path(image_type) + pth=if image_type==:image_sys + pth=(@o_str.dump_or_redirect?) \ + ? "#{@md.file.output_path.html.dir}/image" \ + : "#{@env.path.webserv}/_sisu/image_sys" + elsif image_type==:image + pth=(@o_str.dump_or_redirect?) \ + ? "#{@md.file.output_path.html.dir}/image" \ + : "#{@env.path.webserv}/_sisu/image" + end + end + def select_with_document + images=@md.ec[:image] + src_path="#{@pwd}/_sisu/image" + dest=dest_path(:image) + copy(src_path,dest,images) + end + def select_sisu_base + images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] + src_path="#{@env.path.share}/image" + dest=dest_path(:image_sys) + copy(src_path,dest,images) + end + self + end + end + end +end +__END__ diff --git a/lib/sisu/v3dv/sisupod_make.rb b/lib/sisu/v3dv/sisupod_make.rb index 4b1a5ef9..ac584925 100644 --- a/lib/sisu/v3dv/sisupod_make.rb +++ b/lib/sisu/v3dv/sisupod_make.rb @@ -293,7 +293,7 @@ module SiSU_Doc tar -cJf #{@zipfile}.txz sisupod #echo "#{@file.place_file.sisupod.dir}" }) - FileUtils::mv("#{@zipfile}.txz", @file.place_file.sisupod.dir) + FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir) FileUtils::rm_r(Dir.glob("sisupod/*")) Dir.chdir(@env.path.pwd) SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab unless @opt.cmd =~/q/ diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index 7374d88f..b305dfb7 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -408,7 +408,15 @@ module SiSU_Env def by? output_structure=:filename #set default output structure output_structure=if defined? @rc['output_dir_structure_by'] - output_structure=if (@rc['output_dir_structure_by'] =~/language/) \ + output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ + or ((defined? @rc['output_structure']['dump']) \ + && @rc['output_structure']['dump'] ==true) + :dump + elsif (@rc['output_dir_structure_by'] =~/redirect/) \ + or ((defined? @rc['output_structure']['redirect']) \ + && @rc['output_structure']['redirect'] ==true) + :redirect + elsif (@rc['output_dir_structure_by'] =~/language/) \ or ((defined? @rc['output_structure']['by_language']) \ && @rc['output_structure']['by_language'] ==true) :language @@ -420,9 +428,21 @@ module SiSU_Env or ((defined? @rc['output_structure']['by_filename']) \ && @rc['output_structure']['by_filename'] ==true) :filename + else #recheck current default + :language end end end + def dump? + ((by?) ==:dump) \ + ? true \ + : false + end + def redirect? + ((by?) ==:redirect) \ + ? true \ + : false + end def by_language_code? ((by?) ==:language) \ ? true \ @@ -1568,7 +1588,12 @@ WOK end end def default_output_css - if @env.output_dir_structure.by_language_code? + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + './' + elsif @env.output_dir_structure.by_language_code? '../../' elsif @env.output_dir_structure.by_filetype? '../' @@ -1664,7 +1689,14 @@ WOK defaults[:sisu_share] end def style - defaults[:stylesheet_stub] + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + 'css' + else + defaults[:stylesheet_stub] + end end def sample_data #sample data repository source directory defaults[:sample_data_path] @@ -3312,14 +3344,10 @@ WOK end end end - class FileOp ' : '' @@xml[:open] =< WOK diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb index 1187e02e..aa75e139 100644 --- a/lib/sisu/v3dv/xml.rb +++ b/lib/sisu/v3dv/xml.rb @@ -396,13 +396,13 @@ WOK rdf=SiSU_XML_Tags::RDF.new(@md) dir=SiSU_Env::InfoEnv.new @@xml[:head],@@xml[:body]=[],[] - css=SiSU_Env::CSS_Stylesheet.new(@md) + stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet encoding=if @sys.locale =~/utf-?8/i; '' else '' end @@xml[:open] =< WOK diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb index e63f7ad7..6b8c4e5c 100644 --- a/lib/sisu/v3dv/xml_dom.rb +++ b/lib/sisu/v3dv/xml_dom.rb @@ -470,13 +470,13 @@ WOK def pre rdf=SiSU_XML_Tags::RDF.new(@md) dir=SiSU_Env::InfoEnv.new - css=SiSU_Env::CSS_Stylesheet.new(@md) + stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_dom').stylesheet encoding=if @sys.locale =~/utf-?8/i; '' else '' end @@xml[:open] =< WOK diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb index 50a9f5ac..0b1e9eef 100644 --- a/lib/sisu/v3dv/xml_format.rb +++ b/lib/sisu/v3dv/xml_format.rb @@ -374,7 +374,7 @@ WOK @rdf=SiSU_XML_Tags::RDF.new(md) # DublinCore 1 - title @vz=SiSU_Env::GetInit.instance.skin - @css=SiSU_Env::CSS_Stylesheet.new(md) + @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @index='index' @@ -544,7 +544,7 @@ WOK #{@rdf.rdftoc} #{@rdf.metatag_html} -#{@css.html} +#{@stylesheet.css_head} #{@vz.color_body} @@ -938,7 +938,7 @@ WOK #{@rdf.rdfseg} #{@rdf.metatag_html} -#{@css.html} +#{@stylesheet.css_head} #{@vz.color_body} -- cgit v1.2.3