diff options
| author | Ralph Amissah <ralph@amissah.com> | 2007-10-15 02:10:40 +0100 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2007-10-15 02:10:40 +0100 | 
| commit | 88dbbab55d82cf27de3bc9b3d5f2ad0ad48e36c8 (patch) | |
| tree | eca66481b24900589602feb2c9c4fe7182951728 /lib | |
| parent | Updated sisu-0.61.0 (diff) | |
| parent | composite master renaming, and; multiple remote puts (rsync|scp) (diff) | |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
27 files changed, 658 insertions, 728 deletions
| diff --git a/lib/sisu/v0/composite.rb b/lib/sisu/v0/composite.rb index 88c6c48a..4768522a 100644 --- a/lib/sisu/v0/composite.rb +++ b/lib/sisu/v0/composite.rb @@ -113,7 +113,7 @@ module SiSU_Assemble        end      end      def write(assembled) -      assembled_file=File.new("#{@env.path.composite_file}/#{@opt.fnb}._sst",'w+') +      assembled_file=File.new("#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst",'w+')        assembled.each{|a| assembled_file << a }        assembled_file.close      end diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 132da336..3631a77c 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -324,36 +324,39 @@ module SiSU_DAL        when /4/; cf_defaults.cf_4        when /5/; cf_defaults.cf_5        end -      file_type_names=[] -      file_type_names <<= if cmd_list =~ /y/; 'sisu_manifest.html' +      file_type_names={} +      file_type_names[:gen],file_type_names[:src]=[],[] +      file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html'        end -      file_type_names <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] +      file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html']        end -      file_type_names <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] +      file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf']        end -      #file_type_names <<= if cmd_list =~ /i/; 'manpage.1' +      #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1'        #end -      file_type_names <<= if cmd_list =~ /o/; 'opendocument.odt' +      file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt'        end -      file_type_names <<= if cmd_list =~ /b/; 'scroll.xhtml' +      file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml'        end -      file_type_names <<= if cmd_list =~ /x/; 'sax.xml' +      file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml'        end -      file_type_names <<= if cmd_list =~ /X/; 'dom.xml' +      file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml'        end -      file_type_names <<= if cmd_list =~ /a/; 'plain.txt' +      file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt'        end -      file_type_names <<= if cmd_list =~ /g/; 'wiki.txt' +      file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt'        end -      file_type_names <<= if cmd_list =~ /w/; 'concordance.html' +      file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html'        end -      file_type_names <<= if cmd_list =~ /N/; 'digest.txt' +      file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt'        end -      file_type_names <<= if source and cmd_shortcut =~ /s/; source +      file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source        end -      file_type_names <<= if cmd_shortcut =~ /S/; 'sisupod.zip' +      file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip"        end -      file_type_names=file_type_names.flatten +      file_type_names[:gen]=file_type_names[:gen].flatten +      file_type_names[:src]=file_type_names[:src].flatten +      file_type_names      end      def expand_insertions?(data)        tuned_file,tuned_file_tmp=[],[] @@ -378,7 +381,8 @@ module SiSU_DAL              end            end            tuned_file_tmp << manifest -          output_filetypes_in_cmd(cmd,source).each do |o_f| +          output_filetypes=output_filetypes_in_cmd(cmd,source) +          output_filetypes[:gen].each do |o_f|              describe = case o_f              when /sisu_manifest.html/; '~^ document manifest'              when /toc.html/;           ' html, segmented text' @@ -394,15 +398,25 @@ module SiSU_DAL              when /wiki.txt/;           ' wiki text'              when /concordance.html/;   ' concordance'              when /digest.txt/;         ' dcc, document content certificate (digests)' +            else nil +            end +            if describe +              tuned_file_tmp << if @output_url #to double space <:br> at beginning of entry +                "     {#{describe} }#@output_url/#{url_dir}/#{o_f}" if describe +              else "     { #{describe} }../#{url_dir}/#{o_f}" +              end +            end +          end +          output_filetypes[:src].each do |o_f| +            describe = case o_f +            when /#{source}\.zip/;     ' markup source (zipped) pod'              when /#{source}/;          ' markup source text' -            when /sisupod.zip/;        ' zipped markup source pod'              else nil              end              if describe -              if @output_url -                tuned_file_tmp << "     {#{describe} }#@output_url/#{url_dir}/#{o_f}" if describe #to double space <:br> at beginning of entry -              else -                tuned_file_tmp << "     { #{describe} }../#{url_dir}/#{o_f}" #to double space <:br> at beginning of entry +              tuned_file_tmp << if @output_url +                "     {#{describe} }#@output_url/src/#{o_f}" if describe +              else "     { #{describe} }../#{url_dir}/#{o_f}"                end              end            end diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 47fbeec8..46a55775 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -205,6 +205,9 @@ module SiSU_Viz      def url_path_image #used for html image display        '../_sisu/image'      end +    def url_path_image_sys #used for html image display +      '../_sisu/image_sys' +    end      def url_path_ebook_dir        './ebook'      end @@ -767,61 +770,61 @@ module SiSU_Viz        png_site      end      def png_nav -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_bluebell}" alt="Contents" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />}      end      def png_manifest -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_manifest}" alt="Document Manifest" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />}      end      def png_doc -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_doc}" alt="Full Text" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />}      end      def png_toc -      %{<img border="0" height="18" width="15" src="#{url_path_image}/#{icon_toc}" alt="TOC linked" />} +      %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />}      end      def png_odf -      %{<img border="0" height="18" width="18" src="#{url_path_image}/#{icon_odf}" alt="ODF/ODT" />} +      %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />}      end      def png_pdf -      %{<img border="0" height="18" width="15" src="#{url_path_image}/#{icon_pdf}" alt="PDF" />} +      %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />}      end      def png_pdf_portrait -      %{<img border="0" height="18" width="15" src="#{url_path_image}/#{icon_pdf}" alt="PDF portrait" />} +      %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />}      end      def png_pdf_landscape -      %{<img border="0" height="15" width="18" src="#{url_path_image}/#{icon_pdf}" alt="PDF landscape" />} +      %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />}      end      def png_wmp -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_wmp}" alt="Concordance" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_wmp}" alt="Concordance" />}      end      def png_para -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_para}" alt="Segment" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_para}" alt="Segment" />}      end      def png_status -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_status}" alt="Membership status" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_status}" alt="Membership status" />}      end      def png_mark -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_rose}" alt="*" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_rose}" alt="*" />}      end      def png_doc_tiny -      %{<img border="0" height="8" width="8" src="#{url_path_image}/#{icon_doc}" alt="Doc" />} +      %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_doc}" alt="Doc" />}      end      def png_toc_tiny -      %{<img border="0" height="8" width="8" src="#{url_path_image}/#{icon_toc}" alt="TOC" />} +      %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC" />}      end      def png_status_tiny -      %{<img border="0" height="8" width="8" src="#{url_path_image}/#{icon_status}" alt="Status, Member States" />} +      %{<img border="0" height="8" width="8" src="#{url_path_image_sys}/#{icon_status}" alt="Status, Member States" />}      end      def png_ftp -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_ftp}" alt="FTP" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_ftp}" alt="FTP" />}      end      def png_gopher -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_gopher}" alt="Gopher" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_gopher}" alt="Gopher" />}      end      def png_crosslink -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_crosslink_toc}" alt="lateral hop" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_crosslink_toc}" alt="lateral hop" />}      end      def png_crosslink_ext -      %{<img border="0" height="15" width="15" src="#{url_path_image}/#{icon_external_toc}" alt="lateral hop" />} +      %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_external_toc}" alt="lateral hop" />}      end      def png_home        dir=SiSU_Env::Info_env.new #(@fns) @@ -832,21 +835,21 @@ module SiSU_Viz        %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} -->" />}      end      def png_book -      %{<img border="2" height="15" width="15" src="#{url_path_image}/#{icon_book}" alt="Cameron May Books" />} +      %{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />}      end      #% png_nav      def png_nav_home      end      def png_nav_toc -      %{<img border="0" width="22" height="22" src="#{url_path_image}/#{icon_up}" alt="TOC" />} +      %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_up}" alt="TOC" />}      end      def png_nav_doc      end      def png_nav_previous -      %{<img border="0" width="22" height="22" src="#{url_path_image}/#{icon_previous}" alt="<< previous" />} +      %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_previous}" alt="<< previous" />}      end      def png_nav_next -      %{<img border="0" width="22" height="22" src="#{url_path_image}/#{icon_next}" alt="next >>" />} +      %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon_next}" alt="next >>" />}      end      def png_nav_pre        png_nav_previous @@ -855,22 +858,22 @@ module SiSU_Viz        png_nav_next      end      def png_nav_pdf -      %{<img border="0" height="18" width="15" src="#{url_path_image}/#{icon_pdf}" alt="PDF" />} +      %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />}      end      def png_nav_pdf_portrait -      %{<img border="0" width="15" height="18" src="#{url_path_image}/#{icon_pdf}" alt="pdf portrait" />} +      %{<img border="0" width="15" height="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf portrait" />}      end      def png_nav_pdf_landscape -      %{<img border="0" width="18" height="15" src="#{url_path_image}/#{icon_pdf}" alt="pdf landscape" />} +      %{<img border="0" width="18" height="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="pdf landscape" />}      end      def png_nav_dot_toc -      %{<img border="0" width="100%" height="20" src="#{url_path_image}/#{icon_dot}" alt="^" />} +      %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="^" />}      end      def png_nav_dot_previous -      %{<img border="0" width="100%" height="20" src="#{url_path_image}/#{icon_dot}" alt="<" />} +      %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt="<" />}      end      def png_nav_dot_next -      %{<img border="0" width="100%" height="20" src="#{url_path_image}/#{icon_dot}" alt=">" />} +      %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon_dot}" alt=">" />}      end      def png_nav_dot_pre        png_nav_dot_previous diff --git a/lib/sisu/v0/embedded.rb b/lib/sisu/v0/embedded.rb new file mode 100644 index 00000000..22835e8f --- /dev/null +++ b/lib/sisu/v0/embedded.rb @@ -0,0 +1,171 @@ +=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 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007 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 <http://www.gnu.org/licenses/>. + +   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/gpl.fsf> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.jus.uio.no/sisu/SiSU/download.html> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: sitemap created from parameters extracted from input file(s) + +=end +module SiSU_Embedded +  require "#{SiSU_lib}/param" +  require "#{SiSU_lib}/sysenv" +  include SiSU_Env +  include SiSU_Param +  class Source +    require 'fileutils' +    include FileUtils +    def initialize(opt) +      @opt=opt +      @md=SiSU_Param::Parameters.new(@opt).get +      @env=SiSU_Env::Info_env.new(@md.fns) +      @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base +    end +    def read +      songsheet +    end +    def songsheet +      images +      audio +      multimedia +      begin +      rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error +      ensure +      end +    end +    def images +      src="#{Dir.pwd}/_sisu/image" +      ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" +      rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/image" +      if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +        File.mkpath(ldest) unless FileTest.directory?(ldest) +        src_ec="#{src}/" + @md.ec[:image].join(" #{src}/") +        SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync +        if @md.cmd.inspect =~/R/ #rsync to remote image directory +          SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync +        end +      end +    end +    def audio +      #p @md.ec[:audio] +      src="#{Dir.pwd}/_sisu/mm/audio" +      ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" +      rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/mm/audio" +      if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +        File.mkpath(ldest) unless FileTest.directory?(ldest) +        src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/") +        SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync +        if @md.cmd.inspect =~/R/ #rsync to remote audio directory +          SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync +        end +      end +    end +    def multimedia +      #p @md.ec[:multimedia] +      src="#{Dir.pwd}/_sisu/mm/video" +      ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" +      rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/mm/video" +      if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +        File.mkpath(ldest) unless FileTest.directory?(ldest) +        src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/") +        SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync +        if @md.cmd.inspect =~/R/ #rsync to remote video directory +          SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync +        end +      end +    end +  end +end +__END__ +def images # alternative may be preferable as source taken from local destination, and not sent remotely unless found there +  src="#{Dir.pwd}/_sisu/image" +  ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" +  rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/image" +  if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +    File.mkpath(ldest) unless FileTest.directory?(ldest) +    @md.ec[:image].each do |i| +      SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync +      #cp("#{src}/#{i}","#{ldest}/.") #use rysnc +      if @md.cmd.inspect =~/R/ #rsync to remote image directory #ldest used as source, if not in local repo, don't share +        SiSU_Env::System_call.new("#{ldest}/#{i}","#{rdest}/.",'q').rsync +      end +    end +  end +end +def audio +  #p @md.ec[:audio] +  src="#{Dir.pwd}/_sisu/mm/audio" +  ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" +  if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +    File.mkpath(ldest) unless FileTest.directory?(ldest) +    @md.ec[:audio].each do |i| +      SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync +      #cp("#{src}/#{i}","#{ldest}/.") #use rysnc +      if @md.cmd.inspect =~/R/ +        #rsync to remote audio directory +      end +    end +  end +end +def multimedia +  #p @md.ec[:multimedia] +  src="#{Dir.pwd}/_sisu/mm/video" +  ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" +  if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) +    File.mkpath(ldest) unless FileTest.directory?(ldest) +    @md.ec[:multimedia].each do |i| +      SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync +      #cp("#{src}/#{i}","#{ldest}/.") #use rysnc +      if @md.cmd.inspect =~/R/ +        #rsync to remote multimedia directory +      end +    end +  end +end diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 0cd100f4..e9f3906b 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -64,7 +64,7 @@ module SiSU_Help        if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX        else                    @cX=SiSU_Screen::Ansi.new('yes').cX        end -      fns='dummy_file_ref.sst' +      fns='help_example_dummy_file_name.sst'        @env=SiSU_Env::Info_env.new(fns)        @db=SiSU_Env::Info_db.new        m=/.+\/(\S+)/m @@ -454,7 +454,7 @@ sisu    Note: page breaks are usually introduced to pdfs either as header instructions, indicating that pages should break at given levels    ------------------------------------------    #{@cX.cyan}Composite documents#{@cX.off} -    It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}._sst#{@cX.off} +    It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}.ssm.sst#{@cX.off}      #{@cX.cyan}#basic sisu markup alternatives#{@cX.off}        #{@cX.green}{#{@cX.off}filename.ssi#{@cX.green}}require#{@cX.off} @@ -867,7 +867,7 @@ If you have problems check permissions (and if in home directory ownership).    images:      source:                    #{@cX.blue}#{@env.path.image_source}#{@cX.off}      latex source:              #{@cX.blue}#{@env.path.image_source_tex}#{@cX.off} -    note images are also sourced from within your pwd - #{@cX.blue}#{Dir.pwd}/_sisu/sisu/image_local#{@cX.off} if it exists +    note images are also sourced from within your pwd - #{@cX.blue}#{Dir.pwd}/_sisu/image#{@cX.off} if it exists    #{@cX.grey}[ texinfo:                     #{@env.path.texinfo} - check duplication ]#{@cX.off}   #{@cX.green}resource configuraton files#{@cX.off} to change the paths specified above, are searched for in the following order: @@ -967,7 +967,7 @@ WOK        images that the author wishes to include within documents,        these should be placed in a sub-directory -      within the current document markup directory called #{@cX.green}_sisu/sisu/image_local#{@cX.off} +      within the current document markup directory called #{@cX.green}_sisu/image#{@cX.off}        if an instruction is given to process a remote document which contains        downloadable images, they are included in a sub-directory of the current diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 090c779a..e770a339 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -198,7 +198,7 @@ module SiSU_HTML_Format  }      end      def scroll(text) -      if @md.fns =~ /\.[_-]?sst$/ +      if @md.fns =~ /\.(?:-|ssm\.)?sst$/          scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>    <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}>      #{text} diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index c4e18184..1fc8fb4d 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -188,7 +188,7 @@ module SiSU_HTML_promo          end        end        def image -        @prod['image'] ? %{<img border="0" src="../_sisu/image_local/#{@prod['image']}" /><br />} : '' +        @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br />} : ''        end        def url_link          @url_=if @prod['url'] =~/http:/ diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 82183a02..ab37abb2 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -333,7 +333,9 @@ module SiSU_Tune              end              para.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})            end -        else para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') #code-block: angle brackets special characters +        else +          para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters +          para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>')          end          @tuned_file << para        end diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 4880807d..9fe102e7 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -129,23 +129,23 @@ module SiSU              pod_output(pod_name)              break            else -            put=fns.gsub(/(.+)?\._sst$/,'\1.ssm') +            put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')              @opt.fns=fns -            if @req !~/(?:urls|remote_put)$/ -              if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:[_-]?sst|ssm)$/ +            if @req !~/(?:urls|remote)$/ +              if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/                  if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite"  #pre-processing                    SiSU_Assemble::Composite.new(@opt).read -                  @opt.fns=fns.gsub(/\.ssm$/,'._sst') +                  @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')                  end                  SiSU_DAL::Source.new(@opt).read                                         # -m                elsif FileTest.file?(env.source_file_with_path)                  case @opt.fns -                when /\.(?:[_-]?sst|ssm)$/ +                when /\.(?:(?:-|ssm\.)?sst|ssm)$/                    case @req                    when /^dal$/                      if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite"  #pre-processing                        SiSU_Assemble::Composite.new(@opt).read -                      @opt.fns=fns.gsub(/\.ssm$/,'._sst') +                      @opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')                      end                                              SiSU_DAL::Source.new(@opt).read             # -m                    when /^concordance$/;     SiSU_Concordance::Source.new(@opt).read     # -w @@ -168,6 +168,7 @@ module SiSU                    when /^xml$/;             SiSU_XML_SAX::Source.new(@opt).read         # -x                    when /^xml_dom$/;         SiSU_XML_DOM::Source.new(@opt).read         # -X                    when /^xhtml$/;           SiSU_XHTML::Source.new(@opt).read           # -b +                  when /^embedded$/;        SiSU_Embedded::Source.new(@opt).read        # -m (image and other content)                    when /^manifest$/;        SiSU_Manifest::Source.new(@opt).read        # -y                    when /^sitemaps$/;        SiSU_Sitemaps::Source.new(@opt).read        # -Y                    when /^zap$/;             SiSU_Zap::Source.new(@opt).read             # -Z @@ -185,7 +186,7 @@ module SiSU              elsif FileTest.file?(put)                case @req                when /^urls$/;           SiSU_urls::Source.new(@opt).read           # -u -v -V -M -              when /^remote_put$/ +              when /^remote$/                  case @message                  when /scp/;            SiSU_Remote::Put.new(@opt).scp             # -r                  when /rsync/;          SiSU_Remote::Put.new(@opt).rsync           # -R @@ -195,7 +196,7 @@ module SiSU                @n_do=@n_do+1                tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed")                tell.files_processed unless @opt.cmd =~/q/ -            else                       Operations.new(@opt).not_found +            else Operations.new(@opt).not_found              end            end          end @@ -216,22 +217,22 @@ module SiSU      end      def remote_put_base_site_rsync                                   # -CR  p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ -      require "#{SiSU_lib}/remote_put" +      require "#{SiSU_lib}/remote"        SiSU_Remote::Put.new(@opt).rsync_base      end      def remote_put_base_site_rsync_match                             # -CCRZ  p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ -      require "#{SiSU_lib}/remote_put" +      require "#{SiSU_lib}/remote"        SiSU_Remote::Put.new(@opt).rsync_base_sync      end      def remote_put_base_site                                         # -Cr  p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ -      require "#{SiSU_lib}/remote_put" +      require "#{SiSU_lib}/remote"        SiSU_Remote::Put.new(@opt).scp_base      end      def remote_put_base_site_all                                     # -CCr  p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ -      require "#{SiSU_lib}/remote_put" +      require "#{SiSU_lib}/remote"        SiSU_Remote::Put.new(@opt).scp_base_all      end      def cgi                                                          # -F @@ -256,8 +257,6 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }        system("sisu_webrick #{port}&\n")      end -    def semantics -    end      def not_found        puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"      end @@ -393,59 +392,13 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/                end              end              if @get_s.length > 0                                     #% remote markup file .sst -              require 'open-uri' -              require 'pp' -              require "#{SiSU_lib}/composite" -              @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/ -              @rgx_skin=/^0~skin\s+(\S+)/ -              threads=[] -              for requested_page in @get_s -                threads << Thread.new(requested_page) do |url| -                  open(url) do |f| -                    raise "#{url} not found" unless f -                    re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO -                    base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb -                    imagedir= base_uri + '/_sisu/image_local' #check on -                    doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc' -                    #"Got file, and ready to process: #{fnb}.t#{instr}" -                    downloaded_file=File.new("#{fnb}.-sst",'w+') -                    images=SiSU_Assemble::Remote_image.new.image(imagedir) -                    skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir) -                    f.collect.each do |r|                            # work area -                      skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin -                      images << r.scan(@rgx_image).uniq if r =~@rgx_image -                      downloaded_file << r -                    end -                    if skin and skin.length > 0 -                      SiSU_Assemble::Remote_image.new.download_doc_skin(skin) -                    end -                    if images and images.length > 1 -                      images.flatten!.uniq! -                      @msg,@msgs='downloading images:', [ images.join(',') ] -                      @tell.call.warn unless @opt.cmd =~/q/ -                      SiSU_Assemble::Remote_image.new.download_images(images) -                      @msg,@msgs='downloading done',nil -                      @tell.call.warn unless @opt.cmd =~/q/ -                    end -                    downloaded_file.close -                  end -                end -              end +              require "#{SiSU_lib}/remote" +              SiSU_Remote::Get.new(@opt,@get_s).fns                Operations.new.counter              end -            threads.each {|thr| thr.join} if threads #and threads.length > 0              if @get_p.length > 0                                     #% remote sisupod -               require 'net/http' -              for requested_pod in @get_p -                pod_info=Remote_download.new(requested_pod) -                @opt.fns=pod_info.pod.name -                Net::HTTP.start(pod_info.pod.site) do |http| -                  resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}") -                  open(pod_info.pod.name,'wb') do |file| -                    file.write(resp.body) -                   end -                end -              end +              require "#{SiSU_lib}/remote" +              SiSU_Remote::Get.new(@opt,@get_p).sisupod              end            rescue; SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok              @retry_count +=1 @@ -456,7 +409,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          end          if @opt.cmd=~/m/; op('dal','dal')                #% -m dal          end -        @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'._sst') } +        @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }          if @opt.cmd =~/S/            op('sisupod_make','sisupod (zip)')                   #% -S make sisupod            if @opt.fns=~/\.kdi._sst/ @@ -494,7 +447,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/                when /\.(termsheet.rb)$/;            Operations.new(@opt).termsheet                else                                 #print "not processed --> ", fns, "\n"                end -            else                                   Operations.new(@opt).not_found +            else Operations.new(@opt).not_found              end            end            Operations.new.counter @@ -517,13 +470,15 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          end          if @opt.cmd =~/G/; Operations.new(@opt).cgi                  #% -G cgi - used to make dbi intecface          end +        if @opt.cmd=~/m/; op('embedded','Embedded Content')          #% -m embedded content +        end          if @opt.cmd =~/y/; op('manifest','Manifest')                 #% -y manifest          end          if @opt.cmd =~/Y/; op('sitemaps','Sitemap')                  #% -Y sitemap          end -        if @opt.cmd =~/r/; op('remote_put','scp')                    #% -r copy to remote server +        if @opt.cmd =~/r/; op('remote','scp')                    #% -r copy to remote server          end -        if @opt.cmd =~/R/; op('remote_put','rsync')                  #% -R copy to remote server +        if @opt.cmd =~/R/; op('remote','rsync')                  #% -R copy to remote server          end          if @opt.cmd =~/[QuUvVM]/; op('urls','urls')                  #% -Q -u -v -V -M urls          end @@ -547,7 +502,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/          require "#{SiSU_lib}/sitemaps"          SiSU_Sitemaps::Source.new(@opt).read          if @opt.cmd =~/R/ -          require "#{SiSU_lib}/remote_put" +          require "#{SiSU_lib}/remote"            SiSU_Remote::Put.new(@opt).rsync_sitemaps          end        else                                                           #% help instructions @@ -562,14 +517,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        @opt.files.each do |fns|          if FileTest.file?(fns)            @opt.fns=fns -          unless @opt.fns =~ /(?:\.(?:[_-]?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/ +          unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/              if @opt.fns=~/\.kdi$/ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/              elsif @opt.fns=~/\.sx[sdn]\.xml$/ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/              elsif @opt.fns=~/\.ssi$/ and @opt.mod.inspect =~/--identify/              else Operations.new(@opt).not_recognised              end            end -          if @opt.fns =~/\._sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files +          if @opt.fns =~/\.ssm\.sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files              @msg,@msgs='temporary file removed',nil              @tell.call.warn unless @opt.cmd =~/V/              File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index da123216..0776f4d1 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -93,7 +93,9 @@ module SiSU_Manifest          @fnb=@md.fnb          out=@env.path.output          @base_url="#{@env.url.root}/#@fnb" +        @base_url_src="#{@env.url.root}/src"          @base_path="#{out}/#@fnb" +        @base_path_src="#{out}/src"          @@dg ||=SiSU_Env::Info_env.new.digest.type          @dg=@@dg          l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) @@ -116,15 +118,15 @@ module SiSU_Manifest        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}") +        dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_src}/#{file}") +        else                             sys.md5("#{@base_path_src}/#{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 +        size=(File.size("#{@base_path_src}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{file}">#{file}</a>   #{dgst[1]}<br />#{@url_brace.xml_open}<a href="#@base_url/#{file}">#@base_url/#{file}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">#{kb}</p> +        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="../src/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="../src/#{file}">#{file}</a>   #{dgst[1]}<br />#{@url_brace.xml_open}<a href="#@base_url_src/#{file}">#@base_url_src/#{file}</a>#{@url_brace.xml_close}</p></td><td class="right"><p class="right">#{kb}</p>          </td></tr>\n} if kb and kb =~/\d+/        end        def languages(id,file) @@ -232,19 +234,19 @@ module SiSU_Manifest          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 +        if @md.fns =~/\.ssm\.sst$/                                                  #% decide whether to extract and include requested/required documents +          req=@md.fns +          if FileTest.file?("#@base_path_src/#{req}")==true              id,file='Markup Composite File (SiSU source)',req              summarize_source(id,file)            end          end -        if FileTest.file?("#@base_path/#{@md.fns}")==true +        if FileTest.file?("#@base_path_src/#{@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' +        if FileTest.file?("#@base_path_src/#{@md.fn[:sisupod]}")==true +          id,file='SiSU doc (zip)',@md.fn[:sisupod]            summarize_source(id,file)          end          if FileTest.file?("#@base_path/#{@md.fnb}")==true and @md.fnb =~/\.kdi$/ diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 10480b90..397b94d8 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -70,7 +70,7 @@ module SiSU_manpage    class Source      def initialize(opt)        @opt=opt -      if @opt.fns =~/(.+?)\.[_-]?sst$/ +      if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/          @@dostype='unix endnotes'        else puts "#{sf} not a processed file type"        end @@ -339,7 +339,9 @@ WOK            para.gsub!(/~/,'~') if para #manpages use this            if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/              if para =~/<:code>/ #code-block: angle brackets special characters -              para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') +              para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< +              para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< +              #para.gsub!(/(?![}])_([<>])/m,'\1') # _> _<                        }_<              end              para.gsub!(/<br(?: \/)?>/,"\n\n.P\n\n")                                   # watch              para.gsub!(/<:(?:group|verse|alt)(?:\\-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 171372a9..feea7cde 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -224,7 +224,7 @@ module SiSU_ODF          %{#{breakpage}<text:h text:style-name="Heading_20_#{no}" text:outline-level="#{no}">#{para}</text:h>}        end        def image_src(i) -        image_source=if @md.fns =~/\._?ss[tm]$/ and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") +        image_source=if @md.fns =~/\.ss[tm]$/ and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review            @env.path.image_source_local_tex          elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}")            @env.path.image_source_remote_tex @@ -474,10 +474,9 @@ module SiSU_ODF              para=para.strip            end            if para =~/<:code>/ #code-block: angle brackets special characters -            para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') +            para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') +            para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>')            end -          ##para.gsub!(/_</m,'<'); para.gsub!(/([^_])_>/m,'\1>') #code-block: angle brackets special characters -          #para.gsub!(/_</m,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters            para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png            #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<text:span text:style-name="T6">●</text:span> ')     #bullet            #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used diff --git a/lib/sisu/v0/options.rb b/lib/sisu/v0/options.rb index 8b014c04..a4cdc5e4 100644 --- a/lib/sisu/v0/options.rb +++ b/lib/sisu/v0/options.rb @@ -58,9 +58,9 @@  module SiSU_commandline    require "#{SiSU_lib}/sysenv"    class Options -    attr_accessor :cmd,:mod,:files,:fns,:fnb,:what +    attr_accessor :cmd,:mod,:files,:fns,:fnb,:fnc,:fncb,:what      def initialize(a) -      @cmd,@files,@fns,@fnb,@what,c,w,s='','','','','','','','','' +      @cmd,@files,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','',''        @files,@mod,m,f,z,ca=[],[],[],[],[],[]        @env=SiSU_Env::Info_env.new        shortcut=SiSU_Env::Info_processing_flag.new @@ -102,7 +102,7 @@ module SiSU_commandline            end            if x =~/^--\S+/;        m << x            end -        elsif x =~ /(?:\.(?:[_-]?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|sisupod(?:\.zip)?)$/ +        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|sisupod(?:\.zip)?)$/            if x =~/^(?:https?|file):\/\/\S+/;  f << x            elsif FileTest.file?(x); f << x            else  puts "file not found: #{x}" @@ -162,7 +162,17 @@ module SiSU_commandline      end      def fnb        unless fns.empty? -        fns[/(.+?)\.(?:[_-]?sst|ssm)$/,1] +        fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1] +      end +    end +    def fnc +      @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst' +      else @fns +      end +    end +    def fncb +      @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; fnb + '.ssm.sst' +      else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')        end      end    end diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 90aad6aa..fec253d0 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -78,7 +78,7 @@ module SiSU_Param        @opt=opt        @cX||=SiSU_Screen::Ansi.new(opt.cmd)        @cmd,@mod=opt.cmd,opt.mod -      @fns=opt.fns.gsub(/\.ssm$/,'._sst') #revisit CHECK +      @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK        Instantiate.new.param_instantiate        @env=SiSU_Env::Info_env.new(@fns)        @pstorefile="#{@env.path.dal}/#@fns.pstore" @@ -115,9 +115,9 @@ module SiSU_Param        @doc={ :lv=>[] }        @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''        @@publisher='SiSU scribe' -      attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis +      attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec        def initialize(fns_array,opt) -        @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil +        @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil          @man_section=1          @man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'          @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data @@ -125,8 +125,11 @@ module SiSU_Param          @seg_autoname_safe=true          @markup_instruction,@markup_declared,@image='','','' #check which other values should be set to empty rather than nil          @markup=@markup_instruction #use @markup_instruction -        @flv,@lang,@seg_names,@tags,@tag_array,@tag_a=Array.new(6){[]} -        @doc,@fn,@make_italic,@make_bold,@tag_hash={},{},{},{},{},{} +        @doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{} +        @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]} +        @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/ +        @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ +        @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg          begin          rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error          ensure @@ -169,19 +172,25 @@ module SiSU_Param          # programs set here for things that affect output appearance only          @programs[:pdf]=SiSU_Env::System_call.new.program_found?('pdflatex')          if @env.i18n.multilingual -          m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst)$/ #watch added match for sss +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst)$/ #watch added match for sss            @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]            @flv=@env.document_language_versions_found[:f] -        else m=/(.+?)\.([_-]?sst)$/ +          @fnz=if @fns =~/\.(?:ssm\.sst|ssm)$/; @fnn + '.ssm.zip' +          else @fnn + '.sst.zip' +          end +        else m=/(.+?)\.((?:-|ssm\.)?sst)$/            @fnb=@fnn=@fns[m,1]            @fnt=@fns[m,2]            @flv<<@fns +          @fnz=if @fns =~/\.(?:_sst|ssm)$/; @fnb + '.ssm.zip' +          else @@fnb + '.sst.zip' +          end          end          @papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general          @sfx_src=@fns[m,2]          @sfx=nil          @flag_auto_heading_num=false -        if @fns =~ /[_-]?sst$/ #watch +        if @fns =~ /(?:-|ssm\.)?sst$/ #watch            @env_out_root=@env.path.output            @dir_out="#{@env.path.output}/#@fnb"            @dir_tex=@env.path.tex @@ -209,7 +218,7 @@ module SiSU_Param              sv=if @cmd =~/[VMv]/; "SiSU version (#{@sisu_version[:version]})"              else ''              end -            s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] +            s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3]              tell=if @markup_version_declared.to_f == @markup_version.to_f                SiSU_Screen::Ansi.new(@cmd,"Markup version (#@markup_version)",sv)              else @@ -591,7 +600,13 @@ module SiSU_Param                @seg_autoname_safe=false if m=~/^\d{1,3}/ and m !~/^0/              end            end +          @ec[:image] << para.scan(@rgx_image).uniq if para =~@rgx_image #embedded content +          @ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content +          @ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content          end #% here endeth the document loop +        @ec[:image].uniq!; @ec[:image].flatten!; @ec[:image].sort! +        @ec[:audio].uniq!; @ec[:audio].flatten!; @ec[:audio].sort! +        @ec[:multimedia].uniq!; @ec[:multimedia].flatten!; @ec[:multimedia].sort!          @man_name.gsub!(/(-)/,"\\\\\\1")          @man_name.gsub!(/\n/,"\n.BR\n")          @man_name.gsub!(/\A/,"\n.SH NAME\n") diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 361624e1..86a17089 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -70,7 +70,7 @@ module SiSU_Plaintext    class Source      def initialize(opt)        @opt=opt -       @@dostype=if @opt.fns =~/(.+?)\.[_-]?sst$/ +       @@dostype=if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/          if @opt.mod.inspect =~ /--footnote/ and @opt.mod.inspect =~ /--dos/;   'msdos footnotes'          elsif @opt.mod.inspect =~ /--endnote/ and @opt.mod.inspect =~ /--dos/; 'msdos endnotes'          elsif @opt.mod.inspect =~ /--footnote/;                                'unix footnotes' @@ -336,7 +336,8 @@ WOK            end            if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/              if para =~/<:code>/ #code-block: angle brackets special characters -              para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') +              para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< +              para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<              end              para.gsub!(/<br(?: \/)?>/,"\n")                                   # watch              para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') diff --git a/lib/sisu/v0/remote_put.rb b/lib/sisu/v0/remote.rb index 2e7975a3..2a45e3cb 100644 --- a/lib/sisu/v0/remote_put.rb +++ b/lib/sisu/v0/remote.rb @@ -51,10 +51,7 @@     <ralph@amissah.com>     <ralph.amissah@gmail.com> - ** Description: remote put, copy output to remote server -   ** Note: this operation should probably be threaded & run at its own pace, -      independent of rest of program primary problem will be with notification -      of progress, implement naively to start with + ** Description: remote operations, get source from or copy output to remote server  =end  module SiSU_Remote @@ -65,8 +62,8 @@ module SiSU_Remote      def initialize(opt)        @opt=opt        @dir=SiSU_Env::Info_env.new(@opt.fns) -      @put=unless @opt.fns =~/\._sst$/; @opt.fns -      else @opt.fns.gsub(/(.+)?\._sst$/,'\1.ssm') +      @put=unless @opt.fns =~/\.ssm\.sst$/; @opt.fns +      else @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')        end        @remote=SiSU_Env::Info_remote.new(@opt)      end @@ -106,5 +103,68 @@ module SiSU_Remote        @remote.rsync_sitemaps      end    end +  class Get +    def initialize(opt,get_s) +      @opt,@get_s=opt,get_s +      @msg,@msgs='',nil +      @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } +    end +    def fns +      require 'open-uri' +      require 'pp' +      require "#{SiSU_lib}/composite" +      @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/ +      @rgx_skin=/(?:0~|@)skin:?\s+(\S+)/ #@rgx_skin=/^0~skin\s+(\S+)/ +      threads=[] +      for requested_page in @get_s +        threads << Thread.new(requested_page) do |url| +          open(url) do |f| +            raise "#{url} not found" unless f +            re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO +            base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb +            imagedir= base_uri + '/_sisu/image' #check on +            doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc' +            #"Got file, and ready to process: #{fnb}.t#{instr}" +            downloaded_file=File.new("#{fnb}.-sst",'w+') +            images=SiSU_Assemble::Remote_image.new.image(imagedir) +            skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir) +            f.collect.each do |r|                            # work area +              skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin +              images << r.scan(@rgx_image).uniq if r =~@rgx_image +              downloaded_file << r +            end +            if skin and skin.length > 0 +              SiSU_Assemble::Remote_image.new.download_doc_skin(skin) +            end +            if images and images.length > 1 +              images.flatten!.uniq! +              @msg,@msgs='downloading images:', [ images.join(',') ] +              @tell.call.warn unless @opt.cmd =~/q/ +              SiSU_Assemble::Remote_image.new.download_images(images) +              @msg,@msgs='downloading done',nil +              @tell.call.warn unless @opt.cmd =~/q/ +            end +            downloaded_file.close +          end +        end +      end +      threads.each {|thr| thr.join} if threads #and threads.length > 0 +    end +    def sisupod +      if @get_p.length > 0                                     #% remote sisupod +         require 'net/http' +        for requested_pod in @get_p +          pod_info=Remote_download.new(requested_pod) +          @opt.fns=pod_info.pod.name +          Net::HTTP.start(pod_info.pod.site) do |http| +            resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}") +            open(pod_info.pod.name,'wb') do |file| +              file.write(resp.body) +             end +          end +        end +      end +    end +  end  end  __END__ diff --git a/lib/sisu/v0/screen_text_color.rb b/lib/sisu/v0/screen_text_color.rb index 79656e07..a3f1cc7f 100644 --- a/lib/sisu/v0/screen_text_color.rb +++ b/lib/sisu/v0/screen_text_color.rb @@ -198,7 +198,7 @@ module SiSU_Screen        @sourcefilename=sourcefilename      end      def basename(sourcefilename) -      @basename=sourcefilename.sub(/\.(?:[_-]?sst|ssm)$/,'') +      @basename=sourcefilename.sub(/\.(?:(?:-|ssm\.)?sst|ssm)$/,'')      end      def sisu      end diff --git a/lib/sisu/v0/semantics.rb b/lib/sisu/v0/semantics.rb deleted file mode 100644 index 177a5d98..00000000 --- a/lib/sisu/v0/semantics.rb +++ /dev/null @@ -1,396 +0,0 @@ -=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 Ralph Amissah All Rights Reserved. - - * License: GPL 3 or later: - -   SiSU, a framework for document structuring, publishing and search - -   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -   2007 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 <http://www.gnu.org/licenses/>. - -   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/gpl.fsf> - - * SiSU uses: -   * Standard SiSU markup syntax, -   * Standard SiSU meta-markup syntax, and the -   * Standard SiSU object citation numbering and system - - * Hompages: -   <http://www.jus.uio.no/sisu> -   <http://www.sisudoc.org> - - * Download: -   <http://www.jus.uio.no/sisu/SiSU/download.html> - - * Ralph Amissah -   <ralph@amissah.com> -   <ralph.amissah@gmail.com> - - ** Description: semantics - -=end -module Semantic -  require "#{SiSU_lib}/param" -  class YamlInfoCreate -    def initialize(file='') -      @file=file -      @sisu=[] -      @@doc[:title],@@doc[:subtitle],@@doc[:creator],@@doc[:subject],@@doc[:keywords],@@doc[:description],@@doc[:publisher],@@doc[:contributor],@@doc[:date],@@doc[:date_created],@@doc[:date_issued],@@doc[:date_available],@@doc[:date_valid],@@doc[:date_modified],@@doc[:type],@@doc[:format],@@doc[:identifier],@@doc[:source],@@doc[:language],@@doc[:coverage],@@doc[:relation],@@doc[:rights]=nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil -    end -    def songsheet -      param -      yamlinfo -    end -    def param -      file_array=IO.readlines(@file,'') -      SiSU_Param(file_array,@file,'a') #problem not updated watch -    end -    def printscreen -      puts "#{@@cX.fuschia}filename:#{@@cX.off}       " + @file -      puts "#{@@cX.fuschia}title:#{@@cX.off}          " + @@doc[:title] -      puts "#{@@cX.fuschia}subtitle:#{@@cX.off}       " + @@doc[:subtitle] if @@doc[:subtitle] -      puts "#{@@cX.fuschia}creator:#{@@cX.off}        " + @@doc[:creator] if @@doc[:creator] -      puts "#{@@cX.fuschia}subject:#{@@cX.off}        " + @@doc[:subject] if @@doc[:subject] -      puts "#{@@cX.fuschia}description:#{@@cX.off}    " + @@doc[:description] if @@doc[:description] -      puts "#{@@cX.fuschia}publisher:#{@@cX.off}      " + @@doc[:publisher] if @@doc[:publisher] -      puts "#{@@cX.fuschia}contributor:#{@@cX.off}    " + @@doc[:contributor] if @@doc[:contributor] -      puts "#{@@cX.fuschia}date:#{@@cX.off}           " + @@doc[:date] if @@doc[:date] -      puts "#{@@cX.fuschia}date created:#{@@cX.off}   " + @@doc[:date_created] if @@doc[:date_created] -      puts "#{@@cX.fuschia}date issued:#{@@cX.off}    " + @@doc[:date_issued] if @@doc[:date_issued] -      puts "#{@@cX.fuschia}date available:#{@@cX.off} " + @@doc[:date_available] if @@doc[:date_available] -      puts "#{@@cX.fuschia}date valid:#{@@cX.off}     " + @@doc[:date_valid] if @@doc[:date_valid] -      puts "#{@@cX.fuschia}date modified:#{@@cX.off}  " + @@doc[:date_modified] if @@doc[:date_modified] -      puts "#{@@cX.fuschia}type:#{@@cX.off}           " + @@doc[:type] if @@doc[:type] -      puts "#{@@cX.fuschia}format:#{@@cX.off}         " + @@doc[:format] if @@doc[:format] -      puts "#{@@cX.fuschia}identifier:#{@@cX.off}     " + @@doc[:identifier] if @@doc[:identifier] -      puts "#{@@cX.fuschia}source:#{@@cX.off}         " + @@doc[:source] if @@doc[:source] -      puts "#{@@cX.fuschia}language:#{@@cX.off}       " + @@doc[:language] if @@doc[:language] -      puts "#{@@cX.fuschia}coverage:#{@@cX.off}       " + @@doc[:coverage] if @@doc[:coverage] -      puts "#{@@cX.fuschia}relation:#{@@cX.off}       " + @@doc[:relation] if @@doc[:relation] -      puts "#{@@cX.fuschia}rights:#{@@cX.off}         " + @@doc[:rights] if @@doc[:rights] -      puts "#{@@cX.fuschia}keywords:#{@@cX.off}       " + @@doc[:keywords] if @@doc[:keywords] -      puts '-----------------------' -    end -    def yamlinfo -      uri=case @file -      when /.+?\.[_-]?sst$/; @file.gsub(/(.+?)\.[_-]?sst$/,'http://localhost/reserved/\1/') -      end -      puts uri -      @sisu << '-' -      @sisu << '  filename:       ' + uri -      @sisu << '  title:          ' + @@doc[:title].gsub(/:/, ' - ') if @@doc[:title] -      @sisu << '  subtitle:       ' + @@doc[:subtitle] if @@doc[:subtitle] -      @sisu << '  creator:        ' + @@doc[:creator] if @@doc[:creator] -      @sisu << '  subject:        ' + @@doc[:subject] if @@doc[:subject] -      @sisu << '  keywords:       ' + @@doc[:keywords] if @@doc[:keywords] -      @sisu << '  description:    ' + @@doc[:description] if @@doc[:description] -      @sisu << '  publisher:      ' + @@doc[:publisher] if @@doc[:publisher] -      @sisu << '  contributor:    ' + @@doc[:contributor] if @@doc[:contributor] -      @sisu << '  date:           ' + @@doc[:date] if @@doc[:date] -      @sisu << '  date_created:   ' + @@doc[:date_created] if @@doc[:date_created] -      @sisu << '  date_issued:    ' + @@doc[:date_issued] if @@doc[:date_issued] -      @sisu << '  date_available: ' + @@doc[:dateavailable] if @@doc[:date_available] -      @sisu << '  date_valid:     ' + @@doc[:date_valid] if @@doc[:date_valid] -      @sisu << '  date_modified:  ' + @@doc[:date_modified] if @@doc[:date_modified] -      @sisu << '  type:           ' + @@doc[:type] if @@doc[:type] -      @sisu << '  format:         ' + @@doc[:format] if @@doc[:format] -      @sisu << '  identifier:     ' + @@doc[:identifier] if @@doc[:identifier] -      @sisu << '  source:         ' + @@doc[:source] if @@doc[:source] -      @sisu << '  language:       ' + @@doc[:language] if @@doc[:language] -      @sisu << '  coverage:       ' + @@doc[:coverage] if @@doc[:coverage] -      @sisu << '  relation:       ' + @@doc[:relation] if @@doc[:relation] -      @sisu << '  rights:         ' + @@doc[:rights] if @@doc[:rights] -      #@sisu << '  copyright:      ' + @@doc[:copyright] if @@doc[:copyright] -      @sisu.each {|para| @@filename_semantic.puts para} -    end -  end -  class Yaml_info_read -    def initialize #(file='') -      @pwd=Dir.pwd -      @sisu=[] -    end -    def loadfile -      if FileTest.file?("#@pwd/semantic.yml") -        @yaml||=YAML::load(File::open("#@pwd/semantic.yml")) -      end -    end -    def printscreen -      @yaml.each do |y| -        puts y['title'] if y['title'] -        puts y['subtitle'] if y['subtitle'] -        puts y['creator'] if y['creator'] -        puts y['subject'] if y['subject'] -        puts y['description'] if y['description'] -        puts y['publisher'] if y['publisher'] -        puts y['contributor'] if y['contributor'] -        puts y['date'] if y['date'] -        puts y['date_created'] if y['date_created'] -        puts y['date_issued'] if y['date_issued'] -        puts y['date_available'] if y['date_available'] -        puts y['date_valid'] if y['date_valid'] -        puts y['date_modified'] if y['date_modified'] -        puts y['type'] if y['type'] -        puts y['format'] if y['format'] -        puts y['identifier'] if y['identifier'] -        puts y['source'] if y['source'] -        puts y['language'] if y['language'] -        puts y['coverage'] if y['coverage'] -        puts y['relation'] if y['relation'] -        puts y['rights'] if y['rights'] -        puts y['copyright'] if y['copyright'] -        puts y['keywords'] if y['keywords'] -        puts '-----' -      end -    end -  end -  class RSS < Yaml_info_read -    def songsheet -      loadfile -      rss_nav -      debris -    end -    def rss(match=//,feedtitle='') -      @sisu=[] -      @sisu <<  %{<rss version="2.0">\n-\n  <channel><title>#{feedtitle}</title> -<link>http://www.jus.uio.no/lm/</link> -<description>Semantic Information Structuring Unit</description> -<language>en-us</language> -- -} -      @yaml.each do |y| -        if y['title'] and ((y['subject'] and "#{y['subject']}"[match]) or (y['keywords'] and "#{y['keywords']}"[match])) -          puts y['subject'] -          @sisu <<  %{- -  <item> -  <title>#{y['title']}</title> -  - -    <guid> -  #{y['filename']} -  </guid> -  - -  } -          @sisu << %{<description>} -          @sisu << %{<h1 id="#{y['title'].gsub(/\s+/, '-')}">#{y['title']}</h1>} -          @sisu << %{#{y['title']} } if y['title'] -          @sisu << %{#{y['subtitle']} } if y['subtitle'] -          @sisu << %{#{y['creator'] }} if y['creator'] -          #@sisu << %{#{y['subject']}} if y['subject'] -          @sisu << %{#{y['description'] }} if y['description'] -          #@sisu << %{#{y['publisher']}} if y['publisher'] -          #@sisu << %{#{y['contributor']}} if y['contributor'] -          @sisu << %{#{y['date']} } if y['date'] -          #@sisu << %{#{y['date_created']}} if y['date_created'] -          #@sisu << %{#{y['date_issued']}} if y['date_issued'] -          #@sisu << %{#{y['date_available']}} if y['date_available'] -          #@sisu << %{#{y['date_valid']}} if y['date_valid'] -          #@sisu << %{#{y['date_modified']}} if y['date_modified'] -          #@sisu << %{#{y['type']}} if y['type'] -          #@sisu << %{#{y['format']}} if y['format'] -          #@sisu << %{#{y['identifier']}} if y['identifier'] -          #@sisu << %{#{y['source']}} if y['source'] -          #@sisu << %{#{y['language']}} if y['language'] -          #@sisu << %{#{y['coverage']}} if y['coverage'] -          #@sisu << %{#{y['relation']}} if y['relation'] -          #@sisu << %{#{y['rights']}} if y['rights'] -          #@sisu << %{#{y['copyright']}} if y['copyright'] -          #@sisu << %{#{y['keyword']}} if y['keyword'] -          @sisu << %{</description>} -          @sisu << %{</item>} -        end -      end -      @sisu <<  %{</channel>\n</rss>} -      #@sisu.each {|para| @@rss.puts para} #KEEP does all -      if "united nations"[match] -        @sisu.each {|para| @@rss_un.puts para} -        @sisu=[] -      end -      if "unidroit"[match] -        @sisu.each {|para| @@rss_unidroit.puts para} -        @sisu=[] -      end -      if "hcpil"[match] -        @sisu.each {|para| @@rss_hcpil.puts para} -        @sisu=[] -      end -      if "contract"[match] -        @sisu.each {|para| @@rss_contracts.puts para} -        @sisu=[] -      end -      if "navigate"[match] -        @sisu.each {|para| @@rss_nav.puts para} -        @sisu=[] -      end -    end -    def rss_un -      match=/united\s+nations|uncitral/i -      rss(match, 'Lex Mercatoria Pages on the United Nations') -    end -    def rss_unidroit -      match=/unidroit/i -      rss(match, 'Lex Mercatoria pages on UNIDROIT') -    end -    def rss_hcpil -      match=/hague\s+conference|hcpil/i -      rss(match, 'Lex Mercatoria pages on the Hague Conference on Private International Law') -    end -    def rss_contracts -      match=/contracts?/i -      rss(match, 'Lex Mercatoria Contract Law pages') -    end -    def rss_nav -      match=/navigate(\s|$)/i -      rss(match, 'Lex Mercatoria Navigation pages') -    end -    def dummy -      @sisu <<  %{<doc>} -      @yaml.each do |y| -        @sisu <<  %{<content>} -        @sisu <<  %{#{y['title']}} if y['title'] -        @sisu <<  %{#{y['subtitle']}} if y['subtitle'] -        @sisu <<  %{#{y['creator']}} if y['creator'] -        @sisu <<  %{#{y['subject']}} if y['subject'] -        @sisu <<  %{#{y['description']}} if y['description'] -        @sisu <<  %{#{y['publisher']}} if y['publisher'] -        @sisu <<  %{#{y['contributor']}} if y['contributor'] -        @sisu <<  %{#{y['date']}} if y['date'] -        @sisu <<  %{#{y['date_created']}} if y['date_created'] -        @sisu <<  %{#{y['date_issued']}} if y['date_issued'] -        @sisu <<  %{#{y['date_available']}} if y['date_available'] -        @sisu <<  %{#{y['date_valid']}} if y['date_valid'] -        @sisu <<  %{#{y['date_modified']}} if y['date_modified'] -        @sisu <<  %{#{y['type']}} if y['type'] -        @sisu <<  %{#{y['format']}} if y['format'] -        @sisu <<  %{#{y['identifier']}} if y['identifier'] -        @sisu <<  %{#{y['source']}} if y['source'] -        @sisu <<  %{#{y['language']}} if y['language'] -        @sisu <<  %{#{y['coverage']}} if y['coverage'] -        @sisu <<  %{#{y['relation']}} if y['relation'] -        @sisu <<  %{#{y['rights']}} if y['rights'] -        @sisu <<  %{#{y['copyright']}} if y['copyright'] -        @sisu <<  %{#{y['keyword']}} if y['keyword'] -        @sisu <<  %{</content>} -      end -      @sisu <<  %{</doc>} -      @sisu.each {|para| @@rss.puts para} -    end -    def debris -      outputdir=SiSU_Env::Info_env.new.path.feed -      x=Dir.new(outputdir).entries -      x.each do |y| -        #unless FileTest.file?("#{outputdir}/#{y}") and File.size?("#{outputdir}/#{y}") == 0 -        if File.size("#{outputdir}/#{y}") == 0 -          #File.unlink("#{outputdir}/#{y}") -          puts "#{outputdir}/#{y}" -          puts File.size("#{outputdir}/#{y}") -        end -      end -    end -  end -  class RDF < Yaml_info_read -    def songsheet -      loadfile -      rdf -      rdf_un -      rdf_unidroit -      rdf_hcpil -      rdf_contracts -      rdf_nav -      debris -    end -    def rdf -    end -    def rdf_un -    end -    def rdf_unidroit -    end -    def rdf_hcpil -    end -    def rdf_contracts -    end -    def rdf_nav -    end -    def debris -    end -  end -end -                                                                                 #% start -require "#{SiSU_lib}/param" -require "#{SiSU_lib}/defaults" -require "#{SiSU_lib}/sysenv" -include SiSU_Param -include SiSU_Env -include SiSU_Viz -outputdir=SiSU_Env::Info_env.new.path.feed -pwd=Dir.pwd -@argv=[] -argv=$* -#p argv -my_make=SiSU_Env::Create_file.new('','') -if argv.to_s =~/yaml/ -  my_make.file_semantic -  files=Dir["*.sst,*._sst,*-sst"] -  end -  files.each {|f| @argv << f[/(.+?)\.[_-]?sst$/,1] if f =~/.+?\.[_-]?sst$/} -  ######### -  files.each do |filename| -    Semantic::YamlInfoCreate.new(filename).songsheet -  end -elsif argv.to_s =~/rss/ -  #rss=%{#{outputdir}/semantic.xml} -  #@@rss=File.new(rss, "w+") -  rss_nav=%{#{outputdir}/navigate.xml} -  @@rss_nav=File.new(rss_nav, "w+") -  # -  #rss_un=%{#{outputdir}/un.xml} -  #@@rss_un=File.new(rss_un, "w+") -  #rss_unidroit=%{#{outputdir}/unidroit.xml} -  #@@rss_unidroit=File.new(rss_unidroit, "w+") -  #rss_hcpil=%{#{outputdir}/hcpil.xml} -  #@@rss_hcpil=File.new(rss_hcpil, "w+") -  #rss_contracts=%{#{outputdir}/contracts.xml} -  #@@rss_contracts=File.new(rss_contracts, "w+") -  ##my_make.file_rss -  Semantic::RSS.new.songsheet -elsif argv.to_s =~/rdf/ -  #rdf=%{#{outputdir}/semantic.rdf} -  #@@rdf=File.new(rdf, "w+") -  #rdf_un=%{#{outputdir}/un.rdf} -  #@@rdf_un=File.new(rdf_un, "w+") -  #rdf_unidroit=%{#{outputdir}/unidroit.rdf} -  #@@rdf_unidroit=File.new(rdf_unidroit, "w+") -  #rdf_hcpil=%{#{outputdir}/hcpil.rdf} -  #@@rdf_hcpil=File.new(rdf_hcpil, "w+") -  #rdf_contracts=%{#{outputdir}/contracts.rdf} -  #@@rdf_contracts=File.new(rdf_contracts, "w+") -  #rdf_nav=%{#{outputdir}/navigate.rdf} -  #@@rdf_nav=File.new(rdf_nav, "w+") -  ##my_make.file_rdf -  #Semantic::RDF.new.songsheet -end -__END__ - diff --git a/lib/sisu/v0/share_src.rb b/lib/sisu/v0/share_src.rb index 53e19f1c..c098f282 100644 --- a/lib/sisu/v0/share_src.rb +++ b/lib/sisu/v0/share_src.rb @@ -65,20 +65,21 @@ module SiSU_Markup        @opt=opt        @env=SiSU_Env::Info_env.new(@opt.fns)        stub=@opt.fnb.gsub(/~[a-z]+$/,'') -      @output_path="#{@env.path.output}/#{stub}" +      @output_path="#{@env.path.output}/src" +      #@output_path="#{@env.path.output}/#{stub}"      end      def read        tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns)        tell.green_hi_blue unless @opt.cmd =~/q/        tell=SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #@output_path")        tell.warn unless @opt.cmd =~/q/ -      File.mkpath(@env.path.output) unless FileTest.directory?(@env.path.output) +      File.mkpath("#{@env.path.output}/src") unless FileTest.directory?("#{@env.path.output}/src")        File.mkpath(@output_path) unless FileTest.directory?(@output_path)        if FileTest.directory?(@output_path)          unless @opt.fns =~/\.ssm$/; cp(@opt.fns,@output_path)          else -          req=@opt.fns.gsub(/(.+)?\.ssm$/,'\1.composite.sst') -          file="#{@env.path.composite_file}/#{@opt.fnb}._sst" +          req=@opt.fns.gsub(/(.+?\.ssm)$/,'\1.sst') +          file="#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"            if FileTest.file?(file);  cp(file,"#@output_path/#{req}")            else print "did not find #{file} to copy"            end diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index d63f4cef..730bf00d 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -133,7 +133,9 @@ module SiSU_Format_Shared          para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration          para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url          para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration -      else para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') #code-block: angle brackets special characters +      else +        para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters +        para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>')        end        para      end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 62e8b5ca..7f9cdc83 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -365,7 +365,8 @@ module SiSU_XML_munge          para.gsub!(/ /,' ')          #para.gsub!(/ /,' ') #clean        else -        para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>') #code-block: angle brackets special characters +        para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters +        para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>')          para.gsub!(/ /,' ')        end        para diff --git a/lib/sisu/v0/sisupod_make.rb b/lib/sisu/v0/sisupod_make.rb index 8e6932f0..392aee7d 100644 --- a/lib/sisu/v0/sisupod_make.rb +++ b/lib/sisu/v0/sisupod_make.rb @@ -72,6 +72,10 @@ module SiSU_Doc        @v=if @opt.cmd =~/[VM]/; 'v'        else                    ''        end +      @local_path="#{@env.path.output}/src" #@local_path="#{@env.path.output}/#{@env.fnb}" +      @zipfile=if @opt.fns =~/\.ssm\.sst$/; @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm') +      else @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') +      end        File.mkpath(pod_path) unless FileTest.directory?(pod_path)        rm_rf("#{@env.path.processing}sisupod/*") if FileTest.directory?("#{@env.path.processing}sisupod")      end @@ -79,7 +83,7 @@ module SiSU_Doc        tell=SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns)        tell.green_hi_blue unless @opt.cmd =~/q/        unless @opt.fns.empty? -        tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns}.zip -> #{@env.path.output}/#{@opt.fnb}/sisupod.zip") +        tell=SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@env.path.output}/src/#{@zipfile}.zip")          tell.warn unless @opt.cmd =~/q/          directories          sisupod_build @@ -157,7 +161,7 @@ module SiSU_Doc        @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/        @rgx_skin=/^(?:@skin:|0~skin)\s+(\S+)/        @rgx_doc_import=/^%\s\s*\|(\S+?\.ss[ti])\|@\|\^\|>>ok/ -      use_file=if @opt.fns =~/(?:\.ssm|\._sst)$/; "#{@env.path.composite_file}/#{@opt.fnb}._sst" +      use_file=if @opt.fns =~/(?:\.ssm|\.ssm\.sst)$/; "#{@env.path.composite_file}/#{@opt.fnb}.ssm.sst"        else @opt.fns        end        file_array=IO.readlines(use_file,'') @@ -166,7 +170,7 @@ module SiSU_Doc          if f !~/^%\s/            skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin            images << f.scan(@rgx_image).uniq if f =~@rgx_image -        elsif f =~/^%\s/ and @opt.fns =~/\._sst$/ +        elsif f =~/^%\s/ and @opt.fns =~/\.ssm\.sst$/            doc_import << f.scan(@rgx_doc_import).uniq if f =~@rgx_doc_import          end        end @@ -224,7 +228,7 @@ module SiSU_Doc          end        end        x=@env.document_language_versions_found   #check multiple document language versions (param not used) -      if doc_import.flatten.length > 0 and @opt.fns =~/\._sst$/ +      if doc_import.flatten.length > 0 and @opt.fns =~/\.ssm\.sst$/          doc_import.flatten.each do |f|            cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")          end @@ -233,42 +237,38 @@ module SiSU_Doc          x[:f].each do |f|            cp_r("#{@env.path.pwd}/#{f}","#{@env.path.processing}/sisupod/#{f}")          end -      elsif @opt.fns =~/\._sst/ -        ssm=@opt.fns.gsub(/\._sst/,'.ssm') +      elsif @opt.fns =~/\.ssm\.sst/ +        ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm')          cp_r("#{@env.path.pwd}/#{ssm}","#{@env.path.processing}/sisupod/#{ssm}")        else cp_r("#{@env.path.pwd}/#{@opt.fns}","#{@env.path.processing}/sisupod/#{@opt.fns}")        end #NB not all possibilies met, revisit, also in case of composite file may wish to add README      end      def sisupod_7zip #look at later -      dir=SiSU_Env::Info_env.new(@opt.fns) -      local_path="#{dir.path.output}/#{dir.fnb}" -      File.mkpath(local_path) unless FileTest.directory?(local_path) +      File.mkpath(@local_path) unless FileTest.directory?(@local_path)        system(%{          cd #{@env.path.processing}          echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt          #7zip -qz #{@opt.fns}.7z sisu_zip.txt < sisu_zip.txt -        7zr a -t7z -m0=lzma -mx=9 -ms=on #{@opt.fns}.7z sisu_zip.txt -        7zr a -t7z -m0=lzma -mx=9 -ms=on #{@opt.fns}.7z sisupod -        #7zip -qr #{@opt.fns}.7z sisupod -        mv #{@opt.fns}.7z #{local_path}/sisupod.7z & +        7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisu_zip.txt +        7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisupod +        #7zip -qr #{@zipfile}.7z sisupod +        mv #{@zipfile}.7z #{@local_path}/. &          rm -r sisupod/* && cd #{@env.path.pwd}        })        tell=SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z")        tell.blue_tab unless @opt.cmd =~/q/      end      def sisupod_zip -      dir=SiSU_Env::Info_env.new(@opt.fns) -      local_path="#{dir.path.output}/#{dir.fnb}" -      File.mkpath(local_path) unless FileTest.directory?(local_path) +      File.mkpath(@local_path) unless FileTest.directory?(@local_path)        system(%{          cd #{@env.path.processing}          echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt -        zip -qz #{@opt.fns}.zip sisu_zip.txt < sisu_zip.txt -        zip -qr #{@opt.fns}.zip sisupod -        mv #{@opt.fns}.zip #{local_path}/sisupod.zip & +        zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt +        zip -qr #{@zipfile}.zip sisupod +        mv #{@zipfile}.zip #{@local_path}/. &          rm -r sisupod/* && cd #{@env.path.pwd}        }) -      tell=SiSU_Screen::Ansi.new('',"#{@opt.fns}.zip") +      tell=SiSU_Screen::Ansi.new('',"#{@zipfile}.zip")        tell.blue_tab unless @opt.cmd =~/q/      end    end diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 4080795d..510324c7 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -339,9 +339,9 @@ module SiSU_Env      end    end    class Env_call -    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv=nil,nil,nil,nil,nil,nil +    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil      @@ad={} -    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:ad +    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad      def initialize(fns='')        super()        @fns=fns @@ -349,22 +349,28 @@ module SiSU_Env        @rc=Get_init.instance.yamlrc        @ad=Get_init.instance.ads        if @fns and @fns != '' and @fns !=@@fns -        @@fns,@@fnn,@@fnb,@@fnt,@@flv=@fns,nil,nil,nil,nil +        @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil        end        if @fns and @fns != '' #watch          if multilingual -          m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst|ssm)$/ +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/            @@fnn ||=@fns[m,1]            @@fnb ||=@fns[m,2]            @@fnt ||=@fns[m,3]            @@flv ||=document_language_versions_found[:f] -        else m=/(.+?)\.([_-]?sst|ssm)$/ +          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' +          else @@fnb + '.sst.zip' +          end +        else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/            @@fnb ||=@fns[m,1]            @@fnm ||=@fns[m,1]            @@fnt ||=@fns[m,2] +          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' +          else @@fnb + '.sst.zip' +          end          end        end -      @fnn,@fnb,@fnt,@flv=@@fnn,@@fnb,@@fnt,@@flv +      @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz      end      def multilingual        if defined? @rc['default']['multilingual'] and @rc['default']['multilingual'] != nil; @rc['default']['multilingual'] @@ -375,9 +381,9 @@ module SiSU_Env        @fn={}        unless (@fns.nil? or @fns.empty?)          if multilingual -          m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst$)/ +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/            @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] -        else m=/(.+?)\.([_-]?sst$)/ +        else m=/(.+?)\.((?:-|ssm\.)?sst$)/            @fn[:b]=@fn[:m]=@fns[m,1]            @fn[:t]=@fns[m,2]          end @@ -405,10 +411,10 @@ module SiSU_Env        @m=[]        unless (@fns.nil? or @fns.empty?)          if multilingual -          m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst$)/ +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/            @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3]            #@fl[:v]=@env.document_language_versions_found -        else m=/(.+?)\.([_-]?sst$)/ +        else m=/(.+?)\.((?:-|ssm\.)?sst$)/            @fn[:b]=@fn[:m]=@fns[m,1]            @fn[:t]=@fns[m,2]          end @@ -442,7 +448,10 @@ module SiSU_Env      def filename(code,name,suffix)        d=SiSU_Env::Info_env.new(@fns)        fnl=d.i18n.lang_filename(code) -      "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" +      if code +        "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" +      else "#{name}#{suffix}" +      end      end      def lang(code)        @fn={ @@ -469,7 +478,8 @@ module SiSU_Env          :sitemap_touch   => filename(code,"sitemap_#@fnb",'.xml'),          :sxs             => filename(code,@fnb,'.sxs.xml'),          :sxd             => filename(code,@fnb,'.sxd.xml'), -        :sxn             => filename(code,@fnb,'.sxn.xml') +        :sxn             => filename(code,@fnb,'.sxn.xml'), +        :sisupod         => filename(nil,@fnz,'')        }        @fn      end @@ -734,7 +744,7 @@ module SiSU_Env        language[:c]      end      def file_to_language(file) -      m=/.+?\~(\w{2,3})\.[_-]?sst$/ +      m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/        @language=if file =~m ; file[m,1]        else ''        end @@ -747,7 +757,7 @@ module SiSU_Env    class Info_env < Env_call      require 'fileutils'      include FileUtils -    attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:webserv_host_cgi,:webserv_port_cgi,:processing,:etc,:yamlrc_dir +    attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:etc,:yamlrc_dir      @@image_flag,@@local_image=true,true   #warning on @@image_flag      @@fb=@@man_path=nil,nil      def initialize(fns='',md=nil) @@ -757,7 +767,7 @@ module SiSU_Env        fnb=if @md and defined? @md.fnb; @md.fnb        elsif defined? @env.fnb and @env.fnb; @env.fnb        elsif not @fns.nil? and not @fns.empty? -        m=/(.+)?\.(?:[_-]?sst|ssm)$/m +        m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m          @fns[m,1] if not @fns.empty?        end        if fnb; @@fb ||=fnb @@ -768,6 +778,7 @@ module SiSU_Env        @pwd=@@pwd||=Dir.pwd        m=/.+\/(\S+)/m        @stub_pwd=@@pwd[m,1] +      @stub_src=@stub_pwd + '/src'      end      def user        @sys.user @@ -800,6 +811,9 @@ module SiSU_Env      def stub_pwd                                                                     #200412        @stub_pwd      end +    def stub_src +      @stub_src +    end      def sisupod        #path.processing        #  sisupod @@ -1096,17 +1110,17 @@ WOK        self      end      def source_file_path -      file=@fns.gsub(/(\.ssm)/,'._sst') -      pth=unless file =~/\._sst$/; "#{Dir.pwd}" +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') +      pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}"        else "#{path.composite_file}"        end      end      def source_file_with_path -      file=@fns.gsub(/(\.ssm)/,'._sst') +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst')        "#{source_file_path}/#{file}"      end      def read_source_file(fns) -      fns_array=unless fns =~/\._sst$/ +      fns_array=unless fns =~/\.ssm.sst$/          IO.readlines(fns,'')        else IO.readlines("#{path.composite_file}/#{fns}",'')        end @@ -1121,6 +1135,9 @@ WOK        def stub_pwd          @stub_pwd        end +      def stub_src +        @stub_src +      end        def etc          defaults[:sisu_etc]                                                      #live/dynamic          # @sys.sisu_etc                                                           #broken: live/dynamic @@ -1208,6 +1225,9 @@ WOK        def output                                                                 #web/webserv output directory... subdirectory into which further subdirectories are made based on file names          "#{path.webserv}/#@stub_pwd"        end +      def output_src                                                                 #web/webserv output directory... subdirectory into which further subdirectories are made based on file names +        "#{path.webserv}/src" +      end        def manpage          "#{path.output}/man"        end @@ -1523,11 +1543,11 @@ WOK              require 'ftools'              images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}")              pth="#{path.webserv}/#@stub_pwd" -            File.mkpath("#{pth}/_sisu/image_local") unless FileTest.directory?("#{pth}/_sisu/image_local") +            File.mkpath("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image")              images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0              @@image_flag=false            end -          '../_sisu/image_local' +          '../_sisu/image'          else            if @@local_image==true              cmd=if @cmd; @cmd @@ -1892,7 +1912,7 @@ WOK          end          if @md.cmd =~ /s/;                         ft << @md.fns          end -        if @md.cmd =~ /S/;                         ft << 'sisupod.zip' << '.kdi' +        if @md.cmd =~ /S/;                         ft << @md.fn[:sisupod] << '.kdi'          end          @fnb=@md.fnb        else                                                                     # still needed where/when param is not parsed @@ -1912,7 +1932,7 @@ WOK          end          if @opt.cmd =~ /i/;                        ft << '.1' << '??.man.1' << 'man.??.1'          end -        if @opt.cmd =~ /a/;                   ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +        if @opt.cmd =~ /a/;                        ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'          end          if @opt.cmd =~ /[g]/;                      ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt'          end @@ -1924,7 +1944,7 @@ WOK          end          if @opt.cmd =~ /s/;                        ft << '.sst' << '.ssi' << '.ssm'          end -        if @opt.cmd =~ /S/;                        ft << 'sisupod.zip' << '.kdi' +        if @opt.cmd =~ /S/;                        ft << '.zip' << '.kdi'          end          if @opt.mod.inspect =~ /sxm|sxs|xml/;      ft << @fnb << '.sxs.xml'          end @@ -1943,6 +1963,9 @@ WOK        @source_path=if @fnb and not @fnb.empty?; "#{@env.path.output}/#@fnb"        else                                      @env.path.output        end +      @source_path_src=if @fnb and not @fnb.empty?; "#{@env.path.output}/src" +      else                                      @env.path.output_src +      end        @local_sisu_source=if @filetypes =~/\S/; "#@source_path/#@filetypes"        else                  @source_path        end @@ -1981,23 +2004,38 @@ WOK        @rc=Get_init.instance.yamlrc      end      def remote_host #see Info_remote remote_host_base_general -      r={} -      r=if (defined? @rc['remote']['user'] and defined? @rc['remote']['host']) -        r[:user]=@rc['remote']['user'] -        r[:host]=@rc['remote']['host'] -        r[:path]=if defined? @rc['remote']['path'] +      r=[] +      r=if (defined? @rc['remote'] and @rc['remote'].class==Array) +        r_array=@rc['remote'] +        r_array.each_with_index do |renv,i| +          r[i]={} +          if defined? renv['user'] and defined? renv['host'] +          end +          r[i][:user]=renv['user'] +          r[i][:host]=renv['host'] +          r[i][:path]=if defined? renv['path'] +            renv['path'] +          else '' +          end +          r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" +        end +        r +      elsif (defined? @rc['remote'] and @rc['remote'].class==Hash and defined? @rc['remote']['user'] and defined? @rc['remote']['host']) +        r[0][:user]=@rc['remote']['user'] +        r[0][:host]=@rc['remote']['host'] +        r[0][:path]=if defined? @rc['remote']['path']            @rc['remote']['path']          else ''          end -        r[:name]="#{r[:user]}@#{r[:host]}:#{r[:path]}" +        r[0][:name]="#{r[:user]}@#{r[:host]}:#{r[:path]}"          r        else -        r[:name]='.' -        r[:user]='' -        r[:host]='' -        r[:path]='' -        r +        r[0][:name]='.' +        r[0][:user]='' +        r[0][:host]='' +        r[0][:path]=''          #puts "no remote host or user" +        r        end      end    end @@ -2013,112 +2051,154 @@ WOK        SiSU_Env::Info_remote_host.new.remote_host      end      def remote_host_base -      remote=remote_host_base_general -      #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? -      @@flag_remote=true if remote[:name] =~/\S+?@\S+/ #and  host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ -      remote_host_base_general[:name] +      remote_host_base_general.each do |remote_conn| +        #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? +        @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ +        #remote_conn[:name] +      end +      remote_host_base_general      end      def scp                                                                    #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built -      input=@local_sisu_source -      output=case @opt.cmd -      when /u/;                "#{self.remote_host_base}/#{@env.path.stub_pwd}/."             #creates remote directory tree, this is not the usual function of u -      when /[abhHNopwxXy]/;    "#{self.remote_host_base}/#{@env.path.stub_pwd}/#{@fnb}/." -      else                     "#{self.remote_host_base}/#{@env.path.stub_pwd}/." -      end -      if (input =~/\S/ and input !~/\/\//) and (output =~/\S/ and output !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ -          System_call.new(input,output).scp -      elsif @opt.cmd =~/U/; puts "#{input} -> #{output}" -      else puts 'suspect scp request, ignored' +      self.remote_host_base.each do |remote_conn| +        local_gen=@source_path +        remote_gen=case @opt.cmd +        when /u/;                "#{remote_conn[:name]}/#{@env.path.stub_pwd}/."             #creates remote directory tree, this is not the usual function of u +        when /[abhHNopwxXy]/;    "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." +        else                     "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        end +        #remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        local_src=@source_path_src +        remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." +        src_txt=@opt.fnc +        src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') +        if (local_gen =~/\S/ and local_gen !~/\/\//) and (remote_gen =~/\S/ and remote_gen !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ +          System_call.new(local_gen,remote_gen).scp +          if FileTest.file?("#{local_src}/#{src_txt}") or FileTest.file?("#{local_src}/#{src_pod}") +            System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src).scp +          end +        elsif  @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "#{local_gen} -> #{remote_gen}" +          if FileTest.file?("#{local_src}/#{src_doc}") or FileTest.file?("#{local_src}/#{src_doc}.zip") +            puts "#{local_src}/#{src_doc}* -> #{remote_src}" +          end +        else +          puts 'suspect scp request, ignored' +          puts "#{local_gen} -> #{remote_gen} remote flag: #@@flag_remote" +          puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def rsync -      input=@source_path -      output="#{self.remote_host_base}/#{@env.path.stub_pwd}/." -      if (input =~/\S/ and input !~/\/\//) and (output =~/\S/ and output !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ -        System_call.new(input,output,@opt.cmd).rsync('--delete-after') -      elsif  @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "#{input} -> #{output}" -      else -        puts 'suspect rsync request, ignored' -        puts "#{input} -> #{output} remote flag: #@@flag_remote" -        puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local_gen=@source_path +        remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        local_src=@source_path_src +        remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." +        src_txt=@opt.fnc +        src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') +        if (local_gen =~/\S/ and local_gen !~/\/\//) and (remote_gen =~/\S/ and remote_gen !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ +          System_call.new(local_gen,remote_gen,@opt.cmd).rsync('--delete-after') +          if FileTest.file?("#{local_src}/#{src_txt}") or FileTest.file?("#{local_src}/#{src_pod}") +            System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src,@opt.cmd).rsync +          end +        elsif  @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "#{local_gen} -> #{remote_gen}" +          if FileTest.file?("#{local_src}/#{src_doc}") or FileTest.file?("#{local_src}/#{src_doc}.zip") +            puts "#{local_src}/#{src_doc}* -> #{remote_src}" +          end +        else +          puts 'suspect rsync request, ignored' +          puts "#{local_gen} -> #{remote_gen} remote flag: #@@flag_remote" +          puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def scp_base                                                                #base site -      input=@source_path -      output="#{remote_host_base}/#{@env.path.stub_pwd}/." -      if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ -        puts "begin scp_base: #{input} -> #{output}" -        System_call.new("#{input}/#{@env.path.style}/",output).scp -      elsif @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "begin scp_base: #{input} -> #{output}" -        puts "#{input}/#{@env.path.style}/ -> #{output}" -      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local=@source_path +        remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ +          puts "begin scp_base: #{local} -> #{remote}" +          System_call.new("#{local}/#{@env.path.style}/",remote).scp +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "begin scp_base: #{local} -> #{remote}" +          puts "#{local}/#{@env.path.style}/ -> #{remote}" +        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def scp_base_all                                                            #base site -      input=@source_path -      output="#{remote_host_base}/#{@env.path.stub_pwd}/." -      if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ -        puts "begin scp_base_all: #{input} -> #{output}" -        System_call.new("#{input}/_sisu/image/",output).scp -        System_call.new("#{input}/_sisu/image_local/",output).scp -        System_call.new("#{input}/#{@env.path.style}/",output).scp -      elsif @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "scp_base_all: #{input} -> #{output}" -        puts "#{input}/_sisu/image/ -> #{output}" -        puts "#{input}/_sisu/image_local/ -> #{output}" -        puts "#{input}/#{@env.path.style}/ -> #{output}" -      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local=@source_path +        remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ +          puts "begin scp_base_all: #{local} -> #{remote}" +          System_call.new("#{local}/_sisu/image/",remote).scp +          System_call.new("#{local}/_sisu/image_local/",remote).scp +          System_call.new("#{local}/#{@env.path.style}/",remote).scp +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "scp_base_all: #{local} -> #{remote}" +          puts "#{local}/_sisu/image/ -> #{remote}" +          puts "#{local}/_sisu/image_local/ -> #{remote}" +          puts "#{local}/#{@env.path.style}/ -> #{remote}" +        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def rsync_base                                                              #base site -      input=@source_path -      output="#{remote_host_base}/#{@env.path.stub_pwd}/." -      if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ -        #puts "begin rsync_base: #{input} -> #{output}" -        #System_call.new("#{input}/_sisu/image/",output).rsync -        #System_call.new("#{input}/_sisu/image_local/",output).rsync -        #System_call.new("#{input}/#{@env.path.style}/",output).rsync -      elsif @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "rsync_base: #{input} -> #{output}" -        puts "#{input}/_sisu/image/ -> #{output}" -        puts "#{input}/_sisu/image_local/ -> #{output}" -        puts "#{input}/#{@env.path.style}/ -> #{output}" -      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local=@source_path +        remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ +          #puts "begin rsync_base: #{local} -> #{remote}" +          #System_call.new("#{local}/_sisu/image/",remote).rsync +          #System_call.new("#{local}/_sisu/image_local/",remote).rsync +          #System_call.new("#{local}/#{@env.path.style}/",remote).rsync +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "rsync_base: #{local} -> #{remote}" +          puts "#{local}/_sisu/image/ -> #{remote}" +          puts "#{local}/_sisu/image_local/ -> #{remote}" +          puts "#{local}/#{@env.path.style}/ -> #{remote}" +        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def rsync_base_sync                                                         #base site -      input=@source_path -      output="#{remote_host_base}/#{@env.path.stub_pwd}/." -      if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ -        puts "begin rsync_base_sync: #{input} -> #{output}" -        System_call.new("#{input}/_sisu/image/",output).rsync('--delete-after') -        System_call.new("#{input}/_sisu/image_local/",output).rsync('--delete-after') -        System_call.new("#{input}/#{@env.path.style}/",output).rsync('--delete-after') -      elsif @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "rsync_base_sync: #{input} -> #{output}" -        puts "#{input}/_sisu/image/ -> #{output}" -        puts "#{input}/_sisu/image_local/ -> #{output}" -        puts "#{input}/#{@env.path.style}/ -> #{output}" -      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local=@source_path +        remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] and @@flag_remote==true and @opt.cmd !~/U/ +          puts "begin rsync_base_sync: #{local} -> #{remote}" +          System_call.new("#{local}/_sisu/image/",remote).rsync('--delete-after') +          System_call.new("#{local}/_sisu/image_local/",remote).rsync('--delete-after') +          System_call.new("#{local}/#{@env.path.style}/",remote).rsync('--delete-after') +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "rsync_base_sync: #{local} -> #{remote}" +          puts "#{local}/_sisu/image/ -> #{remote}" +          puts "#{local}/_sisu/image_local/ -> #{remote}" +          puts "#{local}/#{@env.path.style}/ -> #{remote}" +        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end      def rsync_sitemaps                                                              #sitemap directory -      input="#@source_path/sitemapindex.xml" -      output="#{remote_host_base}/#{@env.path.stub_pwd}/." -      if @@flag_remote -      #if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] #and @@flag_remote==true and @opt.cmd !~/U/ -        System_call.new(input,output).rsync('--delete-after') -      elsif @opt.cmd =~/U/ -        puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        puts "rsync_sitemaps: #{input} -> #{output}" -      else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +      self.remote_host_base.each do |remote_conn| +        local="#@source_path/sitemapindex.xml" +        remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." +        if @@flag_remote +        #if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] #and @@flag_remote==true and @opt.cmd !~/U/ +          System_call.new(local,remote).rsync('--delete-after') +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "rsync_sitemaps: #{local} -> #{remote}" +        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +        end        end      end    end @@ -2145,7 +2225,7 @@ WOK      end      def images        File.mkpath("#{@env.path.output}/_sisu") unless FileTest.directory?("#{@env.path.output}/_sisu") -      File.symlink("../../_sisu/image", "#{@env.path.output}/_sisu/image") unless File.exist?("#{@env.path.output}/_sisu/image") or File.symlink?("#{@env.path.output}/_sisu/image") +      File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") unless File.exist?("#{@env.path.output}/_sisu/image_sys") or File.symlink?("#{@env.path.output}/_sisu/image_sys")      end      def man_forms        #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form") == true @@ -2160,7 +2240,7 @@ WOK        @fns=fns      end      def basefilename -      m=/(.+?)\.(?:[_-]?sst|ssm)$/m +      m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m        fnb=@fns[m,1]      end      def project @@ -2584,7 +2664,7 @@ WOK      end      def cp_local_images        src="#@pwd/_sisu/image" -      dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_local" +      dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"        cp_images(src,dest)      end      def cp_external_images @@ -2599,7 +2679,7 @@ WOK      end      def cp_base_images #fix images        src="#{@env.path.share}/image" -      dest="#{@env.path.webserv}/_sisu/image" +      dest="#{@env.path.webserv}/_sisu/image_sys"        cp_images(src,dest)      end      def cp_css diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index 3c7a35c2..a6d94c1a 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -84,7 +84,7 @@ module SiSU_TexInfo      def directories        begin          case @opt.fns -        when /\.[_-]?sst$/ +        when /\.(?:-|ssm\.)?sst$/            Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}")            Dir.mkdir(@env.path.texi) unless FileTest.directory?(@env.path.tex)            @@filename_texinfo=File.new(%{#{@env.path.texi}/#{@opt.fnb}.texinfo},'w+') @@ -400,12 +400,12 @@ module SiSU_TexInfo        @@filename_texinfo.close      end      def makeinfo -      if @md.fns =~/\.[_-]?sst$/ +      if @md.fns =~/\.(?:-|ssm\.)?sst$/          m=/(.+?)\.([_-]?sst)$/.match(@md.fns)          fnb,sfx=m[1],m[2]          pwd=Dir.pwd          case sfx -        when /[_-]?sst$/ +        when /(?:-|ssm\.)?sst$/            @env=SiSU_Env::Info_env.new(@md.fns,@md.cmd)            Dir.chdir(@env.path.texi)            texinfo=SiSU_Env::System_call.new("#{fnb}.texinfo") diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 4b4613b0..d6420684 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -91,7 +91,7 @@ module SiSU_TeX        begin          @dir_out_root=@env.path.output          case @opt.fns -        when /\.[_-]?sst$/ +        when /\.(?:-|ssm\.)?sst$/            SiSU_Env::SiSU_file.new(@md).mkdir            Dir.mkdir(@env.path.tex) unless FileTest.directory?(@env.path.tex)          end @@ -197,10 +197,10 @@ module SiSU_TeX            @tex_f_no=0            info={}            if FileTest.file?(@env.source_file_with_path) -            if @md.fns =~/\.[_-]?sst$/ +            if @md.fns =~/\.(?:-|ssm\.)?sst$/                @dirout=SiSU_Env::Info_env.new(@md.fns)                case @md.fns -              when /\.[_-]?sst$/ +              when /\.(?:-|ssm\.)?sst$/                  if FileTest.directory?(@env.path.tex)==true                    Dir.chdir(@env.path.tex)                    @dir_sisu=@dirout.path.output diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 7798e886..7849727b 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -733,7 +733,7 @@ WOK        image,m=/<:image\s+(\S+)\s+.+?width=``(\d+)''.+?>/m.match(@string).captures        width=m[1] || '100'        width=width.to_i*0.4 -      image_source=if @md.fns =~/\._?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") +      image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")          dir.path.image_source_local_tex        elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")          dir.path.image_source_remote_tex @@ -770,7 +770,7 @@ WOK        hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace        caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c        #caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c[1]}\\end{scriptsize}&}" if c -      image_source=if @md.fns =~/\._?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") +      image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")          dir.path.image_source_local_tex        elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}")          dir.path.image_source_remote_tex @@ -835,7 +835,7 @@ WOK              tell.print_grey #unless @opt.cmd =~/q/            end            ins=if image #most images fc etc. #% clean up ! -            out=if @md.fns =~/\._?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") +            out=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}")                @center_begin +                "\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output                "{\\includegraphics*[width=#{width}pt]" + diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb index 7f087b95..cfe242b3 100644 --- a/lib/sisu/v0/urls.rb +++ b/lib/sisu/v0/urls.rb @@ -86,7 +86,7 @@ module SiSU_urls        fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)        @fnl=@env.i18n.lang_filename(fn_set_lang[:c])        @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c]) -      @m_regular=/(.+?)\.(?:[_-]?sst|ssm)$/ +      @m_regular=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/        @path=SiSU_Env::Info_env.new(@opt.fns)        @webserv_url=@path.url.output_tell        @tool=@env.program.text_editor @@ -97,7 +97,7 @@ module SiSU_urls        @odf_viewer=@env.program.odf_viewer        @manpage_gen=@env.program.manpage_generator        source=if @opt.fns =~/\.sst$/; @opt.fns -      elsif @opt.fns =~/\._sst/; "#@fnb.composite.sst" +      elsif @opt.fns =~/\.ssm\.sst/; "#@fnb.ssm.sst"        else 'not recognised file'        end        @u ||= { @@ -122,7 +122,7 @@ module SiSU_urls          'p (PDF portrait)'=>@fn[:pdf_p],          'P[iu] (DB postgresql import/update)'=>'psql',          's (sisu markup)'=>source, -        'S (sisupod)'=>'sisupod.zip', +        'S (sisupod)'=>@fn[:sisupod],          'x (XML sax type)'=>@fn[:sax],          'X (XML dom type)'=>@fn[:dom],          'y (Manifest, html)'=>@fn[:manifest], @@ -185,7 +185,7 @@ module SiSU_urls        @pwd_stub="#@webserv_url"[m,1]        @u.each do |x,y|          if @opt.fns =~ @m_regular -          if x=~/^([abchHNopsSwxXyY])/ and @opt.cmd=~/[abchHNopsSwxXyY]/ and x=~/^[#{@opt.cmd}]/ +          if x=~/^([abchHNopwxXyY])/ and @opt.cmd=~/[abchHNopwxXyY]/ and x=~/^[#{@opt.cmd}]/              m=$1              tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/#@fnb/#{y}")              tell.result unless @opt.cmd =~/q/ @@ -216,6 +216,14 @@ module SiSU_urls              tell.result unless @opt.cmd =~/q/              @opt.cmd.gsub!(/P[iu]/,'')            end +          if x=~/^[sS]/ and @opt.cmd =~/[sS]/ +            zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip') +            else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1') +            end +            tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/src/#{y}") +            tell.result unless @opt.cmd =~/q/ +            @opt.cmd.gsub!(/I/,'') +          end            urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/          end        end | 
