From eebc0d4f7af96cb387955cc25c0059f2e9dd63d3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 21:42:51 -0400 Subject: v3: manifest, sysenv, "available outputs" relative paths; available languages * relative paths to "available outputs" (for each dir structure), fix * show language versions published (needs 2 runs for manifest, polls output as to whether manifest exists) --- data/doc/sisu/CHANGELOG_v3 | 5 + lib/sisu/v3/manifest.rb | 434 ++++++++++++++++++++++++++------------------- lib/sisu/v3/sysenv.rb | 408 +++++++++++++++++++++++++++++------------- 3 files changed, 534 insertions(+), 313 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index f39fd1a4..0958b687 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -37,6 +37,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.10.orig.tar.gz * language name matching ('Portuguese Brazil') * indentation + * manifest + * relative paths to "available outputs" (for each dir structure), fix + * show language versions published + (needs 2 runs of manifest, polls output as to whether manifest files exist) + %% 3.0.9.orig.tar.gz (2011-05-17:20/2) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.9-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.9.orig.tar.gz diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 90f8df55..0c6d5460 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -67,6 +67,7 @@ module SiSU_Manifest include SiSU_HTML_Format require_relative 'param' # param.rb include SiSU_Param + require_relative 'i18n' # i18n.rb include SiSU_Viz class Source def initialize(opt) @@ -101,11 +102,11 @@ module SiSU_Manifest def initialize(md) @manifest={ txt: [], html: [] } @md,@fns=md,md.fns -# @file=SiSU_Env::SiSU_file.new(@md) @env=SiSU_Env::Info_env.new(@md.fns) @fnb=@md.fnb @base_url="#{@env.url.root}/#{@fnb}" - @base_path=@md.file.output_path.manifest.dir + @f=SiSU_Env::SiSU_file.new(@md) + @base_path=@f.output_path.manifest.dir @@dg ||=SiSU_Env::Info_env.new.digest.type @dg=@@dg l=SiSU_Env::Standardise_language.new(@md.opt.lng).language @@ -114,26 +115,26 @@ module SiSU_Manifest @brace_url=SiSU_Viz::Skin.new.url_decoration end def output - manifest=@md.file.write_file.manifest + manifest=@f.write_file.manifest @manifest[:html].each do |x| - x.gsub!(Xx[:html_relative2],@md.file.path_rel_links.html_scroll_2) - x.gsub!(Xx[:html_relative1],@md.file.path_rel_links.html_scroll_1) + x.gsub!(Xx[:html_relative2],@f.path_rel_links.html_scroll_2) + x.gsub!(Xx[:html_relative1],@f.path_rel_links.html_scroll_1) manifest << x end end - def summarize(id,file,pth='',url='',img='● ') + 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}

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

#{kb}

\n} end - def summarize_html_seg(id,file,pth='',url='',img='● ') + 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}

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

#{kb}

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

+ @manifest[:html] << %{

#{id}

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

#{kb}

\n} if kb and kb =~/\d+/ end + def published_manifests? + @f=SiSU_Env::SiSU_file.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.list + Px[:lng_lst].each do |lc| + if @env.output_dir_structure.by_language_code? + mp="#{@f.output_path.base.dir}/#{lc}/manifest" + mn="#{@md.fnb}.html" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{lc}/manifest/#{mn}" + elsif @env.output_dir_structure.by_filetype? + mp="#{@f.output_path.base.dir}/manifest" + mn="#{@md.fnb}.#{lc}.html" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/manifest/#{mn}" + else + mp="#{@f.output_path.base.dir}/#{@md.fnb}" + mn="sisu_manifest.#{lc}.html" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/#{mn}" + end + if FileTest.directory?(mp) \ + && FileTest.file?(mt) + lng=ln[lc][:t] + manifests[lc]={ ln: lng, fn: mn, rel: mr } + @m << { mu: mu, l: lng, rel: mr } + end + end + manifests + @m.uniq! + @m + end def languages(id,file) - flv=@env.published_manifests?(@base_path) + flv=published_manifests? @manifest[:html] << %{\n} end def published_languages(id,file) - flv=@env.published_manifests?(@base_path) + flv=published_manifests? flv.each do |l| - lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list - @manifest[:txt] << "#{l[:m]} #{lang}\n" - @manifest[:html] << %{

#{lang}

#{lang}

#{@brace_url.xml_open}#{@base_url}/#{l[:m]}#{@brace_url.xml_close}

 

\n} + @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" + @manifest[:html] << %{

#{l[:l]}

#{l[:l]}

#{@brace_url.xml_open}#{l[:mu]}#{@brace_url.xml_close}

 

\n} end end def metadata(id,info) @@ -175,173 +213,191 @@ module SiSU_Manifest @manifest[:html] << %{

#{lnk}

  #{@brace_url.xml_open}#{static}#{@brace_url.xml_close}

\n} end def output_tests - if FileTest.file?(@md.file.place_file.html_segtoc.dir)==true - img=%{TOC linked } - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, table of contents (for segmented text)',@md.file.base_filename.html_segtoc - summarize_html_seg(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.html_scroll.dir)==true - img=%{Full Text } - pth=@md.file.output_path.html_scroll.dir - url=@md.file.output_path.html_scroll.url - id,file='HTML, full length document',@md.file.base_filename.html_scroll - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.html_book_index.dir)==true - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, (book type) index',@md.file.base_filename.html_book_index - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.html_concordance.dir)==true - pth=@md.file.output_path.html_seg.dir - url=@md.file.output_path.html_seg.url - id,file='HTML, concordance file',@md.file.base_filename.html_concordance - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.epub.dir)==true - img=%{EPUB } - id,file='EPUB (Electronic Publication, e-book standard)',@md.file.base_filename.epub - pth=@md.file.output_path.epub.dir - url=@md.file.output_path.epub.url - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_letter}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_letter}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_letter}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_letter}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_a4}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_a4}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_a4}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_a4}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_a5}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_a5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_a5}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_a5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_b5}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_b5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_b5}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_b5}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p_legal}")==true - img=%{PDF portrait } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@md.file.base_filename.pdf_p_legal}" - summarize(id,file,pth,url,img) - end - if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l_legal}")==true - img=%{PDF landscape } - pth=@md.file.output_path.pdf.dir - url=@md.file.output_path.pdf.url - id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@md.file.base_filename.pdf_l_legal}" - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.odt.dir)==true - img=%{ODF/ODT } - pth=@md.file.output_path.odt.dir - url=@md.file.output_path.odf.url - id,file='ODF:ODT (Open Document Format)',@md.file.base_filename.odt - summarize(id,file,pth,url,img) - end - if FileTest.file?(@md.file.place_file.xhtml.dir)==true - pth=@md.file.output_path.xhtml.dir - url=@md.file.output_path.xhtml.url - id,file='ODF:ODT (Open Document Format)',@md.file.base_filename.odt - id,file='XHTML',@md.file.base_filename.xhtml - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.xml_sax.dir)==true - pth=@md.file.output_path.xml_sax.dir - url=@md.file.output_path.xml_sax.url - id,file='XML SAX',@md.file.base_filename.xml_sax - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.xml_dom.dir)==true - pth=@md.file.output_path.xml_dom.dir - url=@md.file.output_path.xml_dom.url - id,file='XML DOM',@md.file.base_filename.xml_dom - summarize(id,file,pth,url) - end - if FileTest.file?(@md.file.place_file.txt.dir)==true + if FileTest.file?(@f.place_file.html_segtoc.dir)==true + 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 + id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc + summarize_html_seg(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.html_scroll.dir)==true + 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 + id,file='HTML, full length document',@f.base_filename.html_scroll + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.html_book_index.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, (book type) index',@f.base_filename.html_book_index + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.html_concordance.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, concordance file',@f.base_filename.html_concordance + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.epub.dir)==true + 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 + url=@f.output_path.epub.url + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_letter}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_letter}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a4}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a4}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_a5}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_a5}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_b5}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_b5}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, portrait/vertical document (recommended for printing)","#{@f.base_filename.pdf_p_legal}" + 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 } + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, landscape/horizontal document (recommended for screen viewing)","#{@f.base_filename.pdf_l_legal}" + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.odt.dir)==true + img=%{ODF/ODT } + pth=@f.output_path.odt.dir + rel=@f.output_path.odt.rel_sm + url=@f.output_path.odf.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + summarize(id,file,pth,rel,url,img) + end + if FileTest.file?(@f.place_file.xhtml.dir)==true + pth=@f.output_path.xhtml.dir + rel=@f.output_path.xhtml.rel_sm + url=@f.output_path.xhtml.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + id,file='XHTML',@f.base_filename.xhtml + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_sax.dir)==true + pth=@f.output_path.xml_sax.dir + rel=@f.output_path.xml_sax.rel_sm + url=@f.output_path.xml_sax.url + id,file='XML SAX',@f.base_filename.xml_sax + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_dom.dir)==true + pth=@f.output_path.xml_dom.dir + rel=@f.output_path.xml_dom.rel_sm + url=@f.output_path.xml_dom.url + id,file='XML DOM',@f.base_filename.xml_dom + 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)' elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)' else id='Plaintext (UTF-8)' end - pth=@md.file.output_path.txt.dir - url=@md.file.output_path.txt.url - file=@md.file.base_filename.txt - summarize(id,file,pth,url) + pth=@f.output_path.txt.dir + rel=@f.output_path.txt.rel_sm + url=@f.output_path.txt.url + file=@f.base_filename.txt + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true id,file='LaTeX (portrait)',"#{@md.fns}.tex" - pth,url='','' - summarize(id,file,pth,url) + pth,rel,url='','','' + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex" - pth,url='','' - summarize(id,file,pth,url) + pth,rel,url='','','' + summarize(id,file,pth,rel,url) end if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true id,file="Digest/DCC - Document Content Certificate (#{@dg})",@md.fn[:digest] pth=@base_path - url='' + rel,url='','' #pth='' - summarize(id,file,pth,url) + summarize(id,file,pth,rel,url) end end def published_versions - if FileTest.file?("#{@base_path}/sisu_manifest.html")==true - id,file='Markup (SiSU source)',@md.fns - languages(id,file) - end + id,file='Markup (SiSU source)',@md.fns + languages(id,file) end def language_versions - if FileTest.file?(@md.file.place_file.manifest.dir)==true + if FileTest.file?(@f.place_file.manifest.dir)==true id,file='Markup (SiSU source)',@md.fns published_languages(id,file) end @@ -349,31 +405,35 @@ module SiSU_Manifest def source_tests if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents req=@md.fns - if FileTest.file?(@md.file.place_file.src.dir)==true - pth=@md.file.output_path.src.dir - url=@md.file.output_path.src.url - id,file='Markup Composite File (SiSU source)',@md.file.base_filename.src - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel_sm + url=@f.output_path.src.url + id,file='Markup Composite File (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) end else - if FileTest.file?(@md.file.place_file.src.dir)==true - pth=@md.file.output_path.src.dir - url=@md.file.output_path.src.url - id,file='Markup (SiSU source)',@md.file.base_filename.src - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel_sm + url=@f.output_path.src.url + id,file='Markup (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) end end - if FileTest.file?(@md.file.place_file.sisupod.dir)==true - pth=@md.file.output_path.sisupod.dir - url=@md.file.output_path.sisupod.url - id,file='SiSU doc (zip)',@md.file.base_filename.sisupod - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.sisupod.dir)==true + pth=@f.output_path.sisupod.dir + rel=@f.output_path.sisupod.rel_sm + url=@f.output_path.sisupod.url + id,file='SiSU doc (zip)',@f.base_filename.sisupod + summarize_sources(id,file,pth,rel,url) end - if FileTest.file?(@md.file.place_file.pot.dir)==true - pth=@md.file.output_path.pot.dir - url=@md.file.output_path.pot.url - id,file='SiSU pot',@md.file.base_filename.pot - summarize_sources(id,file,pth,url) + if FileTest.file?(@f.place_file.pot.dir)==true + pth=@f.output_path.pot.dir + rel=@f.output_path.pot.rel_sm + url=@f.output_path.pot.url + id,file='SiSU pot',@f.base_filename.pot + summarize_sources(id,file,pth,rel,url) end end def metadata_tests @@ -659,8 +719,8 @@ SiSU manifest: #{@md.title.full} - - + + #{banner_table} @@ -669,8 +729,8 @@ WOK if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? minitoc.gsub!(/ diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 127e4181..df86904b 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -445,6 +445,8 @@ module SiSU_Env 'language' elsif by_filetype? 'filetype' + elsif by_filename? + 'filename' else 'filename' end @@ -1442,6 +1444,81 @@ WOK end self end + def path_rel_links + def html_scroll_2 + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + '../' + end + end + def html_seg_2 + if @env.output_dir_structure.by_language_code? + '../../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + '../' + end + end + def html_scroll_1 + if @env.output_dir_structure.by_language_code? + '../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + './' + end + end + def html_seg_1 + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + './' + end + end + def default_output_css + if @env.output_dir_structure.by_language_code? + '../../' + elsif @env.output_dir_structure.by_filetype? + '../' + else + '../' + end + end + def html_scroll_css + default_output_css + end + def xhtml_css + default_output_css + end + def xml_css + default_output_css + end + def html_seg_css + if @env.output_dir_structure.by_language_code? + '../../../' + elsif @env.output_dir_structure.by_filetype? + '../../' + else + '../' + end + end + def manifest_css + if @env.output_dir_structure.by_language_code? + '../../_sisu/css' + elsif @env.output_dir_structure.by_filetype? + '' + else + '../' + end + end + self + end def path #dir def home @sys.home @@ -3028,81 +3105,6 @@ WOK end self end - def path_rel_links - def html_scroll_2 - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '../' - end - end - def html_seg_2 - if @env.output_dir_structure.by_language_code? - '../../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '../../' - end - end - def html_scroll_1 - if @env.output_dir_structure.by_language_code? - '../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '/' - end - end - def html_seg_1 - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '/' - end - end - def default_output_css - if @env.output_dir_structure.by_language_code? - '../../' - elsif @env.output_dir_structure.by_filetype? - '../' - else - '../' - end - end - def html_scroll_css - default_output_css - end - def xhtml_css - default_output_css - end - def xml_css - default_output_css - end - def html_seg_css - if @env.output_dir_structure.by_language_code? - '../../../' - elsif @env.output_dir_structure.by_filetype? - '../../' - else - '../' - end - end - def manifest_css - if @env.output_dir_structure.by_language_code? - '../../_sisu/css' - elsif @env.output_dir_structure.by_filetype? - '' - else - '../' - end - end - self - end def mkdir #check moved from SiSU_file, existing mkdir def processing def dal @@ -3432,110 +3434,117 @@ WOK end def base_filename def txt + ft='.txt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.txt' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:plain] + @md.fnb + @md.lang_code_insert + ft else - 'plain' + @md.fn[:plain] + 'plain' + @md.lang_code_insert + ft end end def html_scroll - #"#{@md.fnl[:pre]}scroll#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - @md.fnb + '.html' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:html] + @md.fnb + @md.lang_code_insert + ft else - 'scroll' + @md.fn[:html] + 'scroll' + @md.lang_code_insert + ft end end def html_seg_index - #"#{@md.fnl[:pre]}index#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - 'toc.html' + 'toc' + ft else - 'index' + @md.fn[:html] + 'index' + @md.lang_code_insert + ft end end def html_segtoc - #"#{@md.fnl[:pre]}toc#{@md.fnl[:mid]}.html#{@md.fnl[:post]}" + ft='.html' if @env.output_dir_structure.by_language_code? - 'toc.html' + 'toc' + ft else - 'toc' + @md.fn[:html] + 'toc' + @md.lang_code_insert + ft end end def html_book_index + ft='.html' if @env.output_dir_structure.by_language_code? - 'book_index.html' + 'book_index' + ft else - 'book_index.' + @md.fn[:html] + 'book_index' + @md.lang_code_insert + ft end end def html_concordance + ft='.html' if @env.output_dir_structure.by_language_code? - 'concordance.html' + 'concordance' + ft else - 'concordance' + @md.fn[:html] + 'concordance' + @md.lang_code_insert + ft end end def xhtml + ft= '.xhtml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.xhtml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:xhtml] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:xhtml] + 'scroll' + @md.lang_code_insert + ft end end def epub + ft='.epub' if @env.output_dir_structure.by_language_code? - @md.fnb + '.epub' + @md.fnb + ft else - @md.fnb + @md.fn[:epub] + @md.fnb + @md.lang_code_insert + ft end end def odt - #"#{@md.fnl[:pre]}#{@md.fnb}#{@md.fnl[:mid]}.odt#{@md.fnl[:post]}" + ft='.odt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.odt' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + @md.fn[:odf] + @md.fnb + @md.lang_code_insert + ft else - 'opendocument' + @md.fn[:odf] + 'opendocument' + @md.lang_code_insert + ft end end def xml_sax + ft='.sax.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.sax.xml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:sax] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:sax] + 'scroll' + @md.lang_code_insert + ft end end def xml_dom + ft='.dom.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.dom.xml' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:dom] + @md.fnb + @md.lang_code_insert + ft else - 'scroll.' + @md.fn[:dom] + 'scroll' + @md.lang_code_insert + ft end end def pdf_p if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? @md.fnb + '.portrait.' - else 'portrait.' + else 'portrait' + @md.lang_code_insert + '.' end end def pdf_l if @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? @md.fnb + '.landscape.' - else 'landscape.' + else 'landscape' + @md.lang_code_insert + '.' end end def pdf_p_a4 @@ -3569,43 +3578,47 @@ WOK pdf_l + @md.fn[:pdf_l_legal] end def manpage + ft='.1' if @env.output_dir_structure.by_language_code? - @md.fnb + '.1' + @md.fnb + ft else - @md.fnb + '.' + @md.fn[:manpage] + @md.fnb + @md.lang_code_insert + ft end end def hash_digest + ft='.txt' if @env.output_dir_structure.by_language_code? - @md.fnb + '.hash_digest.txt' + @md.fnb + '.hash_digest' + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:digest] + @md.fnb + @md.lang_code_insert + ft else - 'digest.' + @md.fn[:digest] + 'digest' + @md.lang_code_insert + ft end end def sitemap + ft='.xml' if @env.output_dir_structure.by_language_code? - @md.fnb + '.sitemap.xml' + @md.fnb + '.sitemap' + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:sitemap] + @md.fnb + @md.lang_code_insert + ft else - 'sitemap.' + @md.fn[:sitemap] + 'sitemap' + @md.lang_code_insert + ft end end def manifest + ft='.html' if @env.output_dir_structure.by_language_code? - @md.fnb + '.manifest.html' + @md.fnb + ft elsif @env.output_dir_structure.by_filetype? - @md.fnb + '.' + @md.fn[:manifest] - else - 'sisu_' + @md.fn[:manifest] + @md.fnb + @md.lang_code_insert + ft + else #fix + 'sisu_manifest' + @md.lang_code_insert + ft end end def src @md.fns end - def po + def po #check (@fno.empty?) \ ? (@md.fn[:po]) \ : (@fno + '.po') @@ -3705,18 +3718,28 @@ WOK def rcp def abc if @env.output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}" + "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" elsif @env.output_dir_structure.by_filetype? - "#{output_path.stub.rcp}/#{ft}" + "#{output_path.stub.rcp}/#{@ft}" else "#{output_path.stub.rcp}/#{@md.fnb}" end end def ab if @env.output_dir_structure.by_language_code? - "#{output_path.stub.rcp}/#{@md.opt.lng}/#{ft}" + "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" else - "#{output_path.stub.rcp}/#{ft}" + "#{output_path.stub.rcp}/#{@ft}" + end + end + self + end + def rel_sm + def ab + if @env.output_dir_structure.by_language_code? \ + or @env.output_dir_structure.by_filetype? + '../' + @ft + else '.' end end self @@ -3724,6 +3747,21 @@ WOK self end def output_path + def web_base + def dir + @env.path.webserv + end + def url + #"#{@env.url.root}" + end + def rel + '.' + end + def rcp + '.' + end + self + end def stub def dir "#{@md.opt.f_pth[:pth_stub]}" @@ -3768,6 +3806,9 @@ WOK def rcp "#{output_path.base.rcp}/pod" end + def rel_sm + #"#{output_path.base.rel}/pod" + end self end def sisugit @@ -3805,6 +3846,18 @@ WOK def rcp set_path(ft).rcp.ab_src end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + #"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" + elsif @env.output_dir_structure.by_filetype? + '' + #"#{output_path.base.dir}/#{@ft}" + else + '' + #"#{output_path.base.dir}/#{@md.fnb}" + end + end self end def po @@ -3868,6 +3921,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_scroll @@ -3886,6 +3942,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_seg @@ -3904,6 +3963,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def html_concordance @@ -3926,6 +3988,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xhtml @@ -3944,6 +4009,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def epub @@ -3962,6 +4030,9 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + set_path(ft).rel_sm.ab + end self end def odt @@ -3980,6 +4051,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xml @@ -3998,6 +4072,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def xml_sax @@ -4024,6 +4101,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def hash_digest @@ -4042,6 +4122,9 @@ WOK def rcp set_path(ft).rcp.abc end + def rel_sm + set_path(ft).rel_sm.ab + end self end def manifest @@ -4078,6 +4161,15 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + elsif @env.output_dir_structure.by_filetype? + '' + else + '' + end + end self end def manpage @@ -4096,6 +4188,15 @@ WOK def rcp set_path(ft).rcp.ab end + def rel_sm + if @env.output_dir_structure.by_language_code? + '' + elsif @env.output_dir_structure.by_filetype? + '' + else + '' + end + end self end def sitemaps @@ -4131,6 +4232,61 @@ WOK end self end + #def cgi + #end + def css + @d='_sisu/css' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + @d + #output_path.base.rel + '/' + @d + end + def rcp + output_path.stub.rcp + '/' + @d + end + self + end + def images + @d='_sisu/image' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + @d + #output_path.base.rel + '/' + @d + end + def rcp + output_path.stub.rcp + '/' + @d + end + self + end + def images_external + @d='_sisu/image_external' + def dir + output_path.base.dir + '/' + @d + end + def url + output_path.base.url + '/' + @d + end + def rel + output_path.base.rel + '/' + @d + end + def rcp + output_path.base.rcp + '/' + @d + end + self + end + #def css + # #"#{@env.path.output}/#{@env.path.style}" + #end self end end -- cgit v1.2.3