From 26767cc88c0548ad7978021796d0ccc4c9f7ffed Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 2 Jun 2007 11:27:06 +0100 Subject: 0.53.0, pre-build, see changelog, library naming changed for scm, placed under v0 (instead of 0.53) --- lib/sisu/0.52/manifest.rb | 528 ---------------------------------------------- 1 file changed, 528 deletions(-) delete mode 100644 lib/sisu/0.52/manifest.rb (limited to 'lib/sisu/0.52/manifest.rb') diff --git a/lib/sisu/0.52/manifest.rb b/lib/sisu/0.52/manifest.rb deleted file mode 100644 index 3bc04235..00000000 --- a/lib/sisu/0.52/manifest.rb +++ /dev/null @@ -1,528 +0,0 @@ -=begin - * Name: SiSU information Structuring Universe - Structured information, Serialized Units - * Author: Ralph Amissah - * http://www.jus.uio.no/sisu - * http://www.jus.uio.no/sisu/SiSU/download.html - - * Description: document summary processing, available outputs and metadata - - * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah - - * License: GPL 2 or later - - Summary of GPL 2 - - 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 2 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - http://www.fsf.org/licenses/gpl.html - http://www.gnu.org/copyleft/gpl.html - http://www.jus.uio.no/sisu/gpl2.fsf - - SiSU was first released to the public on January 4th 2005 - - SiSU uses: - - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - © Ralph Amissah 1997, current 2007. - All Rights Reserved. - - * Notes: tidy -ascii index.xml >> index.tidy - - * Ralph Amissah: ralph@amissah.com - ralph.amissah@gmail.com -=end -module SiSU_Manifest - require SiSU_lib + '/sysenv' - require SiSU_lib + '/i18n' - include SiSU_Env - include SiSU_Param - include SiSU_Viz - class Source - def initialize(opt) - @opt=opt - l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns) - @doc_language=l[:l] - end - def read - begin - @env=SiSU_Env::Info_env.new(@opt.fns) - @md=SiSU_Param::Parameters.new(@opt).get - SiSU_Env::Info_skin.new(@md).select - xbrowser=@env.program.web_browser - browser=@env.program.console_web_browser - webserv_url=@env.path.url.output_tell - url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}" - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}") - tell.green_hi_blue unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}") - tell.grey_tab if @opt.cmd =~/v/i - Output_Info.new(@md).check_output - rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error - ensure - end - end - private - class Output_Info [],:html=>[] } - @md,@fns=md - @env=SiSU_Env::Info_env.new(@md.fns) - @fnb=@md.fnb - out=@env.path.output - @base_url="#{@env.url.root}/#@fnb" - @base_path="#{out}/#@fnb" - @@dg ||=SiSU_Env::Info_env.new.digest.type - @dg=@@dg - l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) - @language=l[:l] - @translate=SiSU_Translate::Source.new(@md,@language) - end - def output - SiSU_Env::SiSU_file.new(@md).mkdir - manifest=SiSU_Env::SiSU_file.new(@md,@md.fn[:manifest]).mkfile - @manifest[:html].each do |x| - manifest << x - end - end - def summarize(id,file) - size=(File.size("#{@base_path}/#{file}")/1024.00).to_s - kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] - @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{

#{file}

#{id}

#@base_url/#{file}

#{kb}

\n} - end - def summarize_source(id,file) - sys=SiSU_Env::System_call.new - dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path}/#{file}") - else sys.md5("#{@base_path}/#{file}") - end - tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}") - tell.warn if @md.cmd =~/[vVM]/ - size=(File.size("#{@base_path}/#{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}

#@base_url/#{file}

#{dgst[1]}

#{kb}

\n} - end - def languages(id,file) - flv=@env.published_manifests?(@base_path) - @manifest[:html] << %{\n} - end - def published_languages(id,file) - flv=@env.published_manifests?(@base_path) - flv.each do |l| - lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list - @manifest[:txt] << "#{l[:m]} #{lang}\n" - @manifest[:html] << %{

#{lang}

#{lang}

#@base_url/#{l[:m]}

 

\n} - end - end - def metadata(id,info) - @manifest[:html] << %{

#{id}:

#{info}

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

#{lnk}

#{static}

\n} - end - def output_tests - if FileTest.file?("#@base_path/#{@md.fn[:toc]}")==true - id,file='HTML table of contents (linked to segmented text)',@md.fn[:toc] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:doc]}")==true - id,file='HTML document (scroll)',@md.fn[:doc] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:xhtml]}")==true - id,file='XHTML',@md.fn[:xhtml] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:sax]}")==true - id,file='XML (SAX)',@md.fn[:sax] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:dom]}")==true - id,file='XML (DOM)',@md.fn[:dom] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:odf]}")==true - id,file='ODF:ODT (Open Document Format)',@md.fn[:odf] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:pdf_p]}")==true - id,file='PDF (portrait) - print bias',@md.fn[:pdf_p] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:pdf_l]}")==true - id,file='PDF (landscape) - screen view bias (colored links)',@md.fn[:pdf_l] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:plain]}")==true - if @md.cmd =~/a/; id,file='plaintext Unix (UTF-8) (footnotes)',@md.fn[:plain] - elsif @md.cmd =~/e/; id,file='plaintext Unix (UTF-8) (endnotes)',@md.fn[:plain] - elsif @md.cmd =~/A/; id,file='plaintext dos (UTF-8) (footnotes)',@md.fn[:plain] - elsif @md.cmd =~/E/; id,file='plaintext dos (UTF-8) (endnotes)',@md.fn[:plain] - else id,file='plaintext (UTF-8)',@md.fn[:plain] - end - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:concordance]}")==true - id,file='Concordance (wordmap)',@md.fn[:concordance] - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fns}.tex")==true - id,file='LaTeX (portrait)',"#{@md.fns}.tex" - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fns}.tex")==true - id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex" - summarize(id,file) - end - if FileTest.file?("#@base_path/#{@md.fn[:digest]}")==true - id,file="Digest/DCC - Document Content Certificate (#@dg)",@md.fn[:digest] - summarize(id,file) - end - end - def published_versions - if FileTest.file?("#@base_path/sisu_manifest.html")==true - id,file='Markup (SiSU source)',@md.fns - languages(id,file) - end - end - def language_versions - if FileTest.file?("#@base_path/sisu_manifest.html")==true - id,file='Markup (SiSU source)',@md.fns - published_languages(id,file) - end - end - def source_tests - if @md.fns =~/\._sst$/ #% decide whether to extract and include requested/required documents - req=@md.fns.gsub(/(.+)?\._sst$/,'\1.composite.sst') #watch strange - if FileTest.file?("#@base_path/#{req}")==true - id,file='Markup Composite File (SiSU source)',req - summarize_source(id,file) - end - end - if FileTest.file?("#@base_path/#{@md.fns}")==true - id,file='Markup (SiSU source)',@md.fns - summarize_source(id,file) - end - if FileTest.file?("#@base_path/sisupod.zip")==true - id,file='SiSU doc (zip)','sisupod.zip' - summarize_source(id,file) - end - if FileTest.file?("#@base_path/#{@md.fnb}")==true and @md.fnb =~/\.kdi$/ - id,file='Kdissert (.kdi source)',@md.fnb - summarize_source(id,file) - end - end - def metadata_tests - if @md.dc_title - id,info=@translate.dc_title,@md.dc_title - metadata(id,info) - end - if @md.title - id,info=@translate.title,@md.title - metadata(id,info) - end - if @md.subtitle - id,info=@translate.subtitle,@md.subtitle - metadata(id,info) - end - if @md.dc_creator - id,info=@translate.creator,@md.dc_creator - metadata(id,info) - end - if @md.dc_contributor - id,info=@translate.contributor,@md.dc_contributor - metadata(id,info) - end - if @md.translator - id,info=@translate.translator,@md.translator - metadata(id,info) - end - if @md.illustrator - id,info=@translate.illustrator,@md.illustrator - metadata(id,info) - end - if @md.dc_publisher - id,info=@translate.publisher,@md.dc_publisher - metadata(id,info) - end - if @md.prepared_by - id,info=@translate.prepared_by,@md.prepared_by - metadata(id,info) - end - if @md.digitized_by - id,info=@translate.digitized_by,@md.digitized_by - metadata(id,info) - end - if @md.dc_subject - id,info=@translate.subject,@md.dc_subject - metadata(id,info) - end - if @md.dc_description - id,info=@translate.dc_description,@md.dc_description - metadata(id,info) - end - if @md.abstract - id,info=@translate.abstract,@md.abstract - metadata(id,info) - end - if @md.dc_type - id,info=@translate.type,@md.dc_type - metadata(id,info) - end - if @md.dc_rights - id,info=@translate.rights,@md.dc_rights - metadata(id,info) - end - if @md.dc_date - id,info=@translate.date,@md.dc_date - metadata(id,info) - end - if @md.dc_date_created - id,info=@translate.date_created,@md.dc_date_created - metadata(id,info) - end - if @md.dc_date_issued - id,info=@translate.date_issued,@md.dc_date_issued - metadata(id,info) - end - if @md.dc_date_available - id,info=@translate.date_available,@md.dc_date_available - metadata(id,info) - end - if @md.dc_date_modified - id,info=@translate.date_modified,@md.dc_date_modified - metadata(id,info) - end - if @md.dc_date_valid - id,info=@translate.date_valid,@md.dc_date_valid - metadata(id,info) - end - if @md.dc_language and @md.dc_language[:name] - id,info=@translate.language,@md.dc_language[:name] - metadata(id,info) - end - if @md.language_original and @md.language_original[:name] - id,info=@translate.language_original,@md.language_original[:name] - metadata(id,info) - end - if @md.dc_format - id,info=@transate.format,@md.dc_format - metadata(id,info) - end - if @md.dc_identifier - id,info=@translate.identifier,@md.dc_identifier - metadata(id,info) - end - if @md.dc_source - id,info=@translate.source,@md.dc_source - metadata(id,info) - end - if @md.dc_relation - id,info=@translate.relation,@md.dc_relation - metadata(id,info) - end - if @md.dc_coverage - id,info=@translate.coverage,@md.dc_coverage - metadata(id,info) - end - if @md.keywords - id,info=@translate.keywords,@md.keywords - metadata(id,info) - end - if @md.comments - id,info=@translate.comments,@md.comments - metadata(id,info) - end - if @md.cls_loc - id,info=@translate.cls_loc,@md.cls_loc - metadata(id,info) - end - if @md.cls_dewey - id,info=@translate.cls_dewey,@md.cls_dewey - metadata(id,info) - end - if @md.cls_pg - id,info=@translate.cls_gutenberg,@md.cls_pg - metadata(id,info) - end - if @md.cls_isbn - id,info=@translate.cls_isbn,@md.cls_isbn - metadata(id,info) - end - if @md.prefix_a - id,info=@translate.prefix_a,@md.prefix_a - metadata(id,info) - end - if @md.prefix_b - id,info=@translate.prefix_b,@md.prefix_b - 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]})" - 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=if l[:url] !~/^\.(\.)?\//; 'external' - else '_top' - end - url,lnk=l[:url],l[:say] - unless url.nil? or url.empty?; links(url,lnk,target) - end - end - end - end - end - def check_output - begin - id,file='','' - vz=SiSU_Env::Get_init.instance.skin - #vz=SiSU_Viz::Skin.new - banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ and vz.banner_home_button_only !~ /sisu\.home\.png/ -< -#{vz.banner_home_button}

TOC linked #@base_url/#{file}

#{@env.widget_static.search_form}SiSU --> - -WOK - else -< -SiSU -->

TOC linked #@base_url/#{file}

#{@env.widget_static.search_form} - -WOK - end - @manifest[:html] <<< - - - -SiSU manifest: #{@md.title} - - - - - - - - -#{banner_table} -

#{@md.dc_title}

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

#{@translate.filename}

#{@translate.description}

#{@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] <<< - -WOK - links_tests - @manifest[:html] <<< -WOK - @manifest[:html] <<<#{@translate.language_version_list} -

#{@translate.metadata}

#{@translate.description}

#{@translate.suggested_links}:

- - -WOK - language_versions - @manifest[:html] <<< -#{vz.credits_splash} - - -WOK - output - rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error - ensure - end - end - end - end -end -__END__ -- cgit v1.2.3

#{@translate.filename}

#{@translate.description}