From 558fe23ff9dbca050f45e7a2ba965977eddbdfab Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 28 Sep 2014 21:38:10 -0400 Subject: v5 v6: manifest, renamed html_manifest --- lib/sisu/v5/html_manifest.rb | 1032 ++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v5/hub_actions.rb | 8 +- lib/sisu/v5/manifest.rb | 1032 ------------------------------------------ lib/sisu/v6/html_manifest.rb | 1032 ++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v6/hub_actions.rb | 8 +- lib/sisu/v6/manifest.rb | 1032 ------------------------------------------ 6 files changed, 2072 insertions(+), 2072 deletions(-) create mode 100644 lib/sisu/v5/html_manifest.rb delete mode 100644 lib/sisu/v5/manifest.rb create mode 100644 lib/sisu/v6/html_manifest.rb delete mode 100644 lib/sisu/v6/manifest.rb diff --git a/lib/sisu/v5/html_manifest.rb b/lib/sisu/v5/html_manifest.rb new file mode 100644 index 00000000..e1c475d0 --- /dev/null +++ b/lib/sisu/v5/html_manifest.rb @@ -0,0 +1,1032 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + 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: + + + * Git + + + + * Ralph Amissah + + + + ** Description: summary of generated outputs and metadata + +=end +module SiSU_Manifest + require_relative 'se' # se.rb + include SiSU_Env + require_relative 'prog_text_translation' # prog_text_translation.rb + require_relative 'se_hub_particulars' # se_hub_particulars.rb + include SiSU_Particulars + require_relative 'html_minitoc' # html_minitoc.rb + require_relative 'html' # html.rb + include SiSU_HTML_Format + require_relative 'dp' # dp.rb + include SiSU_Param + require_relative 'i18n' # i18n.rb + include SiSU_Viz + class Source + def initialize(opt) + @opt=opt + @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::InfoEnv.new(@opt.fns) + @md=SiSU_Param::Parameters.new(@opt).get + xbrowser=@env.program.web_browser + browser=@env.program.console_web_browser +# webserv_url=@env.path.url.output_tell #fix in sysenv + unless @opt.act[:quiet][:set]==:on + url_html='file://' \ + + @md.file.output_path.manifest.dir + '/' \ + + @md.file.base_filename.manifest + (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest', + "#{xbrowser} #{url_html}" + ).green_hi_blue + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest', + "[#{@opt.f_pth[:lng_is]}]", + "#{url_html}" + ).grey_title_grey_blue + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on) + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "#{browser} #{url_html}" + ).grey_tab + end + end + data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions + SiSU_Manifest::Source::Output.new(@md).check_output(data) + rescue + SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + SiSU_Env::CreateSite.new(@opt).cp_css + Dir.chdir(@opt.f_pth[:pth]) + end + end + private + class Output #{@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}

#{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}

#{url_make(url,file)}

#{kb}

\n} + end + def summarize_sources(id,file,pth,rel,url) + sys=SiSU_Env::SystemCall.new + dgst=case @dg + when :sha512 + sys.sha512("#{pth}/#{file}") + when :sha256 + sys.sha256("#{pth}/#{file}") + when :md5 + sys.md5("#{pth}/#{file}") + else + end + dgst=dgst ? dgst : [ '', 'n/a' ] + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "#{dgst[1]} #{file}" + ).warn + end + 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]}#{url_make(url,file,:src)}

} \ + + %{

#{kb}

} \ + + %{\n} \ + if kb and kb =~/\d+/ + end + def published_manifests? + @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| + lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert + fnh={ + fn: @md.fnb, + lng: lngc, + } + mn=@f.base_filename.manifest(fnh) + if @o_str.dump_or_redirect? #does not work for --redirect or --dump + mp="#{@f.output_path.base.dir}" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{mn}" + elsif @f.output_dir_structure.by_language_code? + mp="#{@f.output_path.base.dir}/#{lc}/manifest" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{lc}/manifest/#{mn}" + elsif @f.output_dir_structure.by_filetype? + mp="#{@f.output_path.base.dir}/manifest" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/manifest/#{mn}" + else + mp="#{@f.output_path.base.dir}/#{@md.fnb}" + 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 + @m=@m.uniq + end + def languages(id,file) + @manifest[:html] << %{\n} + end + def published_languages(id) + published_manifests?.each do |l| + @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) + info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') + @manifest[:html] << %{

#{id}:

#{info}

\n} + end + def links(url,lnk,target) + static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url) + elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) + else url + end + @manifest[:html] << %{

#{lnk}

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

\n} + end + def output_tests + 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.odt.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.xml_docbook_article.dir)==true + pth=@f.output_path.xml_docbook_article.dir + rel=@f.output_path.xml_docbook_article.rel_sm + url=@f.output_path.xml_docbook_article.url + id,file='XML Docbook Book',@f.base_filename.xml_docbook_article + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true + pth=@f.output_path.xml_docbook_book.dir + rel=@f.output_path.xml_docbook_book.rel_sm + url=@f.output_path.xml_docbook_book.url + id,file='XML Docbook Book',@f.base_filename.xml_docbook_book + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true + pth=@f.output_path.xml_fictionbook.dir + rel=@f.output_path.xml_fictionbook.rel_sm + url=@f.output_path.xml_fictionbook.url + id,file='XML Fictionbook',@f.base_filename.xml_fictionbook + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true + pth=@f.output_path.xml_scaffold_structure_sisu.dir + rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm + url=@f.output_path.xml_scaffold_structure_sisu.url + id,file='XML Scaffold sisu structure',@f.base_filename.xml_scaffold_structure_sisu + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true + pth=@f.output_path.xml_scaffold_structure_collapse.dir + rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm + url=@f.output_path.xml_scaffold_structure_collapse.url + id,file='XML Scaffold collapsed structure',@f.base_filename.xml_scaffold_structure_collapse + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.info.dir)==true + pth=@f.output_path.texinfo.dir + rel=@f.output_path.texinfo.rel_sm + url=@f.output_path.texinfo.url + id,file='Info file',@f.base_filename.info + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.manpage.dir)==true + pth=@f.output_path.manpage.dir + rel=@f.output_path.manpage.rel_sm + url=@f.output_path.manpage.url + id,file='Manpage',@f.base_filename.manpage + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true + id,file='SQLite3 file',@f.base_filename.sqlite_discrete + pth=@f.output_path.sqlite_discrete.dir + rel=@f.output_path.sqlite_discrete.rel_sm + url=@f.output_path.sqlite_discrete.url + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.txt.dir)==true + id='Plaintext (UTF-8)' + 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?(@f.place_file.textile.dir)==true + id='Textile text (UTF-8)' + pth=@f.output_path.textile.dir + rel=@f.output_path.textile.rel_sm + url=@f.output_path.textile.url + file=@f.base_filename.textile + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.asciidoc.dir)==true + id='AsciiDoc text (UTF-8)' + pth=@f.output_path.asciidoc.dir + rel=@f.output_path.asciidoc.rel_sm + url=@f.output_path.asciidoc.url + file=@f.base_filename.asciidoc + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.markdown.dir)==true + id='Markdown text (UTF-8)' + pth=@f.output_path.markdown.dir + rel=@f.output_path.markdown.rel_sm + url=@f.output_path.markdown.url + file=@f.base_filename.markdown + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.rst.dir)==true + id='rST text (UTF-8)' + pth=@f.output_path.rst.dir + rel=@f.output_path.rst.rel_sm + url=@f.output_path.rst.url + file=@f.base_filename.rst + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true + id,file='LaTeX (portrait)',"#{@md.fns}.tex" + 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,rel,url='','','' + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.hash_digest.dir)==true + pth=@f.output_path.hash_digest.dir + rel=@f.output_path.hash_digest.rel_sm + url=@f.output_path.hash_digest.url + id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest + summarize(id,file,pth,rel,url) + end + end + def published_versions + id,file='Markup (SiSU source)',@md.fns + languages(id,file) + end + def language_versions + if FileTest.file?(@f.place_file.manifest.dir)==true + id='Markup (SiSU source)' + published_languages(id) + end + end + def qrc_image + fn=(@f.output_dir_structure.by_filename?) \ + ? 'sisu_manifest' + : @md.fnb + pth=((@o_str.dump_or_redirect?) \ + || (@f.output_dir_structure.by_filename?)) \ + ? '.' + : 'qrcode' + img_md="#{pth}/#{fn}#{@fn_lng}.md.png" + img_title="#{pth}/#{fn}#{@fn_lng}.title.png" + if FileTest.file?(@f.place_file.qrcode_md.dir)==true + @manifest[:html] <<< +

QR code SiSU document metadata:

+

+ qrcode metadata +

+ +WOK + end + if FileTest.file?(@f.place_file.qrcode_title.dir)==true + @manifest[:html] <<< +

QR code document title info:

+

+ qrcode title +

+ +WOK + end + end + def source_tests + if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents + 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?(@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?(@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 (tar.xz)',@f.base_filename.sisupod + summarize_sources(id,file,pth,rel,url) + end + 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 + if defined? @md.title #% + if defined? @md.title.full \ + and @md.title.full=~/\S+/ + id,info=@translate.full_title,@md.title.full + metadata(id,info) + end + end + if defined? @md.creator #% + if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + id,info=@translate.author,@md.creator.author + metadata(id,info) + end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + id,info=@translate.contributor,@md.creator.contributor + metadata(id,info) + end + if defined? @md.creator.translator \ + and @md.creator.translator=~/\S+/ + id,info=@translate.translator,@md.creator.translator + metadata(id,info) + end + if defined? @md.creator.illustrator \ + and @md.creator.illustrator=~/\S+/ + id,info=@translate.illustrator,@md.creator.illustrator + metadata(id,info) + end + if defined? @md.creator.prepared_by \ + and @md.creator.prepared_by=~/\S+/ + id,info=@translate.prepared_by,@md.creator.prepared_by + metadata(id,info) + end + if defined? @md.creator.digitized_by \ + and @md.creator.digitized_by=~/\S+/ + id,info=@translate.digitized_by,@md.creator.digitized_by + metadata(id,info) + end + end + if defined? @md.rights + if defined? @md.rights.all \ + and @md.rights.all=~/\S+/ #dc + id,info=@translate.rights,@md.rights.all + metadata(id,info) + end + end + if defined? @md.date #% + if defined? @md.date.published \ + and @md.date.published=~/\S+/ #dc + id,info=@translate.date,@md.date.published + metadata(id,info) + end + if defined? @md.date.created \ + and @md.date.created=~/\S+/ #dc + id,info=@translate.date_created,@md.date.created + metadata(id,info) + end + if defined? @md.date.issued \ + and @md.date.issued=~/\S+/ #dc + id,info=@translate.date_issued,@md.date.issued + metadata(id,info) + end + if defined? @md.date.available \ + and @md.date.available=~/\S+/ #dc + id,info=@translate.date_available,@md.date.available + metadata(id,info) + end + if defined? @md.date.modified \ + and @md.date.modified=~/\S+/ #dc + id,info=@translate.date_modified,@md.date.modified + metadata(id,info) + end + if defined? @md.date.valid \ + and @md.date.valid=~/\S+/ #dc + id,info=@translate.date_valid,@md.date.valid + metadata(id,info) + end + end + if defined? @md.publisher \ + and @md.publisher=~/\S+/ #dc + id,info=@translate.publisher,@md.publisher + metadata(id,info) + end + if defined? @md.notes #% + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description + metadata(id,info) + end + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract + metadata(id,info) + end + if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + id,info=@translate.comments,@md.notes.comment + metadata(id,info) + end + if defined? @md.notes.prefix_a \ + and @md.notes.prefix_a=~/\S+/ + id,info=@translate.prefix_a,@md.notes.prefix_a + metadata(id,info) + end + if defined? @md.notes.prefix_b \ + and @md.notes.prefix_b=~/\S+/ + id,info=@translate.prefix_b,@md.notes.prefix_b + metadata(id,info) + end + end + if defined? @md.title #% + if defined? @md.title.language \ + and @md.title.language=~/\S+/ + id,info=@translate.language,@md.title.language + metadata(id,info) + end + if defined? @md.original.language \ + and @md.original.language=~/\S+/ + id,info=@translate.language_original,@md.original.language + metadata(id,info) + end + end + if defined? @md.classify #% + if defined? @md.topic_register_array \ + and @md.topic_register_array.length > 0 + @manifest[:html] << %{

#{@translate.topic_register}:

\n} + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.is_a?(Array) + st.each do |v| + if v.is_a?(Array) + v.each do |w| + @manifest[:html] << %{

#{w}

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

#{v}

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

#{st}

\n} + end + end + end + @manifest[:html] << %{\n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject + metadata(id,info) + end + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords + metadata(id,info) + end + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc + metadata(id,info) + end + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey + metadata(id,info) + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage + metadata(id,info) + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation + metadata(id,info) + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.notes.type + metadata(id,info) + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format + metadata(id,info) + end + end + if defined? @md.identifier #% + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.identifier.oclc + @manifest[:html] << %{

#{id}:

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

#{info}

\n} + @manifest[:html] << %{\n} + end + if defined? @md.identifier.pg \ + and @md.identifier.pg=~/\S+/ + id,info=@translate.cls_gutenberg,@md.identifier.pg + metadata(id,info) + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) + end + end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) + end + if @md.fns + id,info=@translate.sourcefile,@md.fns + metadata(id,info) + end + if @md.en[:mismatch] > 0 + id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" + metadata(id,info) + end + if @md.wc_words + id,info=@translate.word_count,@md.wc_words + metadata(id,info) + end + if @md.dgst + id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] + metadata(id,info) + end + if @md.sc_number + id,info=@translate.sc_number,@md.sc_number + metadata(id,info) + end + if @md.sc_date + id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" + metadata(id,info) + end + if @md.generated + id,info=@translate.last_generated,@md.generated + metadata(id,info) + end + if @md.sisu_version + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" + metadata(id,info) + end + if @md.ruby_version + id,info=@translate.ruby_version,@md.ruby_version + metadata(id,info) + end + end + def links_tests + if defined? @md.lnk \ + and @md.lnk + @md.lnk.each do |l| + if defined? l[:say] + target=(l[:url] !~/^\.(\.)?\//) \ + ? 'external' + : '_top' + url,lnk=l[:url],l[:say] + unless url.nil? \ + or url.empty? + links(url,lnk,target) + end + end + end + end + end + def check_output(data) + begin + make=SiSU_Env::ProcessingSettings.new(@md) + minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") + vz=SiSU_Viz::Defaults.new + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) + @manifest[:html] <<< + + + +SiSU manifest: #{@md.title.full} + + + + + +#{@stylesheet.css_head} + + +#{format_head_toc.seg_head_navigation_band(:manifest)} +WOK + if make.build.manifest_minitoc? + if @o_str.dump_or_redirect? + elsif @f.output_dir_structure.by_language_code? \ + or @f.output_dir_structure.by_filetype? + minitoc=minitoc.gsub(/ +#{minitoc.to_s} + + +

#{@md.title.full}

+

#{@md.author}

+ + +WOK + published_versions + @manifest[:html] << '
' + @manifest[:html] <<<#{@translate.manifest_description_output} + + + +WOK + output_tests + @manifest[:html] << '

#{@translate.filetype_description}

#{@translate.filename}

#{@translate.file_size}

(kB)

' + @manifest[:html] <<< +WOK + source_tests + @manifest[:html] << '' + @manifest[:html] <<<#{@translate.manifest_description_metadata} + + +WOK + metadata_tests + @manifest[:html] <<< +WOK + @manifest[:html] <<<#{@translate.suggested_links}:

+

#{@translate.metadata}

#{@translate.description}

+WOK + links_tests + @manifest[:html] <<< +WOK + @manifest[:html] <<<#{@translate.language_version_list} +
+ + +WOK + language_versions + qrc_image + @manifest[:html] <<< + +
+
+#{vz.credits_sisu_manifest} +
+ + +WOK + output + rescue + SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + end + end + end + end +end +__END__ diff --git a/lib/sisu/v5/hub_actions.rb b/lib/sisu/v5/hub_actions.rb index 869124bc..6b77830d 100644 --- a/lib/sisu/v5/hub_actions.rb +++ b/lib/sisu/v5/hub_actions.rb @@ -542,7 +542,7 @@ module SiSU_Hub_Actions def manifest? if @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 0 - require_relative 'manifest' # manifest.rb + require_relative 'html_manifest' # html_manifest.rb ((@opt.act[:sisupod][:set]==:on \ || @opt.act[:share_source][:set]==:on) \ && @opt.f_pths.length < 2 ) \ @@ -666,7 +666,7 @@ module SiSU_Hub_Actions || @opt.act[:share_source][:set]==:on) \ and @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 0 - require_relative 'manifest' # manifest.rb + require_relative 'html_manifest' # html_manifest.rb begin ensure SiSU_Hub_Loops::OptionLoopFiles.new(@opt). @@ -800,9 +800,9 @@ module SiSU_Hub_Actions def manifest? if @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 1 - require_relative 'manifest' + require_relative 'html_manifest' SiSU_Hub_Loops::OptionLoopFiles.new(@opt).manifest_on_files_translated do - SiSU_Manifest::Source.new(@opt).read # manifest.rb + SiSU_Manifest::Source.new(@opt).read # html_manifest.rb end end end diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb deleted file mode 100644 index e1ef821b..00000000 --- a/lib/sisu/v5/manifest.rb +++ /dev/null @@ -1,1032 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, - All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - 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: - - - * Git - - - - * Ralph Amissah - - - - ** Description: summary of generated outputs and metadata - -=end -module SiSU_Manifest - require_relative 'se' # se.rb - include SiSU_Env - require_relative 'prog_text_translation' # prog_text_translation.rb - require_relative 'se_hub_particulars' # se_hub_particulars.rb - include SiSU_Particulars - require_relative 'html_minitoc' # html_minitoc.rb - require_relative 'html' # html.rb - include SiSU_HTML_Format - require_relative 'dp' # dp.rb - include SiSU_Param - require_relative 'i18n' # i18n.rb - include SiSU_Viz - class Source - def initialize(opt) - @opt=opt - @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::InfoEnv.new(@opt.fns) - @md=SiSU_Param::Parameters.new(@opt).get - xbrowser=@env.program.web_browser - browser=@env.program.console_web_browser -# webserv_url=@env.path.url.output_tell #fix in sysenv - unless @opt.act[:quiet][:set]==:on - url_html='file://' \ - + @md.file.output_path.manifest.dir + '/' \ - + @md.file.base_filename.manifest - (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest', - "#{xbrowser} #{url_html}" - ).green_hi_blue - : SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest', - "[#{@opt.f_pth[:lng_is]}]", - "#{url_html}" - ).grey_title_grey_blue - if (@md.opt.act[:verbose][:set]==:on \ - || @md.opt.act[:verbose_plus][:set]==:on) - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "#{browser} #{url_html}" - ).grey_tab - end - end - data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions - SiSU_Manifest::Source::Output.new(@md).check_output(data) - rescue - SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do - __LINE__.to_s + ':' + __FILE__ - end - ensure - SiSU_Env::CreateSite.new(@opt).cp_css - Dir.chdir(@opt.f_pth[:pth]) - end - end - private - class Output #{@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} - 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} - end - def summarize_sources(id,file,pth,rel,url) - sys=SiSU_Env::SystemCall.new - dgst=case @dg - when :sha512 - sys.sha512("#{pth}/#{file}") - when :sha256 - sys.sha256("#{pth}/#{file}") - when :md5 - sys.md5("#{pth}/#{file}") - else - end - dgst=dgst ? dgst : [ '', 'n/a' ] - if (@md.opt.act[:verbose][:set]==:on \ - || @md.opt.act[:verbose_plus][:set]==:on \ - || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new( - @md.opt.act[:color_state][:set], - "#{dgst[1]} #{file}" - ).warn - end - 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+/ - end - def published_manifests? - @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| - lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert - fnh={ - fn: @md.fnb, - lng: lngc, - } - mn=@f.base_filename.manifest(fnh) - if @o_str.dump_or_redirect? #does not work for --redirect or --dump - mp="#{@f.output_path.base.dir}" - mt="#{mp}/#{mn}" - mr="../../#{lc}/manifest/#{mn}" - mu="#{url}/#{mn}" - elsif @f.output_dir_structure.by_language_code? - mp="#{@f.output_path.base.dir}/#{lc}/manifest" - mt="#{mp}/#{mn}" - mr="../../#{lc}/manifest/#{mn}" - mu="#{url}/#{lc}/manifest/#{mn}" - elsif @f.output_dir_structure.by_filetype? - mp="#{@f.output_path.base.dir}/manifest" - mt="#{mp}/#{mn}" - mr=mn - mu="#{url}/manifest/#{mn}" - else - mp="#{@f.output_path.base.dir}/#{@md.fnb}" - 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 - @m=@m.uniq - end - def languages(id,file) - @manifest[:html] << %{\n} - end - def published_languages(id) - published_manifests?.each do |l| - @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" - @manifest[:html] << %{\n} - end - end - def metadata(id,info) - info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') - @manifest[:html] << %{\n} - end - def links(url,lnk,target) - static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url) - elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) - else url - end - @manifest[:html] << %{\n} - end - def output_tests - 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.odt.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.xml_docbook_article.dir)==true - pth=@f.output_path.xml_docbook_article.dir - rel=@f.output_path.xml_docbook_article.rel_sm - url=@f.output_path.xml_docbook_article.url - id,file='XML Docbook Book',@f.base_filename.xml_docbook_article - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true - pth=@f.output_path.xml_docbook_book.dir - rel=@f.output_path.xml_docbook_book.rel_sm - url=@f.output_path.xml_docbook_book.url - id,file='XML Docbook Book',@f.base_filename.xml_docbook_book - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true - pth=@f.output_path.xml_fictionbook.dir - rel=@f.output_path.xml_fictionbook.rel_sm - url=@f.output_path.xml_fictionbook.url - id,file='XML Fictionbook',@f.base_filename.xml_fictionbook - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true - pth=@f.output_path.xml_scaffold_structure_sisu.dir - rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm - url=@f.output_path.xml_scaffold_structure_sisu.url - id,file='XML Scaffold sisu structure',@f.base_filename.xml_scaffold_structure_sisu - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true - pth=@f.output_path.xml_scaffold_structure_collapse.dir - rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm - url=@f.output_path.xml_scaffold_structure_collapse.url - id,file='XML Scaffold collapsed structure',@f.base_filename.xml_scaffold_structure_collapse - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.info.dir)==true - pth=@f.output_path.texinfo.dir - rel=@f.output_path.texinfo.rel_sm - url=@f.output_path.texinfo.url - id,file='Info file',@f.base_filename.info - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.manpage.dir)==true - pth=@f.output_path.manpage.dir - rel=@f.output_path.manpage.rel_sm - url=@f.output_path.manpage.url - id,file='Manpage',@f.base_filename.manpage - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true - id,file='SQLite3 file',@f.base_filename.sqlite_discrete - pth=@f.output_path.sqlite_discrete.dir - rel=@f.output_path.sqlite_discrete.rel_sm - url=@f.output_path.sqlite_discrete.url - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.txt.dir)==true - id='Plaintext (UTF-8)' - 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?(@f.place_file.textile.dir)==true - id='Textile text (UTF-8)' - pth=@f.output_path.textile.dir - rel=@f.output_path.textile.rel_sm - url=@f.output_path.textile.url - file=@f.base_filename.textile - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.asciidoc.dir)==true - id='AsciiDoc text (UTF-8)' - pth=@f.output_path.asciidoc.dir - rel=@f.output_path.asciidoc.rel_sm - url=@f.output_path.asciidoc.url - file=@f.base_filename.asciidoc - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.markdown.dir)==true - id='Markdown text (UTF-8)' - pth=@f.output_path.markdown.dir - rel=@f.output_path.markdown.rel_sm - url=@f.output_path.markdown.url - file=@f.base_filename.markdown - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.rst.dir)==true - id='rST text (UTF-8)' - pth=@f.output_path.rst.dir - rel=@f.output_path.rst.rel_sm - url=@f.output_path.rst.url - file=@f.base_filename.rst - summarize(id,file,pth,rel,url) - end - if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true - id,file='LaTeX (portrait)',"#{@md.fns}.tex" - 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,rel,url='','','' - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.hash_digest.dir)==true - pth=@f.output_path.hash_digest.dir - rel=@f.output_path.hash_digest.rel_sm - url=@f.output_path.hash_digest.url - id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest - summarize(id,file,pth,rel,url) - end - end - def published_versions - id,file='Markup (SiSU source)',@md.fns - languages(id,file) - end - def language_versions - if FileTest.file?(@f.place_file.manifest.dir)==true - id='Markup (SiSU source)' - published_languages(id) - end - end - def qrc_image - fn=(@f.output_dir_structure.by_filename?) \ - ? 'sisu_manifest' - : @md.fnb - pth=((@o_str.dump_or_redirect?) \ - || (@f.output_dir_structure.by_filename?)) \ - ? '.' - : 'qrcode' - img_md="#{pth}/#{fn}#{@fn_lng}.md.png" - img_title="#{pth}/#{fn}#{@fn_lng}.title.png" - if FileTest.file?(@f.place_file.qrcode_md.dir)==true - @manifest[:html] <<< -WOK - end - if FileTest.file?(@f.place_file.qrcode_title.dir)==true - @manifest[:html] <<< -WOK - end - end - def source_tests - if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents - 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?(@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?(@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 (tar.xz)',@f.base_filename.sisupod - summarize_sources(id,file,pth,rel,url) - end - 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 - if defined? @md.title #% - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - id,info=@translate.full_title,@md.title.full - metadata(id,info) - end - end - if defined? @md.creator #% - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - id,info=@translate.author,@md.creator.author - metadata(id,info) - end - if defined? @md.creator.editor \ - and @md.creator.editor=~/\S+/ - id,info=@translate.editor,@md.creator.editor - metadata(id,info) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - id,info=@translate.contributor,@md.creator.contributor - metadata(id,info) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - id,info=@translate.translator,@md.creator.translator - metadata(id,info) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - id,info=@translate.illustrator,@md.creator.illustrator - metadata(id,info) - end - if defined? @md.creator.prepared_by \ - and @md.creator.prepared_by=~/\S+/ - id,info=@translate.prepared_by,@md.creator.prepared_by - metadata(id,info) - end - if defined? @md.creator.digitized_by \ - and @md.creator.digitized_by=~/\S+/ - id,info=@translate.digitized_by,@md.creator.digitized_by - metadata(id,info) - end - end - if defined? @md.rights - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ #dc - id,info=@translate.rights,@md.rights.all - metadata(id,info) - end - end - if defined? @md.date #% - if defined? @md.date.published \ - and @md.date.published=~/\S+/ #dc - id,info=@translate.date,@md.date.published - metadata(id,info) - end - if defined? @md.date.created \ - and @md.date.created=~/\S+/ #dc - id,info=@translate.date_created,@md.date.created - metadata(id,info) - end - if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ #dc - id,info=@translate.date_issued,@md.date.issued - metadata(id,info) - end - if defined? @md.date.available \ - and @md.date.available=~/\S+/ #dc - id,info=@translate.date_available,@md.date.available - metadata(id,info) - end - if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ #dc - id,info=@translate.date_modified,@md.date.modified - metadata(id,info) - end - if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ #dc - id,info=@translate.date_valid,@md.date.valid - metadata(id,info) - end - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ #dc - id,info=@translate.publisher,@md.publisher - metadata(id,info) - end - if defined? @md.notes #% - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - id,info=@translate.comments,@md.notes.comment - metadata(id,info) - end - if defined? @md.notes.prefix_a \ - and @md.notes.prefix_a=~/\S+/ - id,info=@translate.prefix_a,@md.notes.prefix_a - metadata(id,info) - end - if defined? @md.notes.prefix_b \ - and @md.notes.prefix_b=~/\S+/ - id,info=@translate.prefix_b,@md.notes.prefix_b - metadata(id,info) - end - end - if defined? @md.title #% - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - id,info=@translate.language,@md.title.language - metadata(id,info) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - id,info=@translate.language_original,@md.original.language - metadata(id,info) - end - end - if defined? @md.classify #% - if defined? @md.topic_register_array \ - and @md.topic_register_array.length > 0 - @manifest[:html] << %{\n} - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords - metadata(id,info) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc - metadata(id,info) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey - metadata(id,info) - end - if defined? @md.notes.coverage \ - and @md.notes.coverage=~/\S+/ - id,info=@translate.coverage,@md.notes.coverage - metadata(id,info) - end - if defined? @md.notes.relation \ - and @md.notes.relation=~/\S+/ - id,info=@translate.relation,@md.notes.relation - metadata(id,info) - end - if defined? @md.notes.type \ - and @md.notes.type=~/\S+/ #dc - id,info=@translate.type,@md.notes.type - metadata(id,info) - end - if defined? @md.notes.format \ - and @md.notes.format=~/\S+/ - id,info=@transate.format,@md.notes.format - metadata(id,info) - end - end - if defined? @md.identifier #% - if defined? @md.identifier.oclc \ - and @md.identifier.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.identifier.oclc - @manifest[:html] << %{\n} - end - if defined? @md.identifier.pg \ - and @md.identifier.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.identifier.pg - metadata(id,info) - end - if defined? @md.identifier.isbn \ - and @md.identifier.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.identifier.isbn - metadata(id,info) - end - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source - metadata(id,info) - end - if @md.fns - id,info=@translate.sourcefile,@md.fns - metadata(id,info) - end - if @md.en[:mismatch] > 0 - id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" - metadata(id,info) - end - if @md.wc_words - id,info=@translate.word_count,@md.wc_words - metadata(id,info) - end - if @md.dgst - id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] - metadata(id,info) - end - if @md.sc_number - id,info=@translate.sc_number,@md.sc_number - metadata(id,info) - end - if @md.sc_date - id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" - metadata(id,info) - end - if @md.generated - id,info=@translate.last_generated,@md.generated - metadata(id,info) - end - if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" - metadata(id,info) - end - if @md.ruby_version - id,info=@translate.ruby_version,@md.ruby_version - metadata(id,info) - end - end - def links_tests - if defined? @md.lnk \ - and @md.lnk - @md.lnk.each do |l| - if defined? l[:say] - target=(l[:url] !~/^\.(\.)?\//) \ - ? 'external' - : '_top' - url,lnk=l[:url],l[:say] - unless url.nil? \ - or url.empty? - links(url,lnk,target) - end - end - end - end - end - def check_output(data) - begin - make=SiSU_Env::ProcessingSettings.new(@md) - minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") - vz=SiSU_Viz::Defaults.new - format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) - @manifest[:html] <<< - - - -SiSU manifest: #{@md.title.full} - - - - - -#{@stylesheet.css_head} - - -#{format_head_toc.seg_head_navigation_band(:manifest)} -WOK - if make.build.manifest_minitoc? - if @o_str.dump_or_redirect? - elsif @f.output_dir_structure.by_language_code? \ - or @f.output_dir_structure.by_filetype? - minitoc=minitoc.gsub(/ -#{minitoc.to_s} - - -

#{@md.title.full}

-

#{@md.author}

- -

#{@translate.filename}

#{@translate.description}

 

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{id}

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

#{kb}

#{l[:l]}

#{l[:l]}

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

 

#{id}:

#{info}

#{lnk}

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

-

QR code SiSU document metadata:

-

- qrcode metadata -

-
-

QR code document title info:

-

- qrcode title -

-

#{@translate.topic_register}:

\n} - @md.topic_register_array.each do |t| - t.each_with_index do |st,i| - if st.is_a?(Array) - st.each do |v| - if v.is_a?(Array) - v.each do |w| - @manifest[:html] << %{

#{w}

\n} - end - else - @manifest[:html] << %{

#{v}

\n} - end - end - else @manifest[:html] << %{

#{st}

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

#{id}:

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

#{info}

\n} - @manifest[:html] << %{
-WOK - published_versions - @manifest[:html] << '
' - @manifest[:html] <<<#{@translate.manifest_description_output} - - - -WOK - output_tests - @manifest[:html] << '

#{@translate.filetype_description}

#{@translate.filename}

#{@translate.file_size}

(kB)

' - @manifest[:html] <<< -WOK - source_tests - @manifest[:html] << '' - @manifest[:html] <<<#{@translate.manifest_description_metadata} - - -WOK - metadata_tests - @manifest[:html] <<< -WOK - @manifest[:html] <<<#{@translate.suggested_links}:

-

#{@translate.metadata}

#{@translate.description}

-WOK - links_tests - @manifest[:html] <<< -WOK - @manifest[:html] <<<#{@translate.language_version_list} -
- - -WOK - language_versions - qrc_image - @manifest[:html] <<< - -
-
-#{vz.credits_sisu_manifest} -
- - -WOK - output - rescue - SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do - __LINE__.to_s + ':' + __FILE__ - end - ensure - end - end - end - end -end -__END__ diff --git a/lib/sisu/v6/html_manifest.rb b/lib/sisu/v6/html_manifest.rb new file mode 100644 index 00000000..1057cd2b --- /dev/null +++ b/lib/sisu/v6/html_manifest.rb @@ -0,0 +1,1032 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + 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: + + + * Git + + + + * Ralph Amissah + + + + ** Description: summary of generated outputs and metadata + +=end +module SiSU_Manifest + require_relative 'se' # se.rb + include SiSU_Env + require_relative 'prog_text_translation' # prog_text_translation.rb + require_relative 'se_hub_particulars' # se_hub_particulars.rb + include SiSU_Particulars + require_relative 'html_minitoc' # html_minitoc.rb + require_relative 'html' # html.rb + include SiSU_HTML_Format + require_relative 'dp' # dp.rb + include SiSU_Param + require_relative 'i18n' # i18n.rb + include SiSU_Viz + class Source + def initialize(opt) + @opt=opt + @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::InfoEnv.new(@opt.fns) + @md=SiSU_Param::Parameters.new(@opt).get + xbrowser=@env.program.web_browser + browser=@env.program.console_web_browser +# webserv_url=@env.path.url.output_tell #fix in sysenv + unless @opt.act[:quiet][:set]==:on + url_html='file://' \ + + @md.file.output_path.manifest.dir + '/' \ + + @md.file.base_filename.manifest + (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest', + "#{xbrowser} #{url_html}" + ).green_hi_blue + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest', + "[#{@opt.f_pth[:lng_is]}]", + "#{url_html}" + ).grey_title_grey_blue + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on) + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "#{browser} #{url_html}" + ).grey_tab + end + end + data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions + SiSU_Manifest::Source::Output.new(@md).check_output(data) + rescue + SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + SiSU_Env::CreateSite.new(@opt).cp_css + Dir.chdir(@opt.f_pth[:pth]) + end + end + private + class Output #{@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} + 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} + end + def summarize_sources(id,file,pth,rel,url) + sys=SiSU_Env::SystemCall.new + dgst=case @dg + when :sha512 + sys.sha512("#{pth}/#{file}") + when :sha256 + sys.sha256("#{pth}/#{file}") + when :md5 + sys.md5("#{pth}/#{file}") + else + end + dgst=dgst ? dgst : [ '', 'n/a' ] + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "#{dgst[1]} #{file}" + ).warn + end + 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+/ + end + def published_manifests? + @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| + lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert + fnh={ + fn: @md.fnb, + lng: lngc, + } + mn=@f.base_filename.manifest(fnh) + if @o_str.dump_or_redirect? #does not work for --redirect or --dump + mp="#{@f.output_path.base.dir}" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{mn}" + elsif @f.output_dir_structure.by_language_code? + mp="#{@f.output_path.base.dir}/#{lc}/manifest" + mt="#{mp}/#{mn}" + mr="../../#{lc}/manifest/#{mn}" + mu="#{url}/#{lc}/manifest/#{mn}" + elsif @f.output_dir_structure.by_filetype? + mp="#{@f.output_path.base.dir}/manifest" + mt="#{mp}/#{mn}" + mr=mn + mu="#{url}/manifest/#{mn}" + else + mp="#{@f.output_path.base.dir}/#{@md.fnb}" + 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 + @m=@m.uniq + end + def languages(id,file) + @manifest[:html] << %{\n} + end + def published_languages(id) + published_manifests?.each do |l| + @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" + @manifest[:html] << %{\n} + end + end + def metadata(id,info) + info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') + @manifest[:html] << %{\n} + end + def links(url,lnk,target) + static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url) + elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) + else url + end + @manifest[:html] << %{\n} + end + def output_tests + 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.odt.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.xml_docbook_article.dir)==true + pth=@f.output_path.xml_docbook_article.dir + rel=@f.output_path.xml_docbook_article.rel_sm + url=@f.output_path.xml_docbook_article.url + id,file='XML Docbook Book',@f.base_filename.xml_docbook_article + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true + pth=@f.output_path.xml_docbook_book.dir + rel=@f.output_path.xml_docbook_book.rel_sm + url=@f.output_path.xml_docbook_book.url + id,file='XML Docbook Book',@f.base_filename.xml_docbook_book + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true + pth=@f.output_path.xml_fictionbook.dir + rel=@f.output_path.xml_fictionbook.rel_sm + url=@f.output_path.xml_fictionbook.url + id,file='XML Fictionbook',@f.base_filename.xml_fictionbook + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true + pth=@f.output_path.xml_scaffold_structure_sisu.dir + rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm + url=@f.output_path.xml_scaffold_structure_sisu.url + id,file='XML Scaffold sisu structure',@f.base_filename.xml_scaffold_structure_sisu + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true + pth=@f.output_path.xml_scaffold_structure_collapse.dir + rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm + url=@f.output_path.xml_scaffold_structure_collapse.url + id,file='XML Scaffold collapsed structure',@f.base_filename.xml_scaffold_structure_collapse + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.info.dir)==true + pth=@f.output_path.texinfo.dir + rel=@f.output_path.texinfo.rel_sm + url=@f.output_path.texinfo.url + id,file='Info file',@f.base_filename.info + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.manpage.dir)==true + pth=@f.output_path.manpage.dir + rel=@f.output_path.manpage.rel_sm + url=@f.output_path.manpage.url + id,file='Manpage',@f.base_filename.manpage + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true + id,file='SQLite3 file',@f.base_filename.sqlite_discrete + pth=@f.output_path.sqlite_discrete.dir + rel=@f.output_path.sqlite_discrete.rel_sm + url=@f.output_path.sqlite_discrete.url + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.txt.dir)==true + id='Plaintext (UTF-8)' + 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?(@f.place_file.textile.dir)==true + id='Textile text (UTF-8)' + pth=@f.output_path.textile.dir + rel=@f.output_path.textile.rel_sm + url=@f.output_path.textile.url + file=@f.base_filename.textile + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.asciidoc.dir)==true + id='AsciiDoc text (UTF-8)' + pth=@f.output_path.asciidoc.dir + rel=@f.output_path.asciidoc.rel_sm + url=@f.output_path.asciidoc.url + file=@f.base_filename.asciidoc + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.markdown.dir)==true + id='Markdown text (UTF-8)' + pth=@f.output_path.markdown.dir + rel=@f.output_path.markdown.rel_sm + url=@f.output_path.markdown.url + file=@f.base_filename.markdown + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.rst.dir)==true + id='rST text (UTF-8)' + pth=@f.output_path.rst.dir + rel=@f.output_path.rst.rel_sm + url=@f.output_path.rst.url + file=@f.base_filename.rst + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true + id,file='LaTeX (portrait)',"#{@md.fns}.tex" + 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,rel,url='','','' + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.hash_digest.dir)==true + pth=@f.output_path.hash_digest.dir + rel=@f.output_path.hash_digest.rel_sm + url=@f.output_path.hash_digest.url + id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest + summarize(id,file,pth,rel,url) + end + end + def published_versions + id,file='Markup (SiSU source)',@md.fns + languages(id,file) + end + def language_versions + if FileTest.file?(@f.place_file.manifest.dir)==true + id='Markup (SiSU source)' + published_languages(id) + end + end + def qrc_image + fn=(@f.output_dir_structure.by_filename?) \ + ? 'sisu_manifest' + : @md.fnb + pth=((@o_str.dump_or_redirect?) \ + || (@f.output_dir_structure.by_filename?)) \ + ? '.' + : 'qrcode' + img_md="#{pth}/#{fn}#{@fn_lng}.md.png" + img_title="#{pth}/#{fn}#{@fn_lng}.title.png" + if FileTest.file?(@f.place_file.qrcode_md.dir)==true + @manifest[:html] <<< +WOK + end + if FileTest.file?(@f.place_file.qrcode_title.dir)==true + @manifest[:html] <<< +WOK + end + end + def source_tests + if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents + 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?(@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?(@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 (tar.xz)',@f.base_filename.sisupod + summarize_sources(id,file,pth,rel,url) + end + 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 + if defined? @md.title #% + if defined? @md.title.full \ + and @md.title.full=~/\S+/ + id,info=@translate.full_title,@md.title.full + metadata(id,info) + end + end + if defined? @md.creator #% + if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + id,info=@translate.author,@md.creator.author + metadata(id,info) + end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + id,info=@translate.contributor,@md.creator.contributor + metadata(id,info) + end + if defined? @md.creator.translator \ + and @md.creator.translator=~/\S+/ + id,info=@translate.translator,@md.creator.translator + metadata(id,info) + end + if defined? @md.creator.illustrator \ + and @md.creator.illustrator=~/\S+/ + id,info=@translate.illustrator,@md.creator.illustrator + metadata(id,info) + end + if defined? @md.creator.prepared_by \ + and @md.creator.prepared_by=~/\S+/ + id,info=@translate.prepared_by,@md.creator.prepared_by + metadata(id,info) + end + if defined? @md.creator.digitized_by \ + and @md.creator.digitized_by=~/\S+/ + id,info=@translate.digitized_by,@md.creator.digitized_by + metadata(id,info) + end + end + if defined? @md.rights + if defined? @md.rights.all \ + and @md.rights.all=~/\S+/ #dc + id,info=@translate.rights,@md.rights.all + metadata(id,info) + end + end + if defined? @md.date #% + if defined? @md.date.published \ + and @md.date.published=~/\S+/ #dc + id,info=@translate.date,@md.date.published + metadata(id,info) + end + if defined? @md.date.created \ + and @md.date.created=~/\S+/ #dc + id,info=@translate.date_created,@md.date.created + metadata(id,info) + end + if defined? @md.date.issued \ + and @md.date.issued=~/\S+/ #dc + id,info=@translate.date_issued,@md.date.issued + metadata(id,info) + end + if defined? @md.date.available \ + and @md.date.available=~/\S+/ #dc + id,info=@translate.date_available,@md.date.available + metadata(id,info) + end + if defined? @md.date.modified \ + and @md.date.modified=~/\S+/ #dc + id,info=@translate.date_modified,@md.date.modified + metadata(id,info) + end + if defined? @md.date.valid \ + and @md.date.valid=~/\S+/ #dc + id,info=@translate.date_valid,@md.date.valid + metadata(id,info) + end + end + if defined? @md.publisher \ + and @md.publisher=~/\S+/ #dc + id,info=@translate.publisher,@md.publisher + metadata(id,info) + end + if defined? @md.notes #% + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description + metadata(id,info) + end + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract + metadata(id,info) + end + if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + id,info=@translate.comments,@md.notes.comment + metadata(id,info) + end + if defined? @md.notes.prefix_a \ + and @md.notes.prefix_a=~/\S+/ + id,info=@translate.prefix_a,@md.notes.prefix_a + metadata(id,info) + end + if defined? @md.notes.prefix_b \ + and @md.notes.prefix_b=~/\S+/ + id,info=@translate.prefix_b,@md.notes.prefix_b + metadata(id,info) + end + end + if defined? @md.title #% + if defined? @md.title.language \ + and @md.title.language=~/\S+/ + id,info=@translate.language,@md.title.language + metadata(id,info) + end + if defined? @md.original.language \ + and @md.original.language=~/\S+/ + id,info=@translate.language_original,@md.original.language + metadata(id,info) + end + end + if defined? @md.classify #% + if defined? @md.topic_register_array \ + and @md.topic_register_array.length > 0 + @manifest[:html] << %{\n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject + metadata(id,info) + end + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords + metadata(id,info) + end + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc + metadata(id,info) + end + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey + metadata(id,info) + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage + metadata(id,info) + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation + metadata(id,info) + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.notes.type + metadata(id,info) + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format + metadata(id,info) + end + end + if defined? @md.identifier #% + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.identifier.oclc + @manifest[:html] << %{\n} + end + if defined? @md.identifier.pg \ + and @md.identifier.pg=~/\S+/ + id,info=@translate.cls_gutenberg,@md.identifier.pg + metadata(id,info) + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) + end + end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) + end + if @md.fns + id,info=@translate.sourcefile,@md.fns + metadata(id,info) + end + if @md.en[:mismatch] > 0 + id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" + metadata(id,info) + end + if @md.wc_words + id,info=@translate.word_count,@md.wc_words + metadata(id,info) + end + if @md.dgst + id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] + metadata(id,info) + end + if @md.sc_number + id,info=@translate.sc_number,@md.sc_number + metadata(id,info) + end + if @md.sc_date + id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" + metadata(id,info) + end + if @md.generated + id,info=@translate.last_generated,@md.generated + metadata(id,info) + end + if @md.sisu_version + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" + metadata(id,info) + end + if @md.ruby_version + id,info=@translate.ruby_version,@md.ruby_version + metadata(id,info) + end + end + def links_tests + if defined? @md.lnk \ + and @md.lnk + @md.lnk.each do |l| + if defined? l[:say] + target=(l[:url] !~/^\.(\.)?\//) \ + ? 'external' + : '_top' + url,lnk=l[:url],l[:say] + unless url.nil? \ + or url.empty? + links(url,lnk,target) + end + end + end + end + end + def check_output(data) + begin + make=SiSU_Env::ProcessingSettings.new(@md) + minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") + vz=SiSU_Viz::Defaults.new + format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) + @manifest[:html] <<< + + + +SiSU manifest: #{@md.title.full} + + + + + +#{@stylesheet.css_head} + + +#{format_head_toc.seg_head_navigation_band(:manifest)} +WOK + if make.build.manifest_minitoc? + if @o_str.dump_or_redirect? + elsif @f.output_dir_structure.by_language_code? \ + or @f.output_dir_structure.by_filetype? + minitoc=minitoc.gsub(/ +#{minitoc.to_s} + + +

#{@md.title.full}

+

#{@md.author}

+ +

#{@translate.filename}

#{@translate.description}

 

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{id}

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

#{kb}

#{l[:l]}

#{l[:l]}

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

 

#{id}:

#{info}

#{lnk}

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

+

QR code SiSU document metadata:

+

+ qrcode metadata +

+
+

QR code document title info:

+

+ qrcode title +

+

#{@translate.topic_register}:

\n} + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.is_a?(Array) + st.each do |v| + if v.is_a?(Array) + v.each do |w| + @manifest[:html] << %{

#{w}

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

#{v}

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

#{st}

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

#{id}:

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

#{info}

\n} + @manifest[:html] << %{
+WOK + published_versions + @manifest[:html] << '
' + @manifest[:html] <<<#{@translate.manifest_description_output} + + + +WOK + output_tests + @manifest[:html] << '

#{@translate.filetype_description}

#{@translate.filename}

#{@translate.file_size}

(kB)

' + @manifest[:html] <<< +WOK + source_tests + @manifest[:html] << '' + @manifest[:html] <<<#{@translate.manifest_description_metadata} + + +WOK + metadata_tests + @manifest[:html] <<< +WOK + @manifest[:html] <<<#{@translate.suggested_links}:

+

#{@translate.metadata}

#{@translate.description}

+WOK + links_tests + @manifest[:html] <<< +WOK + @manifest[:html] <<<#{@translate.language_version_list} +
+ + +WOK + language_versions + qrc_image + @manifest[:html] <<< + +
+
+#{vz.credits_sisu_manifest} +
+ + +WOK + output + rescue + SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do + __LINE__.to_s + ':' + __FILE__ + end + ensure + end + end + end + end +end +__END__ diff --git a/lib/sisu/v6/hub_actions.rb b/lib/sisu/v6/hub_actions.rb index 62373e6c..bad943e5 100644 --- a/lib/sisu/v6/hub_actions.rb +++ b/lib/sisu/v6/hub_actions.rb @@ -542,7 +542,7 @@ module SiSU_Hub_Actions def manifest? if @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 0 - require_relative 'manifest' # manifest.rb + require_relative 'html_manifest' # html_manifest.rb ((@opt.act[:sisupod][:set]==:on \ || @opt.act[:share_source][:set]==:on) \ && @opt.f_pths.length < 2 ) \ @@ -666,7 +666,7 @@ module SiSU_Hub_Actions || @opt.act[:share_source][:set]==:on) \ and @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 0 - require_relative 'manifest' # manifest.rb + require_relative 'html_manifest' # html_manifest.rb begin ensure SiSU_Hub_Loops::OptionLoopFiles.new(@opt). @@ -800,9 +800,9 @@ module SiSU_Hub_Actions def manifest? if @opt.act[:manifest][:set]==:on #% --manifest, -y if @opt.f_pths.length > 1 - require_relative 'manifest' + require_relative 'html_manifest' SiSU_Hub_Loops::OptionLoopFiles.new(@opt).manifest_on_files_translated do - SiSU_Manifest::Source.new(@opt).read # manifest.rb + SiSU_Manifest::Source.new(@opt).read # html_manifest.rb end end end diff --git a/lib/sisu/v6/manifest.rb b/lib/sisu/v6/manifest.rb deleted file mode 100644 index 46490366..00000000 --- a/lib/sisu/v6/manifest.rb +++ /dev/null @@ -1,1032 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, - All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - 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: - - - * Git - - - - * Ralph Amissah - - - - ** Description: summary of generated outputs and metadata - -=end -module SiSU_Manifest - require_relative 'se' # se.rb - include SiSU_Env - require_relative 'prog_text_translation' # prog_text_translation.rb - require_relative 'se_hub_particulars' # se_hub_particulars.rb - include SiSU_Particulars - require_relative 'html_minitoc' # html_minitoc.rb - require_relative 'html' # html.rb - include SiSU_HTML_Format - require_relative 'dp' # dp.rb - include SiSU_Param - require_relative 'i18n' # i18n.rb - include SiSU_Viz - class Source - def initialize(opt) - @opt=opt - @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::InfoEnv.new(@opt.fns) - @md=SiSU_Param::Parameters.new(@opt).get - xbrowser=@env.program.web_browser - browser=@env.program.console_web_browser -# webserv_url=@env.path.url.output_tell #fix in sysenv - unless @opt.act[:quiet][:set]==:on - url_html='file://' \ - + @md.file.output_path.manifest.dir + '/' \ - + @md.file.base_filename.manifest - (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest', - "#{xbrowser} #{url_html}" - ).green_hi_blue - : SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - 'Manifest', - "[#{@opt.f_pth[:lng_is]}]", - "#{url_html}" - ).grey_title_grey_blue - if (@md.opt.act[:verbose][:set]==:on \ - || @md.opt.act[:verbose_plus][:set]==:on) - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "#{browser} #{url_html}" - ).grey_tab - end - end - data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions - SiSU_Manifest::Source::Output.new(@md).check_output(data) - rescue - SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do - __LINE__.to_s + ':' + __FILE__ - end - ensure - SiSU_Env::CreateSite.new(@opt).cp_css - Dir.chdir(@opt.f_pth[:pth]) - end - end - private - class Output #{@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} - 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} - end - def summarize_sources(id,file,pth,rel,url) - sys=SiSU_Env::SystemCall.new - dgst=case @dg - when :sha512 - sys.sha512("#{pth}/#{file}") - when :sha256 - sys.sha256("#{pth}/#{file}") - when :md5 - sys.md5("#{pth}/#{file}") - else - end - dgst=dgst ? dgst : [ '', 'n/a' ] - if (@md.opt.act[:verbose][:set]==:on \ - || @md.opt.act[:verbose_plus][:set]==:on \ - || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new( - @md.opt.act[:color_state][:set], - "#{dgst[1]} #{file}" - ).warn - end - 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+/ - end - def published_manifests? - @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| - lngc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lc).language_code_insert - fnh={ - fn: @md.fnb, - lng: lngc, - } - mn=@f.base_filename.manifest(fnh) - if @o_str.dump_or_redirect? #does not work for --redirect or --dump - mp="#{@f.output_path.base.dir}" - mt="#{mp}/#{mn}" - mr="../../#{lc}/manifest/#{mn}" - mu="#{url}/#{mn}" - elsif @f.output_dir_structure.by_language_code? - mp="#{@f.output_path.base.dir}/#{lc}/manifest" - mt="#{mp}/#{mn}" - mr="../../#{lc}/manifest/#{mn}" - mu="#{url}/#{lc}/manifest/#{mn}" - elsif @f.output_dir_structure.by_filetype? - mp="#{@f.output_path.base.dir}/manifest" - mt="#{mp}/#{mn}" - mr=mn - mu="#{url}/manifest/#{mn}" - else - mp="#{@f.output_path.base.dir}/#{@md.fnb}" - 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 - @m=@m.uniq - end - def languages(id,file) - @manifest[:html] << %{\n} - end - def published_languages(id) - published_manifests?.each do |l| - @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" - @manifest[:html] << %{\n} - end - end - def metadata(id,info) - info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') - @manifest[:html] << %{\n} - end - def links(url,lnk,target) - static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url) - elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) - else url - end - @manifest[:html] << %{\n} - end - def output_tests - 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.odt.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.xml_docbook_article.dir)==true - pth=@f.output_path.xml_docbook_article.dir - rel=@f.output_path.xml_docbook_article.rel_sm - url=@f.output_path.xml_docbook_article.url - id,file='XML Docbook Book',@f.base_filename.xml_docbook_article - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_docbook_book.dir)==true - pth=@f.output_path.xml_docbook_book.dir - rel=@f.output_path.xml_docbook_book.rel_sm - url=@f.output_path.xml_docbook_book.url - id,file='XML Docbook Book',@f.base_filename.xml_docbook_book - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_fictionbook.dir)==true - pth=@f.output_path.xml_fictionbook.dir - rel=@f.output_path.xml_fictionbook.rel_sm - url=@f.output_path.xml_fictionbook.url - id,file='XML Fictionbook',@f.base_filename.xml_fictionbook - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_scaffold_structure_sisu.dir)==true - pth=@f.output_path.xml_scaffold_structure_sisu.dir - rel=@f.output_path.xml_scaffold_structure_sisu.rel_sm - url=@f.output_path.xml_scaffold_structure_sisu.url - id,file='XML Scaffold sisu structure',@f.base_filename.xml_scaffold_structure_sisu - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.xml_scaffold_structure_collapse.dir)==true - pth=@f.output_path.xml_scaffold_structure_collapse.dir - rel=@f.output_path.xml_scaffold_structure_collapse.rel_sm - url=@f.output_path.xml_scaffold_structure_collapse.url - id,file='XML Scaffold collapsed structure',@f.base_filename.xml_scaffold_structure_collapse - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.info.dir)==true - pth=@f.output_path.texinfo.dir - rel=@f.output_path.texinfo.rel_sm - url=@f.output_path.texinfo.url - id,file='Info file',@f.base_filename.info - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.manpage.dir)==true - pth=@f.output_path.manpage.dir - rel=@f.output_path.manpage.rel_sm - url=@f.output_path.manpage.url - id,file='Manpage',@f.base_filename.manpage - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.sqlite_discrete.dir)==true - id,file='SQLite3 file',@f.base_filename.sqlite_discrete - pth=@f.output_path.sqlite_discrete.dir - rel=@f.output_path.sqlite_discrete.rel_sm - url=@f.output_path.sqlite_discrete.url - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.txt.dir)==true - id='Plaintext (UTF-8)' - 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?(@f.place_file.textile.dir)==true - id='Textile text (UTF-8)' - pth=@f.output_path.textile.dir - rel=@f.output_path.textile.rel_sm - url=@f.output_path.textile.url - file=@f.base_filename.textile - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.asciidoc.dir)==true - id='AsciiDoc text (UTF-8)' - pth=@f.output_path.asciidoc.dir - rel=@f.output_path.asciidoc.rel_sm - url=@f.output_path.asciidoc.url - file=@f.base_filename.asciidoc - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.markdown.dir)==true - id='Markdown text (UTF-8)' - pth=@f.output_path.markdown.dir - rel=@f.output_path.markdown.rel_sm - url=@f.output_path.markdown.url - file=@f.base_filename.markdown - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.rst.dir)==true - id='rST text (UTF-8)' - pth=@f.output_path.rst.dir - rel=@f.output_path.rst.rel_sm - url=@f.output_path.rst.url - file=@f.base_filename.rst - summarize(id,file,pth,rel,url) - end - if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true - id,file='LaTeX (portrait)',"#{@md.fns}.tex" - 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,rel,url='','','' - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.hash_digest.dir)==true - pth=@f.output_path.hash_digest.dir - rel=@f.output_path.hash_digest.rel_sm - url=@f.output_path.hash_digest.url - id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest - summarize(id,file,pth,rel,url) - end - end - def published_versions - id,file='Markup (SiSU source)',@md.fns - languages(id,file) - end - def language_versions - if FileTest.file?(@f.place_file.manifest.dir)==true - id='Markup (SiSU source)' - published_languages(id) - end - end - def qrc_image - fn=(@f.output_dir_structure.by_filename?) \ - ? 'sisu_manifest' - : @md.fnb - pth=((@o_str.dump_or_redirect?) \ - || (@f.output_dir_structure.by_filename?)) \ - ? '.' - : 'qrcode' - img_md="#{pth}/#{fn}#{@fn_lng}.md.png" - img_title="#{pth}/#{fn}#{@fn_lng}.title.png" - if FileTest.file?(@f.place_file.qrcode_md.dir)==true - @manifest[:html] <<< -WOK - end - if FileTest.file?(@f.place_file.qrcode_title.dir)==true - @manifest[:html] <<< -WOK - end - end - def source_tests - if @md.fno =~/\.ssm$/ #% decide whether to extract and include requested/required documents - 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?(@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?(@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 (tar.xz)',@f.base_filename.sisupod - summarize_sources(id,file,pth,rel,url) - end - 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 - if defined? @md.title #% - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - id,info=@translate.full_title,@md.title.full - metadata(id,info) - end - end - if defined? @md.creator #% - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - id,info=@translate.author,@md.creator.author - metadata(id,info) - end - if defined? @md.creator.editor \ - and @md.creator.editor=~/\S+/ - id,info=@translate.editor,@md.creator.editor - metadata(id,info) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - id,info=@translate.contributor,@md.creator.contributor - metadata(id,info) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - id,info=@translate.translator,@md.creator.translator - metadata(id,info) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - id,info=@translate.illustrator,@md.creator.illustrator - metadata(id,info) - end - if defined? @md.creator.prepared_by \ - and @md.creator.prepared_by=~/\S+/ - id,info=@translate.prepared_by,@md.creator.prepared_by - metadata(id,info) - end - if defined? @md.creator.digitized_by \ - and @md.creator.digitized_by=~/\S+/ - id,info=@translate.digitized_by,@md.creator.digitized_by - metadata(id,info) - end - end - if defined? @md.rights - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ #dc - id,info=@translate.rights,@md.rights.all - metadata(id,info) - end - end - if defined? @md.date #% - if defined? @md.date.published \ - and @md.date.published=~/\S+/ #dc - id,info=@translate.date,@md.date.published - metadata(id,info) - end - if defined? @md.date.created \ - and @md.date.created=~/\S+/ #dc - id,info=@translate.date_created,@md.date.created - metadata(id,info) - end - if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ #dc - id,info=@translate.date_issued,@md.date.issued - metadata(id,info) - end - if defined? @md.date.available \ - and @md.date.available=~/\S+/ #dc - id,info=@translate.date_available,@md.date.available - metadata(id,info) - end - if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ #dc - id,info=@translate.date_modified,@md.date.modified - metadata(id,info) - end - if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ #dc - id,info=@translate.date_valid,@md.date.valid - metadata(id,info) - end - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ #dc - id,info=@translate.publisher,@md.publisher - metadata(id,info) - end - if defined? @md.notes #% - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - id,info=@translate.comments,@md.notes.comment - metadata(id,info) - end - if defined? @md.notes.prefix_a \ - and @md.notes.prefix_a=~/\S+/ - id,info=@translate.prefix_a,@md.notes.prefix_a - metadata(id,info) - end - if defined? @md.notes.prefix_b \ - and @md.notes.prefix_b=~/\S+/ - id,info=@translate.prefix_b,@md.notes.prefix_b - metadata(id,info) - end - end - if defined? @md.title #% - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - id,info=@translate.language,@md.title.language - metadata(id,info) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - id,info=@translate.language_original,@md.original.language - metadata(id,info) - end - end - if defined? @md.classify #% - if defined? @md.topic_register_array \ - and @md.topic_register_array.length > 0 - @manifest[:html] << %{\n} - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords - metadata(id,info) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc - metadata(id,info) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey - metadata(id,info) - end - if defined? @md.notes.coverage \ - and @md.notes.coverage=~/\S+/ - id,info=@translate.coverage,@md.notes.coverage - metadata(id,info) - end - if defined? @md.notes.relation \ - and @md.notes.relation=~/\S+/ - id,info=@translate.relation,@md.notes.relation - metadata(id,info) - end - if defined? @md.notes.type \ - and @md.notes.type=~/\S+/ #dc - id,info=@translate.type,@md.notes.type - metadata(id,info) - end - if defined? @md.notes.format \ - and @md.notes.format=~/\S+/ - id,info=@transate.format,@md.notes.format - metadata(id,info) - end - end - if defined? @md.identifier #% - if defined? @md.identifier.oclc \ - and @md.identifier.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.identifier.oclc - @manifest[:html] << %{\n} - end - if defined? @md.identifier.pg \ - and @md.identifier.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.identifier.pg - metadata(id,info) - end - if defined? @md.identifier.isbn \ - and @md.identifier.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.identifier.isbn - metadata(id,info) - end - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source - metadata(id,info) - end - if @md.fns - id,info=@translate.sourcefile,@md.fns - metadata(id,info) - end - if @md.en[:mismatch] > 0 - id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" - metadata(id,info) - end - if @md.wc_words - id,info=@translate.word_count,@md.wc_words - metadata(id,info) - end - if @md.dgst - id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] - metadata(id,info) - end - if @md.sc_number - id,info=@translate.sc_number,@md.sc_number - metadata(id,info) - end - if @md.sc_date - id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" - metadata(id,info) - end - if @md.generated - id,info=@translate.last_generated,@md.generated - metadata(id,info) - end - if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" - metadata(id,info) - end - if @md.ruby_version - id,info=@translate.ruby_version,@md.ruby_version - metadata(id,info) - end - end - def links_tests - if defined? @md.lnk \ - and @md.lnk - @md.lnk.each do |l| - if defined? l[:say] - target=(l[:url] !~/^\.(\.)?\//) \ - ? 'external' - : '_top' - url,lnk=l[:url],l[:say] - unless url.nil? \ - or url.empty? - links(url,lnk,target) - end - end - end - end - end - def check_output(data) - begin - make=SiSU_Env::ProcessingSettings.new(@md) - minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") - vz=SiSU_Viz::Defaults.new - format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) - @manifest[:html] <<< - - - -SiSU manifest: #{@md.title.full} - - - - - -#{@stylesheet.css_head} - - -#{format_head_toc.seg_head_navigation_band(:manifest)} -WOK - if make.build.manifest_minitoc? - if @o_str.dump_or_redirect? - elsif @f.output_dir_structure.by_language_code? \ - or @f.output_dir_structure.by_filetype? - minitoc=minitoc.gsub(/ -#{minitoc.to_s} - - -

#{@md.title.full}

-

#{@md.author}

- -

#{@translate.filename}

#{@translate.description}

 

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{img}#{id}

#{file}

#{url_make(url,file)}

#{kb}

#{id}

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

#{kb}

#{l[:l]}

#{l[:l]}

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

 

#{id}:

#{info}

#{lnk}

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

-

QR code SiSU document metadata:

-

- qrcode metadata -

-
-

QR code document title info:

-

- qrcode title -

-

#{@translate.topic_register}:

\n} - @md.topic_register_array.each do |t| - t.each_with_index do |st,i| - if st.is_a?(Array) - st.each do |v| - if v.is_a?(Array) - v.each do |w| - @manifest[:html] << %{

#{w}

\n} - end - else - @manifest[:html] << %{

#{v}

\n} - end - end - else @manifest[:html] << %{

#{st}

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

#{id}:

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

#{info}

\n} - @manifest[:html] << %{
-WOK - published_versions - @manifest[:html] << '
' - @manifest[:html] <<<#{@translate.manifest_description_output} - - - -WOK - output_tests - @manifest[:html] << '

#{@translate.filetype_description}

#{@translate.filename}

#{@translate.file_size}

(kB)

' - @manifest[:html] <<< -WOK - source_tests - @manifest[:html] << '' - @manifest[:html] <<<#{@translate.manifest_description_metadata} - - -WOK - metadata_tests - @manifest[:html] <<< -WOK - @manifest[:html] <<<#{@translate.suggested_links}:

-

#{@translate.metadata}

#{@translate.description}

-WOK - links_tests - @manifest[:html] <<< -WOK - @manifest[:html] <<<#{@translate.language_version_list} -
- - -WOK - language_versions - qrc_image - @manifest[:html] <<< - -
-
-#{vz.credits_sisu_manifest} -
- - -WOK - output - rescue - SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do - __LINE__.to_s + ':' + __FILE__ - end - ensure - end - end - end - end -end -__END__ -- cgit v1.2.3

#{@translate.filename}

#{@translate.description}