From 6811ac91f21a434fc7d967c11e1b20f33918c6ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 19 Mar 2012 22:07:29 -0400 Subject: v3: 3.2 branch is main (v3dv --> v3); dev (v3dv) branch directories removed * v3dv (3.2) "merged" into v3 (previously 3.1) (& removed) * conf/sisu/v3dv --> conf/sisu/v3 * data/sisu/v3dv --> data/sisu/v3 * lib/sisu/v3dv --> lib/sisu/v3 * bin/sisu* (v3dv references changed to v3) * (--dev modifier (superfluous for the time being) runs main v3 branch) --- lib/sisu/v3/manifest.rb | 135 ++++++++++++++++++++++++++++++------------------ 1 file changed, 86 insertions(+), 49 deletions(-) (limited to 'lib/sisu/v3/manifest.rb') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 694ba943..0eb580b3 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -72,15 +72,15 @@ module SiSU_Manifest class Source def initialize(opt) @opt=opt - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) - l=SiSU_Env::Standardise_language.new(@opt.lng).language + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + l=SiSU_Env::StandardiseLanguage.new(@opt.lng).language @doc_language=l[:n] end def read begin - @env=SiSU_Env::Info_env.new(@opt.fns) + @env=SiSU_Env::InfoEnv.new(@opt.fns) @md=SiSU_Param::Parameters.new(@opt).get - SiSU_Env::Info_skin.new(@md).select + SiSU_Env::InfoSkin.new(@md).select xbrowser=@env.program.web_browser browser=@env.program.console_web_browser # webserv_url=@env.path.url.output_tell #fix in sysenv @@ -91,51 +91,68 @@ module SiSU_Manifest : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i end - data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions - Output_Info.new(@md).check_output(data) - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions + SiSU_Manifest::Source::Output.new(@md).check_output(data) + rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error ensure end end private - class Output_Info #{@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] << %{

#{img}#{id}

#{file}

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

#{kb}

\n} + @manifest[:html] << %{

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

\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] << %{

#{img}#{id}

#{file}

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

#{kb}

\n} + @manifest[:html] << %{

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

\n} end def summarize_sources(id,file,pth,rel,url) - sys=SiSU_Env::System_call.new + sys=SiSU_Env::SystemCall.new dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") else sys.md5("#{pth}/#{file}") end @@ -143,17 +160,23 @@ 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] << %{

#{id}

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

#{kb}

\n} if kb and kb =~/\d+/ + @manifest[:html] << %{

#{id}

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

#{kb}

\n} if kb and kb =~/\d+/ end def published_manifests? - @f=SiSU_Env::SiSU_file.new(@md) #.base_filename + @f=SiSU_Env::FileOp.new(@md) #.base_filename @m=[] url=@f.output_path.base.url manifests={} 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}" @@ -180,8 +203,7 @@ module SiSU_Manifest end end manifests - @m.uniq! - @m + @m=@m.uniq end def languages(id,file) flv=published_manifests? @@ -201,7 +223,7 @@ module SiSU_Manifest end end def metadata(id,info) - info.to_s.gsub!(/#{Mx[:br_line]}/,'
') + info=info.to_s.gsub(/#{Mx[:br_line]}/,'
') @manifest[:html] << %{

#{id}:

#{info}

\n} end def links(url,lnk,target) @@ -213,7 +235,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 @@ -221,7 +243,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 @@ -243,7 +265,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 @@ -251,7 +273,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 @@ -259,7 +281,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 @@ -267,7 +289,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 @@ -275,7 +297,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 @@ -283,7 +305,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 @@ -291,7 +313,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 @@ -299,7 +321,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 @@ -307,7 +329,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 @@ -315,7 +337,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 @@ -323,7 +345,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 @@ -331,7 +353,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 @@ -374,6 +396,13 @@ module SiSU_Manifest id,file='Manpage',@f.base_filename.manpage summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.sqlite_discreet.dir)==true + id,file='SQLite3 file',@f.base_filename.sqlite_discreet + pth=@f.output_path.sqlite_discreet.dir + rel=@f.output_path.sqlite_discreet.rel_sm + url=@f.output_path.sqlite_discreet.url + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.txt.dir)==true if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' @@ -417,8 +446,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] <<< @@ -731,16 +763,20 @@ WOK end def check_output(data) begin - minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,data).songsheet.join("\n") + minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") id,file='','' - vz=SiSU_Env::Get_init.instance.skin + vz=SiSU_Env::GetInit.instance.skin + search_form=if @make.build.search_form? + "#{@env.widget_static.search_form}" + else '' + end banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ and vz.banner_home_button_only !~ /sisu\.home\.png/ < #{vz.banner_band}

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

-#{@env.widget_static.search_form} +#{search_form} WOK else @@ -748,7 +784,7 @@ WOK - +#{search_form}
SiSU -->

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

#{@env.widget_static.search_form}
WOK end @@ -764,16 +800,17 @@ SiSU manifest: #{@md.title.full} - +#{@stylesheet.css_head} #{banner_table} WOK - if @env.manifest_minitoc? - if @env.output_dir_structure.by_language_code? \ + if @make.build.manifest_minitoc? + if @o_str.dump_or_redirect? + elsif @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? - minitoc.gsub!(/ WOK output - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure end end -- cgit v1.2.3