From ebc9b30cafa7d4ef1fcca7eeb82207dd2572d4c2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:25:31 -0400 Subject: v5 v6: bin/sisu, hub, options, pass message: sisu_called_from_directory --- lib/sisu/v5/constants.rb | 1 + lib/sisu/v5/hub.rb | 7 +++---- lib/sisu/v5/options.rb | 13 ++++++------- lib/sisu/v5/sst_convert_markup.rb | 3 ++- lib/sisu/v6/constants.rb | 1 + lib/sisu/v6/hub.rb | 7 +++---- lib/sisu/v6/options.rb | 13 ++++++------- lib/sisu/v6/sst_convert_markup.rb | 3 ++- 8 files changed, 24 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 05678b32..d242ef1d 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -237,6 +237,7 @@ Px={ po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', lng_lst: SiSU_is[:language_list], + lng_lst_rgx: SiSU_is[:language_list_regex], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index d9359862..5d291f9b 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -79,10 +79,9 @@ module SiSU error('uri NOT FOUND (LoadError)') end class HubMaster - def initialize(argv) - pwd_the=Dir.pwd + def initialize(argv,call_path) begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') @@ -90,7 +89,7 @@ module SiSU __LINE__.to_s + ':' + __FILE__ end ensure - Dir.chdir(pwd_the) + Dir.chdir(call_path) end end end diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 591bb990..e7d0f023 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -69,7 +69,6 @@ module SiSU_Commandline end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb - @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions @pagenew= @@ -155,18 +154,18 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil - def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' + def initialize(a,call_path) + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? - @@sisu_call_origin_path ||=Dir.pwd - @base_path=@@sisu_call_origin_path + @call_path=call_path + @base_path= + call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index cec67960..cdceba7c 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -313,7 +313,8 @@ end #%% files to match for this conversion set -------------------------> require_relative 'options' # options.rb argv=$* -@opt=SiSU_Commandline::Options.new(argv) +base_path=Dir.pwd +@opt=SiSU_Commandline::Options.new(argv,base_path) case @opt.mod.inspect when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb index 53ed226a..87611bf9 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -237,6 +237,7 @@ Px={ po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', lng_lst: SiSU_is[:language_list], + lng_lst_rgx: SiSU_is[:language_list_regex], lv1: '*', lv2: '=', lv3: '=', diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 94d0eb8e..7508dcbc 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -79,10 +79,9 @@ module SiSU error('uri NOT FOUND (LoadError)') end class HubMaster - def initialize(argv) - pwd_the=Dir.pwd + def initialize(argv,call_path) begin #% select what to do (set options & start processing (files selected if any)) - opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set + opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set SiSU::Processing.new(opt).actions # do it rescue cmd=(opt ? opt.cmd : '') @@ -90,7 +89,7 @@ module SiSU __LINE__.to_s + ':' + __FILE__ end ensure - Dir.chdir(pwd_the) + Dir.chdir(call_path) end end end diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index e181ee8e..1850c6d4 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -69,7 +69,6 @@ module SiSU_Commandline end require_relative 'sysenv' # sysenv.rb require_relative 'param_make' # param_make.rb - @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions @pagenew= @@ -155,18 +154,18 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil - def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' + def initialize(a,call_path) + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? - @@sisu_call_origin_path ||=Dir.pwd - @base_path=@@sisu_call_origin_path + @call_path=call_path + @base_path= + call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v6/sst_convert_markup.rb b/lib/sisu/v6/sst_convert_markup.rb index 0b749fc5..8d523d0f 100644 --- a/lib/sisu/v6/sst_convert_markup.rb +++ b/lib/sisu/v6/sst_convert_markup.rb @@ -313,7 +313,8 @@ end #%% files to match for this conversion set -------------------------> require_relative 'options' # options.rb argv=$* -@opt=SiSU_Commandline::Options.new(argv) +base_path=Dir.pwd +@opt=SiSU_Commandline::Options.new(argv,base_path) case @opt.mod.inspect when /=kdi/ SiSU_Modify::ConvertMarkup.new(@opt).conversion -- cgit v1.2.3 From 639c57ebfba5b860d788218f19622fb52533806f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:33:07 -0400 Subject: v5 v6: sysenv, general, base_markup_dir_stub (replace pwd_stub) --- lib/sisu/v5/ao_composite.rb | 2 +- lib/sisu/v5/cgi_pgsql.rb | 2 +- lib/sisu/v5/cgi_sqlite.rb | 2 +- lib/sisu/v5/db_create.rb | 4 +- lib/sisu/v5/embedded.rb | 8 +-- lib/sisu/v5/options.rb | 3 +- lib/sisu/v5/param.rb | 4 -- lib/sisu/v5/sysenv.rb | 140 ++++++++++++++++++++++---------------------- lib/sisu/v5/utils.rb | 11 +++- lib/sisu/v6/ao_composite.rb | 2 +- lib/sisu/v6/cgi_pgsql.rb | 2 +- lib/sisu/v6/cgi_sqlite.rb | 2 +- lib/sisu/v6/db_create.rb | 4 +- lib/sisu/v6/embedded.rb | 8 +-- lib/sisu/v6/options.rb | 3 +- lib/sisu/v6/param.rb | 4 -- lib/sisu/v6/sysenv.rb | 140 ++++++++++++++++++++++---------------------- lib/sisu/v6/utils.rb | 11 +++- 18 files changed, 178 insertions(+), 174 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/ao_composite.rb b/lib/sisu/v5/ao_composite.rb index 5cdfaa81..0d5905bc 100644 --- a/lib/sisu/v5/ao_composite.rb +++ b/lib/sisu/v5/ao_composite.rb @@ -85,7 +85,7 @@ module SiSU_Assemble end imagefile.close end - output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" FileUtils::mkdir_p(output_path) \ unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 1ab04316..a65b8a97 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -90,7 +90,7 @@ module SiSU_CGI_PgSQL and @rc['search']['sisu']['db'] =~/\S+/ @rc['search']['sisu']['db'] else - @env.path.stub_pwd #'sisu' #breaks if not present + @env.path.base_markup_dir_stub #'sisu' #breaks if not present end @name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}} @name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}} diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index 2d185f20..fc665074 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -118,7 +118,7 @@ module SiSU_CGI_SQLite output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3 puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} - default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.stub_pwd}#{@cX.off} (#{@env.path.stub_pwd}) + default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}#{@cX.off} (#{@env.path.base_markup_dir_stub}) cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} to modify use: #{@cX.brown}sisu --db-sqlite --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index 451a0a34..78277c8b 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -86,13 +86,13 @@ module SiSU_DbCreate @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type==:sqlite) \ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) tell.dark_grey_title_hi end - SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type==:pg #watch use of path.stub_pwd instead of stub + SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub end def output_dir? dir=SiSU_Env::InfoEnv.new('') diff --git a/lib/sisu/v5/embedded.rb b/lib/sisu/v5/embedded.rb index e205353a..c013806b 100644 --- a/lib/sisu/v5/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -113,9 +113,9 @@ module SiSU_Embedded def audio #p @md.ec[:audio] src="#{@base_src_dir}/_sisu/mm/audio" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ @@ -133,9 +133,9 @@ module SiSU_Embedded def multimedia #p @md.ec[:multimedia] src="#{@base_src_dir}/_sisu/mm/video" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index e7d0f023..bc4d7da0 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -164,8 +164,7 @@ module SiSU_Commandline @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path= - call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') + @base_path=SiSU_Utils::Path.new.base_markup(call_path) r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index b2e50d41..ed28701c 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -118,10 +118,6 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('-- bug alert --') - p 'f_pth ' + @opt.f_pth[:pth] - p 'pwd ' + Dir.pwd end if @@fns !=@fns \ or @@pth !=Dir.pwd #@opt.f_pth[:pth] diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 7358ff40..35d128f6 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -116,13 +116,13 @@ module SiSU_Env share=Config::CONFIG['datadir'] + '/sisu' data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd ||=@@pwd[m,1] + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" - prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" + prcss_dir_stub="#{prcss_dir}/#{@base_markup_dir_stub}" if @@user - tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" + tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" else #error tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" end @@ -1096,7 +1096,7 @@ module SiSU_Env rescue LoadError SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') end - 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,:processing_git,:etc,:yamlrc_dir + attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil def initialize(fns='',md=nil) @@ -1121,11 +1121,10 @@ module SiSU_Env @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd - m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd - @stub_src= @stub_pwd + '/src' - @stub_pod= @stub_pwd + '/pod' - @stub_epub= @stub_pwd + '/epub' + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub + @stub_src= @base_markup_dir_stub + '/src' + @stub_pod= @base_markup_dir_stub + '/pod' + @stub_epub= @base_markup_dir_stub + '/epub' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? r=Px[:lng_lst_rgx] @@ -1206,8 +1205,8 @@ module SiSU_Env @@current_document||=Dir.pwd @@current_document end - def stub_pwd #200412 - @stub_pwd + def base_markup_dir_stub #200412 + @base_markup_dir_stub end def stub_md_harvest #watch @stub_set_manifest @@ -2062,8 +2061,8 @@ WOK def pwd @sys.pwd end - def stub_pwd - @stub_pwd + def base_markup_dir_stub + @base_markup_dir_stub end def stub_epub @stub_epub @@ -2149,10 +2148,11 @@ WOK end def webserv_stub_ensure FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) - FileUtils::mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}") + FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \ + unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}") end def webserv_map_pwd #dir - "#{path.webserv}/#{stub_pwd}" + "#{path.webserv}/#{base_markup_dir_stub}" end def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) defaults[:webserv_dir] @@ -2288,13 +2288,13 @@ WOK end def stub_dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def stub_dir_orig # ends up with lang, if lang dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) @opt=opt @@ -2504,21 +2504,21 @@ WOK "http://#{@sys.hostname}" end def dir_url - "file://#{path.webserv}/#{stub_pwd}" + "file://#{path.webserv}/#{base_markup_dir_stub}" end def localhost - "http://localhost/#{stub_pwd}" + "http://localhost/#{base_markup_dir_stub}" end def local - "http://#{hostname}/#{@stub_pwd}" + "http://#{hostname}/#{@base_markup_dir_stub}" end def root if defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/https?:\/\// - "#{@rc['webserv']['url_root']}/#{@stub_pwd}" + "#{@rc['webserv']['url_root']}/#{@base_markup_dir_stub}" elsif defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/localhost/ - "http://localhost/#{@stub_pwd}" + "http://localhost/#{@base_markup_dir_stub}" else "file://#{path.output}" end end @@ -2567,14 +2567,14 @@ WOK and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}" - else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}" + "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@base_markup_dir_stub}" + else "#{http}#{@rc['webserv_cgi']['host']}/#{@base_markup_dir_stub}" end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@stub_pwd}" - else "#{http}#{webserv_host_base}/#{@stub_pwd}" + "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@base_markup_dir_stub}" + else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" end end http=http.strip @@ -2622,7 +2622,7 @@ WOK @rc['webserv']['url_root'] elsif path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@base_markup_dir_stub}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2635,7 +2635,7 @@ WOK def webserv_base #web url for local webserv (localhost, or hostname) if path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2696,8 +2696,8 @@ WOK when /^filesystem(?:_url)?/ then url.dir_url when /^remote(?:_webserv)?/ then url.remote when /^(?:webserv|local_webserv)/ then url.local - when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd + when /^local(:\d+)/ then url.hostname + $1 + '/' + base_markup_dir_stub + when /^localhost(:\d+)/ then url.localhost + $1 + '/' + base_markup_dir_stub when /^localhost/ then url.localhost when /^webrick/ then url.webrick when /^path/ then url.webserv_map_pwd @@ -2726,7 +2726,7 @@ WOK if FileTest.directory?(image_external) if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" + pth="#{path.webserv}/#{@base_markup_dir_stub}" FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false @@ -3497,9 +3497,9 @@ WOK self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + when /u/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." end local_epub=@source_path_epub local_src=@source_path_src @@ -3544,7 +3544,7 @@ WOK def site_base #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3562,7 +3562,7 @@ WOK def site_base_all #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3591,9 +3591,9 @@ WOK if f self.remote_host_base.each do |remote_conn| local_gen=@source_path - #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp @opt.fnc if (local_gen =~/\S/ \ @@ -3748,7 +3748,7 @@ WOK def site_harvest self.remote_host_base.each do |remote_conn| local=@source_path_harvest - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" lng='en' if @env.output_dir_structure.by? == :language ldest="#{lng}/manifest" @@ -3774,10 +3774,10 @@ WOK end def site_base #base site ldest='_sisu/*' - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" image_sys="#{@env.path.webserv}/_sisu/image_sys" self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}" remote_conf="#{remote_conn[:name]}/_sisu" SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel) @@ -3786,7 +3786,7 @@ WOK def site_base_sync self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3811,7 +3811,7 @@ WOK def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| local="#{@source_path}/sitemapindex.xml" - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) @@ -6931,8 +6931,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") "#{@md.doc_css}_html.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css") - "#{@env.path.stub_pwd}_html.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css") + "#{@env.path.base_markup_dir_stub}_html.css" else SiSU_Env::CSS_Default.new.html end @@ -6941,8 +6941,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css") "#{@md.doc_css}_html_tables.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css") - "#{@env.path.stub_pwd}_html_tables.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css") + "#{@env.path.base_markup_dir_stub}_html_tables.css" else SiSU_Env::CSS_Default.new.html_tables end end @@ -6950,8 +6950,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") "#{@md.doc_css}_xhtml.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css") - "#{@env.path.stub_pwd}_xhtml.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css") + "#{@env.path.base_markup_dir_stub}_xhtml.css" else SiSU_Env::CSS_Default.new.xhtml end end @@ -6959,8 +6959,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css") "#{@md.doc_css}_xml_sax.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css") - "#{@env.path.stub_pwd}_xml_sax.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css") + "#{@env.path.base_markup_dir_stub}_xml_sax.css" else SiSU_Env::CSS_Default.new.xml_sax end end @@ -6968,8 +6968,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css") - "#{@env.path.stub_pwd}_xml_dom.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css") + "#{@env.path.base_markup_dir_stub}_xml_dom.css" else SiSU_Env::CSS_Default.new.xml_dom end end @@ -6977,8 +6977,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css") - "#{@env.path.stub_pwd}_docbook.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css") + "#{@env.path.base_markup_dir_stub}_docbook.css" else SiSU_Env::CSS_Default.new.docbook_xml end end @@ -6986,8 +6986,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") "#{@md.doc_css}_homepage.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css") - "#{@env.path.stub_pwd}_homepage.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css") + "#{@env.path.base_markup_dir_stub}_homepage.css" else SiSU_Env::CSS_Default.new.homepage end end @@ -7047,8 +7047,8 @@ WOK puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} else puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} - filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html" - filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html" + filename_homepage="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/index.html" + filename_home_toc="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/toc.html" file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') file_homepage << @vz_home.homepage @@ -7059,10 +7059,10 @@ WOK end def homepage home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") - FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") if home_pages_manually_created.length > 0 home_pages_manually_created.each do |homepage| - FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else create_default_sisu_homepage(:none) @@ -7088,12 +7088,12 @@ WOK end def cp_local_images src="#{@pwd}/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_external_images src="#{@env.processing_path.processing}/external_document/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" if FileTest.directory?(src) cp_images(src,dest) if FileTest.directory?(src) end @@ -7102,7 +7102,7 @@ WOK src=@env.path.image_source dest_arr=[ "#{@env.path.webserv}/_sisu/image", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) @@ -7110,14 +7110,14 @@ WOK end def cp_webserver_images_local #this should not have been necessary src=@env.path.image_source - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images src=SiSU_is[:path_base_system_data] + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 9d9a3a51..7db4143a 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -174,8 +174,15 @@ module SiSU_Utils def initialize(dir=Dir.pwd) @dir=dir end - def base_markup - (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + def base_markup(call_path=nil) + call_path = call_path \ + ? call_path \ + : Dir.pwd + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(call_path)[1] + end + def base_markup_stub + m=/.+\/(?:src\/)?(\S+)/im + base_markup[m,1] end def bmd base_markup diff --git a/lib/sisu/v6/ao_composite.rb b/lib/sisu/v6/ao_composite.rb index 078e8ece..eaa4e08f 100644 --- a/lib/sisu/v6/ao_composite.rb +++ b/lib/sisu/v6/ao_composite.rb @@ -85,7 +85,7 @@ module SiSU_Assemble end imagefile.close end - output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" FileUtils::mkdir_p(output_path) \ unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync diff --git a/lib/sisu/v6/cgi_pgsql.rb b/lib/sisu/v6/cgi_pgsql.rb index 8372bb70..38b5c09f 100644 --- a/lib/sisu/v6/cgi_pgsql.rb +++ b/lib/sisu/v6/cgi_pgsql.rb @@ -90,7 +90,7 @@ module SiSU_CGI_PgSQL and @rc['search']['sisu']['db'] =~/\S+/ @rc['search']['sisu']['db'] else - @env.path.stub_pwd #'sisu' #breaks if not present + @env.path.base_markup_dir_stub #'sisu' #breaks if not present end @name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}} @name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}} diff --git a/lib/sisu/v6/cgi_sqlite.rb b/lib/sisu/v6/cgi_sqlite.rb index f64c3cf6..8cf01d3e 100644 --- a/lib/sisu/v6/cgi_sqlite.rb +++ b/lib/sisu/v6/cgi_sqlite.rb @@ -118,7 +118,7 @@ module SiSU_CGI_SQLite output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3 puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} - default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.stub_pwd}#{@cX.off} (#{@env.path.stub_pwd}) + default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}#{@cX.off} (#{@env.path.base_markup_dir_stub}) cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} to modify use: #{@cX.brown}sisu --db-sqlite --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} diff --git a/lib/sisu/v6/db_create.rb b/lib/sisu/v6/db_create.rb index 01fc1935..a2e3e8c4 100644 --- a/lib/sisu/v6/db_create.rb +++ b/lib/sisu/v6/db_create.rb @@ -86,13 +86,13 @@ module SiSU_DbCreate @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type==:sqlite) \ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) tell.dark_grey_title_hi end - SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type==:pg #watch use of path.stub_pwd instead of stub + SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub end def output_dir? dir=SiSU_Env::InfoEnv.new('') diff --git a/lib/sisu/v6/embedded.rb b/lib/sisu/v6/embedded.rb index 7a72cac0..cf294891 100644 --- a/lib/sisu/v6/embedded.rb +++ b/lib/sisu/v6/embedded.rb @@ -113,9 +113,9 @@ module SiSU_Embedded def audio #p @md.ec[:audio] src="#{@base_src_dir}/_sisu/mm/audio" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ @@ -133,9 +133,9 @@ module SiSU_Embedded def multimedia #p @md.ec[:multimedia] src="#{@base_src_dir}/_sisu/mm/video" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index 1850c6d4..eed42e51 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -164,8 +164,7 @@ module SiSU_Commandline @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path= - call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') + @base_path=SiSU_Utils::Path.new.base_markup(call_path) r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb index bacee802..a39ff215 100644 --- a/lib/sisu/v6/param.rb +++ b/lib/sisu/v6/param.rb @@ -118,10 +118,6 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('-- bug alert --') - p 'f_pth ' + @opt.f_pth[:pth] - p 'pwd ' + Dir.pwd end if @@fns !=@fns \ or @@pth !=Dir.pwd #@opt.f_pth[:pth] diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 3c774c46..ec4dbb9e 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -116,13 +116,13 @@ module SiSU_Env share=Config::CONFIG['datadir'] + '/sisu' data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd ||=@@pwd[m,1] + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" - prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" + prcss_dir_stub="#{prcss_dir}/#{@base_markup_dir_stub}" if @@user - tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" + tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" else #error tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" end @@ -1096,7 +1096,7 @@ module SiSU_Env rescue LoadError SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') end - 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,:processing_git,:etc,:yamlrc_dir + attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil def initialize(fns='',md=nil) @@ -1121,11 +1121,10 @@ module SiSU_Env @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd - m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd - @stub_src= @stub_pwd + '/src' - @stub_pod= @stub_pwd + '/pod' - @stub_epub= @stub_pwd + '/epub' + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub + @stub_src= @base_markup_dir_stub + '/src' + @stub_pod= @base_markup_dir_stub + '/pod' + @stub_epub= @base_markup_dir_stub + '/epub' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? r=Px[:lng_lst_rgx] @@ -1206,8 +1205,8 @@ module SiSU_Env @@current_document||=Dir.pwd @@current_document end - def stub_pwd #200412 - @stub_pwd + def base_markup_dir_stub #200412 + @base_markup_dir_stub end def stub_md_harvest #watch @stub_set_manifest @@ -2062,8 +2061,8 @@ WOK def pwd @sys.pwd end - def stub_pwd - @stub_pwd + def base_markup_dir_stub + @base_markup_dir_stub end def stub_epub @stub_epub @@ -2149,10 +2148,11 @@ WOK end def webserv_stub_ensure FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) - FileUtils::mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}") + FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \ + unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}") end def webserv_map_pwd #dir - "#{path.webserv}/#{stub_pwd}" + "#{path.webserv}/#{base_markup_dir_stub}" end def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) defaults[:webserv_dir] @@ -2288,13 +2288,13 @@ WOK end def stub_dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def stub_dir_orig # ends up with lang, if lang dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) @opt=opt @@ -2504,21 +2504,21 @@ WOK "http://#{@sys.hostname}" end def dir_url - "file://#{path.webserv}/#{stub_pwd}" + "file://#{path.webserv}/#{base_markup_dir_stub}" end def localhost - "http://localhost/#{stub_pwd}" + "http://localhost/#{base_markup_dir_stub}" end def local - "http://#{hostname}/#{@stub_pwd}" + "http://#{hostname}/#{@base_markup_dir_stub}" end def root if defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/https?:\/\// - "#{@rc['webserv']['url_root']}/#{@stub_pwd}" + "#{@rc['webserv']['url_root']}/#{@base_markup_dir_stub}" elsif defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/localhost/ - "http://localhost/#{@stub_pwd}" + "http://localhost/#{@base_markup_dir_stub}" else "file://#{path.output}" end end @@ -2567,14 +2567,14 @@ WOK and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}" - else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}" + "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@base_markup_dir_stub}" + else "#{http}#{@rc['webserv_cgi']['host']}/#{@base_markup_dir_stub}" end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@stub_pwd}" - else "#{http}#{webserv_host_base}/#{@stub_pwd}" + "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@base_markup_dir_stub}" + else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" end end http=http.strip @@ -2622,7 +2622,7 @@ WOK @rc['webserv']['url_root'] elsif path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@base_markup_dir_stub}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2635,7 +2635,7 @@ WOK def webserv_base #web url for local webserv (localhost, or hostname) if path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2696,8 +2696,8 @@ WOK when /^filesystem(?:_url)?/ then url.dir_url when /^remote(?:_webserv)?/ then url.remote when /^(?:webserv|local_webserv)/ then url.local - when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd + when /^local(:\d+)/ then url.hostname + $1 + '/' + base_markup_dir_stub + when /^localhost(:\d+)/ then url.localhost + $1 + '/' + base_markup_dir_stub when /^localhost/ then url.localhost when /^webrick/ then url.webrick when /^path/ then url.webserv_map_pwd @@ -2726,7 +2726,7 @@ WOK if FileTest.directory?(image_external) if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" + pth="#{path.webserv}/#{@base_markup_dir_stub}" FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false @@ -3497,9 +3497,9 @@ WOK self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + when /u/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." end local_epub=@source_path_epub local_src=@source_path_src @@ -3544,7 +3544,7 @@ WOK def site_base #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3562,7 +3562,7 @@ WOK def site_base_all #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3591,9 +3591,9 @@ WOK if f self.remote_host_base.each do |remote_conn| local_gen=@source_path - #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp @opt.fnc if (local_gen =~/\S/ \ @@ -3748,7 +3748,7 @@ WOK def site_harvest self.remote_host_base.each do |remote_conn| local=@source_path_harvest - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" lng='en' if @env.output_dir_structure.by? == :language ldest="#{lng}/manifest" @@ -3774,10 +3774,10 @@ WOK end def site_base #base site ldest='_sisu/*' - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" image_sys="#{@env.path.webserv}/_sisu/image_sys" self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}" remote_conf="#{remote_conn[:name]}/_sisu" SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel) @@ -3786,7 +3786,7 @@ WOK def site_base_sync self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3811,7 +3811,7 @@ WOK def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| local="#{@source_path}/sitemapindex.xml" - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) @@ -6931,8 +6931,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") "#{@md.doc_css}_html.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css") - "#{@env.path.stub_pwd}_html.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css") + "#{@env.path.base_markup_dir_stub}_html.css" else SiSU_Env::CSS_Default.new.html end @@ -6941,8 +6941,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css") "#{@md.doc_css}_html_tables.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css") - "#{@env.path.stub_pwd}_html_tables.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css") + "#{@env.path.base_markup_dir_stub}_html_tables.css" else SiSU_Env::CSS_Default.new.html_tables end end @@ -6950,8 +6950,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") "#{@md.doc_css}_xhtml.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css") - "#{@env.path.stub_pwd}_xhtml.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css") + "#{@env.path.base_markup_dir_stub}_xhtml.css" else SiSU_Env::CSS_Default.new.xhtml end end @@ -6959,8 +6959,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css") "#{@md.doc_css}_xml_sax.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css") - "#{@env.path.stub_pwd}_xml_sax.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css") + "#{@env.path.base_markup_dir_stub}_xml_sax.css" else SiSU_Env::CSS_Default.new.xml_sax end end @@ -6968,8 +6968,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css") - "#{@env.path.stub_pwd}_xml_dom.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css") + "#{@env.path.base_markup_dir_stub}_xml_dom.css" else SiSU_Env::CSS_Default.new.xml_dom end end @@ -6977,8 +6977,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css") - "#{@env.path.stub_pwd}_docbook.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css") + "#{@env.path.base_markup_dir_stub}_docbook.css" else SiSU_Env::CSS_Default.new.docbook_xml end end @@ -6986,8 +6986,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") "#{@md.doc_css}_homepage.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css") - "#{@env.path.stub_pwd}_homepage.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css") + "#{@env.path.base_markup_dir_stub}_homepage.css" else SiSU_Env::CSS_Default.new.homepage end end @@ -7047,8 +7047,8 @@ WOK puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} else puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} - filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html" - filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html" + filename_homepage="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/index.html" + filename_home_toc="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/toc.html" file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') file_homepage << @vz_home.homepage @@ -7059,10 +7059,10 @@ WOK end def homepage home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") - FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") if home_pages_manually_created.length > 0 home_pages_manually_created.each do |homepage| - FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else create_default_sisu_homepage(:none) @@ -7088,12 +7088,12 @@ WOK end def cp_local_images src="#{@pwd}/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_external_images src="#{@env.processing_path.processing}/external_document/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" if FileTest.directory?(src) cp_images(src,dest) if FileTest.directory?(src) end @@ -7102,7 +7102,7 @@ WOK src=@env.path.image_source dest_arr=[ "#{@env.path.webserv}/_sisu/image", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) @@ -7110,14 +7110,14 @@ WOK end def cp_webserver_images_local #this should not have been necessary src=@env.path.image_source - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images src=SiSU_is[:path_base_system_data] + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 5879db27..8995a860 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -174,8 +174,15 @@ module SiSU_Utils def initialize(dir=Dir.pwd) @dir=dir end - def base_markup - (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + def base_markup(call_path=nil) + call_path = call_path \ + ? call_path \ + : Dir.pwd + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(call_path)[1] + end + def base_markup_stub + m=/.+\/(?:src\/)?(\S+)/im + base_markup[m,1] end def bmd base_markup -- cgit v1.2.3 From 03c2846913b0abbbd8f8571ba45e948b00564bdb Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:35:37 -0400 Subject: v5 v6: ao_numbering, auto name segment, extract "number" from heading, refine --- lib/sisu/v5/ao_numbering.rb | 40 ++++++++++++++++++++++++++++------------ lib/sisu/v6/ao_numbering.rb | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 56 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index dc6ec4dd..a8304fa3 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -301,7 +301,7 @@ module SiSU_AO_Numbering @tuned_file=@tuned_file.flatten end def leading_zeros_fixed_width_number(possible_seg_name) - if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/ + if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. gsub(/\.$/,'') nl=possible_seg_name.to_s.length @@ -314,31 +314,47 @@ module SiSU_AO_Numbering possible_seg_name.to_s end end - def auto_seg_name(possible_seg_name,heading_num_is,type) + def auto_seg_name(possible_seg_name,heading_num_is,lv,type) prefix=case type - when :auto then Mx[:segname_prefix_auto_num_provide] + when :auto then Mx[:segname_prefix_auto_num_provide] when :extract then Mx[:segname_prefix_auto_num_extract] - else '_' #should not occur + else '_'*lv.to_i #should not occur end - if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ + if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. gsub(/\.$/,'') end - chosen_seg_name=if possible_seg_name =~/^[0-9]+$/m \ - and possible_seg_name.to_i <= heading_num_is.to_i + chosen_seg_name=if possible_seg_name =~/^[0-9]+[.]?$/m \ + and possible_seg_name.to_i <= heading_num_is.to_i \ + and lv == '1' prefix + leading_zeros_fixed_width_number(possible_seg_name) - elsif possible_seg_name =~/^[0-9][\d.,:-]*$/m + elsif possible_seg_name =~/^[0-9]+[.,:-]*$/m \ + and lv == '1' possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name - else prefix + possible_seg_name.to_s + elsif possible_seg_name =~ + /^[0-9]+[.,:-][0-9]+[.,:-]*$/m \ + and lv == '2' + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). + gsub(/\.$/,'') + prefix + possible_seg_name + elsif possible_seg_name =~ + /^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \ + and lv == '3' + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). + gsub(/\.$/,'') + prefix + possible_seg_name + else 'x'*lv.to_i + possible_seg_name.to_s end @chosen_seg_names << chosen_seg_name if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique chosen_seg_name else - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{chosen_seg_name}; manually name level 1 segments '1~given_name'") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'") exit end end @@ -380,7 +396,7 @@ module SiSU_AO_Numbering and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name possible_seg_name=$1 possible_seg_name= - auto_seg_name(possible_seg_name,heading_num_is,:extract) + auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract) possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') @@ -405,7 +421,7 @@ module SiSU_AO_Numbering if dob.ln==4 \ and not dob.name #if still no segment name, provide a numerical one possible_seg_name= - auto_seg_name(art_filename_auto,heading_num_is,:auto) + auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto) if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) dob.name=possible_seg_name diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb index 5b2137e7..1c5c326e 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -301,7 +301,7 @@ module SiSU_AO_Numbering @tuned_file=@tuned_file.flatten end def leading_zeros_fixed_width_number(possible_seg_name) - if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/ + if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. gsub(/\.$/,'') nl=possible_seg_name.to_s.length @@ -314,31 +314,47 @@ module SiSU_AO_Numbering possible_seg_name.to_s end end - def auto_seg_name(possible_seg_name,heading_num_is,type) + def auto_seg_name(possible_seg_name,heading_num_is,lv,type) prefix=case type - when :auto then Mx[:segname_prefix_auto_num_provide] + when :auto then Mx[:segname_prefix_auto_num_provide] when :extract then Mx[:segname_prefix_auto_num_extract] - else '_' #should not occur + else '_'*lv.to_i #should not occur end - if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ + if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/ possible_seg_name=possible_seg_name. gsub(/\.$/,'') end - chosen_seg_name=if possible_seg_name =~/^[0-9]+$/m \ - and possible_seg_name.to_i <= heading_num_is.to_i + chosen_seg_name=if possible_seg_name =~/^[0-9]+[.]?$/m \ + and possible_seg_name.to_i <= heading_num_is.to_i \ + and lv == '1' prefix + leading_zeros_fixed_width_number(possible_seg_name) - elsif possible_seg_name =~/^[0-9][\d.,:-]*$/m + elsif possible_seg_name =~/^[0-9]+[.,:-]*$/m \ + and lv == '1' possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') prefix + possible_seg_name - else prefix + possible_seg_name.to_s + elsif possible_seg_name =~ + /^[0-9]+[.,:-][0-9]+[.,:-]*$/m \ + and lv == '2' + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). + gsub(/\.$/,'') + prefix + possible_seg_name + elsif possible_seg_name =~ + /^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \ + and lv == '3' + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). + gsub(/\.$/,'') + prefix + possible_seg_name + else 'x'*lv.to_i + possible_seg_name.to_s end @chosen_seg_names << chosen_seg_name if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique chosen_seg_name else - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{chosen_seg_name}; manually name level 1 segments '1~given_name'") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'") exit end end @@ -380,7 +396,7 @@ module SiSU_AO_Numbering and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name possible_seg_name=$1 possible_seg_name= - auto_seg_name(possible_seg_name,heading_num_is,:extract) + auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract) possible_seg_name=possible_seg_name. gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') @@ -405,7 +421,7 @@ module SiSU_AO_Numbering if dob.ln==4 \ and not dob.name #if still no segment name, provide a numerical one possible_seg_name= - auto_seg_name(art_filename_auto,heading_num_is,:auto) + auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto) if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) dob.name=possible_seg_name -- cgit v1.2.3 From 9100b4d633c56cbeee29c5bea84ac8bb78dcdee5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:36:35 -0400 Subject: v5 v6: src_share, cosmetic code --- lib/sisu/v5/src_share.rb | 15 ++++++++++++--- lib/sisu/v6/src_share.rb | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/src_share.rb b/lib/sisu/v5/src_share.rb index e33b4340..1fff050e 100644 --- a/lib/sisu/v5/src_share.rb +++ b/lib/sisu/v5/src_share.rb @@ -75,11 +75,20 @@ module SiSU_Markup (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share document markup text source',@opt.fns).cyan_hi_blue - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share document markup text source',@opt.fns).cyan_title_hi + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Share document markup text source', + @opt.fns + ).cyan_hi_blue + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Share document markup text source', + @opt.fns + ).cyan_title_hi end if FileTest.directory?(@path_pod[:fnb]) - FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir) + FileUtils::mkdir_p(@file.output_path.src.dir) \ + unless FileTest.directory?(@file.output_path.src.dir) v=(@opt.act[:maintenance][:set]==:on) \ ? 'v' : '' system(%{ diff --git a/lib/sisu/v6/src_share.rb b/lib/sisu/v6/src_share.rb index f2454550..a94a1a8c 100644 --- a/lib/sisu/v6/src_share.rb +++ b/lib/sisu/v6/src_share.rb @@ -75,11 +75,20 @@ module SiSU_Markup (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share document markup text source',@opt.fns).cyan_hi_blue - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share document markup text source',@opt.fns).cyan_title_hi + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Share document markup text source', + @opt.fns + ).cyan_hi_blue + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Share document markup text source', + @opt.fns + ).cyan_title_hi end if FileTest.directory?(@path_pod[:fnb]) - FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir) + FileUtils::mkdir_p(@file.output_path.src.dir) \ + unless FileTest.directory?(@file.output_path.src.dir) v=(@opt.act[:maintenance][:set]==:on) \ ? 'v' : '' system(%{ -- cgit v1.2.3 From 7222b36020f045a039580d09e32bb1dcaeda733d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:38:33 -0400 Subject: v5 v6: src, sisupod, bring back in line --- lib/sisu/v5/src_shared.rb | 16 +++++++++------- lib/sisu/v6/src_shared.rb | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/src_shared.rb b/lib/sisu/v5/src_shared.rb index a4b3a974..03d902fd 100644 --- a/lib/sisu/v5/src_shared.rb +++ b/lib/sisu/v5/src_shared.rb @@ -245,7 +245,7 @@ module SiSU_Source %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} end else - if FileTest.file?("#{@opt.base_path}/#{f[:f]}") + if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}") cpy= :no cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/ @@ -256,12 +256,12 @@ module SiSU_Source else :no end if cpy == :yes - FileUtils::cp("#{@opt.base_path}/#{f[:f]}", + FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", "#{@path_pod[:doc]}/#{f[:n]}") end else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} end end end @@ -272,9 +272,11 @@ module SiSU_Source SiSU_Env::InfoEnv.new.sisupod_v4(@opt) end def ssm_doc_import_list(f) - if @opt.fno =~/\.ssm$/ + if @opt.fno =~/\.ss[mi]$/ doc_import_list=[] - doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import + if f =~@rgx_doc_import + doc_import_list << f.scan(@rgx_doc_import) + end doc_import_list.flatten.each do |i| if i =~/.ssi/ file_array=IO.readlines(i,'') @@ -286,11 +288,11 @@ module SiSU_Source end def pod_source_build(file_array) @pwd=Dir.pwd - @rgx_doc_import_list=/^<<\s*(\S+?\.ss[ti])/ + @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ doc_import_list=[] file_array.each do |f| #% work area if f !~/^%+\s/ - if @opt.fno =~/\.ssm$/ + if @opt.fno =~/\.ss[mi]$/ @doc_import_list << ssm_doc_import_list(f) doc_import_list=@doc_import_list.flatten.uniq end diff --git a/lib/sisu/v6/src_shared.rb b/lib/sisu/v6/src_shared.rb index cee7e1c5..495cc584 100644 --- a/lib/sisu/v6/src_shared.rb +++ b/lib/sisu/v6/src_shared.rb @@ -245,7 +245,7 @@ module SiSU_Source %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} end else - if FileTest.file?("#{@opt.base_path}/#{f[:f]}") + if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}") cpy= :no cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \ or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/ @@ -256,12 +256,12 @@ module SiSU_Source else :no end if cpy == :yes - FileUtils::cp("#{@opt.base_path}/#{f[:f]}", + FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", "#{@path_pod[:doc]}/#{f[:n]}") end else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} end end end @@ -272,9 +272,11 @@ module SiSU_Source SiSU_Env::InfoEnv.new.sisupod_v4(@opt) end def ssm_doc_import_list(f) - if @opt.fno =~/\.ssm$/ + if @opt.fno =~/\.ss[mi]$/ doc_import_list=[] - doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import + if f =~@rgx_doc_import + doc_import_list << f.scan(@rgx_doc_import) + end doc_import_list.flatten.each do |i| if i =~/.ssi/ file_array=IO.readlines(i,'') @@ -286,11 +288,11 @@ module SiSU_Source end def pod_source_build(file_array) @pwd=Dir.pwd - @rgx_doc_import_list=/^<<\s*(\S+?\.ss[ti])/ + @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ doc_import_list=[] file_array.each do |f| #% work area if f !~/^%+\s/ - if @opt.fno =~/\.ssm$/ + if @opt.fno =~/\.ss[mi]$/ @doc_import_list << ssm_doc_import_list(f) doc_import_list=@doc_import_list.flatten.uniq end -- cgit v1.2.3 From 84fcc4fb34a41303b4e87aec0e486ec5c3864b64 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:41:30 -0400 Subject: v5 v6: docbook, code & other blocks markup --- lib/sisu/v5/xml_docbook5.rb | 5 ++++- lib/sisu/v5/xml_shared.rb | 5 ++++- lib/sisu/v6/xml_docbook5.rb | 5 ++++- lib/sisu/v6/xml_shared.rb | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 3a59f839..7326c332 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -163,7 +163,10 @@ module SiSU_XML_Docbook_Book end def markup_text(data) data.each_with_index do |o,i| - if o.is ==:heading || o.is ==:para || o.is ==:open_close_tags + if o.is ==:heading \ + || o.is ==:para \ + || o.of ==:block \ + || o.is ==:open_close_tags o=@trans.markup_docbook(o) #unless o.obj==nil end end diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index f1113495..5670f68d 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -485,7 +485,10 @@ module SiSU_XML_Munge gsub(/#{Mx[:nbsp]}/,' '). #  not available gsub(/<(p|br)>/,'<\1 />') dob.obj=clean(dob.obj) - else # codeblock + elsif dob.is == :code + dob.obj=dob.obj.gsub(/&/m,'&'). #sort + gsub(//,'>') + else # p dob.is ?? end dob end diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index b3e9e035..a1854cdb 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -163,7 +163,10 @@ module SiSU_XML_Docbook_Book end def markup_text(data) data.each_with_index do |o,i| - if o.is ==:heading || o.is ==:para || o.is ==:open_close_tags + if o.is ==:heading \ + || o.is ==:para \ + || o.of ==:block \ + || o.is ==:open_close_tags o=@trans.markup_docbook(o) #unless o.obj==nil end end diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index 3e8ddf50..8f4024eb 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -485,7 +485,10 @@ module SiSU_XML_Munge gsub(/#{Mx[:nbsp]}/,' '). #  not available gsub(/<(p|br)>/,'<\1 />') dob.obj=clean(dob.obj) - else # codeblock + elsif dob.is == :code + dob.obj=dob.obj.gsub(/&/m,'&'). #sort + gsub(//,'>') + else # p dob.is ?? end dob end -- cgit v1.2.3 From 8a09a5fc3705ec645c92d7f271db5027f0656b15 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:42:44 -0400 Subject: v5 v6: docbook, url links, urls --- lib/sisu/v5/xml_shared.rb | 5 ++++- lib/sisu/v6/xml_shared.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index 5670f68d..423044bc 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -479,7 +479,10 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). - gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, + '\1'). + gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, + '\1'). gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available gsub(/#{Mx[:nbsp]}/,' '). #  not available diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index 8f4024eb..cef46c92 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -479,7 +479,10 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). - gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). + gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, + '\1'). + gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, + '\1'). gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available gsub(/#{Mx[:nbsp]}/,' '). #  not available -- cgit v1.2.3 From 796915d87286c37d6217ce098c442e9e59e0cd69 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:44:28 -0400 Subject: v5 v6: docbook, images, and adjustment --- lib/sisu/v5/xml_shared.rb | 4 ++-- lib/sisu/v6/xml_shared.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index 423044bc..77df1a30 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -477,8 +477,8 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd - gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, - %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). + gsub(/#{Mx[:lnk_o]}\s*(\S+?)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, + %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). # common image location, else use ./images gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, '\1'). gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index cef46c92..38c21802 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -477,8 +477,8 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). # tt, kbd - gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, - %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). + gsub(/#{Mx[:lnk_o]}\s*(\S+?)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, + %{#{Xx[:split]}:spaces0:
\n:spaces1:\n:spaces1:\n:spaces0:
#{Xx[:split]}}). # common image location, else use ./images gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, '\1'). gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, -- cgit v1.2.3 From d8917347b5dbadd17510c417bedd2fbf61dbf67c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:48:40 -0400 Subject: v5 v6: docbook, css (needs work), also doc header, sisu processing info --- lib/sisu/v5/css.rb | 9 ++++++++- lib/sisu/v5/sysenv.rb | 17 ++++++++++++++--- lib/sisu/v5/xml_docbook5.rb | 4 ++++ lib/sisu/v6/css.rb | 9 ++++++++- lib/sisu/v6/sysenv.rb | 17 ++++++++++++++--- lib/sisu/v6/xml_docbook5.rb | 4 ++++ 6 files changed, 52 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb index 676290d8..50e80f5b 100644 --- a/lib/sisu/v5/css.rb +++ b/lib/sisu/v5/css.rb @@ -104,6 +104,8 @@ module SiSU_Style css_path.xml_sax when 'xml_dom' css_path.xml_dom + when 'xml_docbook' + css_path.xml_docbook else css_embed_content.html end @@ -150,6 +152,11 @@ module SiSU_Style style << css.xml_dom style.close css_path.xml_dom + when 'xml_docbook' + style=File.new("#{css_pth}/#{@fn_css.xml_docbook}",'w') + style << css.xml_docbook + style.close + css_path.xml_docbook end end end @@ -3122,7 +3129,7 @@ WOK br { display: block; } WOK end - def docbook_xml #stylesheet for docbook + def xml_docbook #stylesheet for docbook <} end + def xml_docbook + stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_docbook}" + %{} + end end class CreateSite < InfoEnv require_relative 'css' # css.rb @@ -7187,6 +7191,13 @@ WOK style.close end if @cmd =~/C/ \ + or (@cmd =~/[xX]/ \ + and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) + style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') + style << css.xml_docbook + style.close + end + if @cmd =~/C/ \ or (@cmd =~/[b]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 7326c332..1ff3a96d 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -154,8 +154,12 @@ module SiSU_XML_Docbook_Book puts line if @md.opt.act[:verbose_plus][:set]==:on end def head + rdf=SiSU_XML_Tags::RDF.new(@md) + stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_docbook').stylesheet <<-WOK +#{stylesheet.css_head_xml} +#{rdf.comment_xml} diff --git a/lib/sisu/v6/css.rb b/lib/sisu/v6/css.rb index 81cb115b..d4363306 100644 --- a/lib/sisu/v6/css.rb +++ b/lib/sisu/v6/css.rb @@ -104,6 +104,8 @@ module SiSU_Style css_path.xml_sax when 'xml_dom' css_path.xml_dom + when 'xml_docbook' + css_path.xml_docbook else css_embed_content.html end @@ -150,6 +152,11 @@ module SiSU_Style style << css.xml_dom style.close css_path.xml_dom + when 'xml_docbook' + style=File.new("#{css_pth}/#{@fn_css.xml_docbook}",'w') + style << css.xml_docbook + style.close + css_path.xml_docbook end end end @@ -3122,7 +3129,7 @@ WOK br { display: block; } WOK end - def docbook_xml #stylesheet for docbook + def xml_docbook #stylesheet for docbook <} end + def xml_docbook + stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_docbook}" + %{} + end end class CreateSite < InfoEnv require_relative 'css' # css.rb @@ -7187,6 +7191,13 @@ WOK style.close end if @cmd =~/C/ \ + or (@cmd =~/[xX]/ \ + and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) + style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') + style << css.xml_docbook + style.close + end + if @cmd =~/C/ \ or (@cmd =~/[b]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index a1854cdb..fb1ec342 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -154,8 +154,12 @@ module SiSU_XML_Docbook_Book puts line if @md.opt.act[:verbose_plus][:set]==:on end def head + rdf=SiSU_XML_Tags::RDF.new(@md) + stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_docbook').stylesheet <<-WOK +#{stylesheet.css_head_xml} +#{rdf.comment_xml} -- cgit v1.2.3 From 99f57f7e7b5c591acfa6e27f9b49d0b6b27d3d46 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:50:12 -0400 Subject: v5 v6: docbook, status, under construction notice removed (still much to do) --- lib/sisu/v5/sysenv.rb | 4 ++-- lib/sisu/v6/sysenv.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 5c399564..13aba203 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -6315,7 +6315,7 @@ WOK end def xml_docbook def ft - 'docbook' + DEVELOPER[:under_construction] + 'docbook' end def dir set_path(ft).dir.abc @@ -6363,7 +6363,7 @@ WOK end def xml_docbook_book def ft - 'docbook' + DEVELOPER[:under_construction] + 'docbook' end def dir set_path(ft).dir.abc diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 27927edd..0a1df86e 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -6315,7 +6315,7 @@ WOK end def xml_docbook def ft - 'docbook' + DEVELOPER[:under_construction] + 'docbook' end def dir set_path(ft).dir.abc @@ -6363,7 +6363,7 @@ WOK end def xml_docbook_book def ft - 'docbook' + DEVELOPER[:under_construction] + 'docbook' end def dir set_path(ft).dir.abc -- cgit v1.2.3 From 3a3037c4a06759a752c60c715f9ccae8c219c7b0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:52:57 -0400 Subject: v5 v6: base images & css --- lib/sisu/v5/conf.rb | 73 +++++++++++++++++++++++++++++++++++++-------------- lib/sisu/v5/css.rb | 6 ++--- lib/sisu/v5/html.rb | 1 + lib/sisu/v5/sysenv.rb | 23 +++++++++++----- lib/sisu/v6/conf.rb | 73 +++++++++++++++++++++++++++++++++++++-------------- lib/sisu/v6/css.rb | 6 ++--- lib/sisu/v6/html.rb | 1 + lib/sisu/v6/sysenv.rb | 23 +++++++++++----- 8 files changed, 148 insertions(+), 58 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index 1365a90e..b13b4bb1 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -86,46 +86,81 @@ module SiSU_Initialize def initialize(opt) @opt=opt @env=SiSU_Env::InfoEnv.new(@opt.fns) - @suffix,@path={},{} - @suffix[:rnc]='rnc' - @suffix[:rng]='rng' - @suffix[:xsd]='xsd' - @path[:xml]= @env.path.output + '/_sisu/xml' - @path[:xsd]= @env.path.output + '/_sisu/xml/xsd' - @path[:rnc]= @env.path.output + '/_sisu/xml/rnc' - @path[:rng]= @env.path.output + '/_sisu/xml/rng' + @suffix={ + rnc: 'rnc', + rng: 'rng', + xsd: 'xsd', + } + @path={ + xml: @env.path.output + '/_sisu/xml', + xsd: @env.path.output + '/_sisu/xml/xsd', + rnc: @env.path.output + '/_sisu/xml/rnc', + rng: @env.path.output + '/_sisu/xml/rng', + style: @env.path.output + '/' + @env.path.style, + } @pwd,@home=Dir.pwd,@env.path.home end def make_homepage - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Make homepage','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Make homepage', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).homepage end def cp_local_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy images','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy images', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html end def cp_external_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy external images','').colorize if @opt.act[:verbose_plus][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy external images', + '' + ).colorize if @opt.act[:verbose_plus][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images end def cp_webserver_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy webserver/output file images','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy webserver/output file images', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images end def css - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring CSSs','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Configuring CSSs', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_css end def dtd - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring DTDs','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Configuring DTDs', + '' + ).colorize unless @opt.act[:quiet][:set]==:on @rxng=SiSU_Relaxng::RelaxNG.new - @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) } + @path.each { |d| FileUtils::mkdir_p(d[1]) \ + unless FileTest.directory?(d[1]) } #ugly code, sort later if @rxng.methods.join =~/[^_]dtd_sax\b/ if @rxng.dtd_sax.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_sax}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w') dtd << @rxng.dtd_sax dtd.close else trang_rnc_model_output_sax @@ -134,7 +169,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_dom\b/ if @rxng.dtd_dom.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_dom}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w') dtd << @rxng.dtd_dom dtd.close else trang_rnc_model_output_dom @@ -143,7 +178,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_node\b/ if @rxng.dtd_node.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.input_node}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w') dtd << @rxng.dtd_node dtd.close else trang_rnc_model_input_node @@ -152,7 +187,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_xhtml\b/ if @rxng.dtd_xhtml.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_xhtml}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w') dtd << @rxng.dtd_xhtml dtd.close else trang_rnc_model_output_xhtml diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb index 50e80f5b..d9b2aa8c 100644 --- a/lib/sisu/v5/css.rb +++ b/lib/sisu/v5/css.rb @@ -1255,7 +1255,7 @@ WOK } li { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; } ul { @@ -1280,7 +1280,7 @@ WOK text-align: left; } li.doc { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; padding-left: 16px; margin-left: 10px; margin-right: 0px; @@ -1292,7 +1292,7 @@ WOK color: #777777; } li.refcenter { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; padding-left: 20px; margin-left: 10%; font-size: 9px; diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 4a911d2c..d1ee22e5 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -90,6 +90,7 @@ module SiSU_HTML songsheet ensure SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images end end def songsheet diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 13aba203..bca188d3 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -7128,8 +7128,13 @@ WOK end end def cp_css - FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}") - css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN + FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") \ + unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}") + css_path=[ + '/etc/sisu/css', + "#{@home}/.sisu/css", + "#{@pwd}/_sisu/css", + ] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ @@ -7146,7 +7151,11 @@ WOK FileUtils::cd(@pwd) end end - else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/ + else + SiSU_Screen::Ansi.new( + @cmd, + "*WARN* modify css is not set or is set to: false" + ).warn if @cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new @@ -7178,28 +7187,28 @@ WOK end if @cmd =~/C/ \ or (@cmd =~/[x]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) style=File.new("#{path_style}/#{fn_css.xml_sax}",'w') style << css.xml_sax style.close end if @cmd =~/C/ \ or (@cmd =~/[X]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) style=File.new("#{path_style}/#{fn_css.xml_dom}",'w') style << css.xml_dom style.close end if @cmd =~/C/ \ or (@cmd =~/[xX]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') style << css.xml_docbook style.close end if @cmd =~/C/ \ or (@cmd =~/[b]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) + and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') style << css.xhtml style.close diff --git a/lib/sisu/v6/conf.rb b/lib/sisu/v6/conf.rb index c2333191..8795d8d3 100644 --- a/lib/sisu/v6/conf.rb +++ b/lib/sisu/v6/conf.rb @@ -86,46 +86,81 @@ module SiSU_Initialize def initialize(opt) @opt=opt @env=SiSU_Env::InfoEnv.new(@opt.fns) - @suffix,@path={},{} - @suffix[:rnc]='rnc' - @suffix[:rng]='rng' - @suffix[:xsd]='xsd' - @path[:xml]= @env.path.output + '/_sisu/xml' - @path[:xsd]= @env.path.output + '/_sisu/xml/xsd' - @path[:rnc]= @env.path.output + '/_sisu/xml/rnc' - @path[:rng]= @env.path.output + '/_sisu/xml/rng' + @suffix={ + rnc: 'rnc', + rng: 'rng', + xsd: 'xsd', + } + @path={ + xml: @env.path.output + '/_sisu/xml', + xsd: @env.path.output + '/_sisu/xml/xsd', + rnc: @env.path.output + '/_sisu/xml/rnc', + rng: @env.path.output + '/_sisu/xml/rng', + style: @env.path.output + '/' + @env.path.style, + } @pwd,@home=Dir.pwd,@env.path.home end def make_homepage - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Make homepage','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Make homepage', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).homepage end def cp_local_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy images','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy images', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html end def cp_external_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy external images','').colorize if @opt.act[:verbose_plus][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy external images', + '' + ).colorize if @opt.act[:verbose_plus][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images end def cp_webserver_images - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy webserver/output file images','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Copy webserver/output file images', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images end def css - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring CSSs','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Configuring CSSs', + '' + ).colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_css end def dtd - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring DTDs','').colorize unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'invert', + 'Configuring DTDs', + '' + ).colorize unless @opt.act[:quiet][:set]==:on @rxng=SiSU_Relaxng::RelaxNG.new - @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) } + @path.each { |d| FileUtils::mkdir_p(d[1]) \ + unless FileTest.directory?(d[1]) } #ugly code, sort later if @rxng.methods.join =~/[^_]dtd_sax\b/ if @rxng.dtd_sax.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_sax}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w') dtd << @rxng.dtd_sax dtd.close else trang_rnc_model_output_sax @@ -134,7 +169,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_dom\b/ if @rxng.dtd_dom.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_dom}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w') dtd << @rxng.dtd_dom dtd.close else trang_rnc_model_output_dom @@ -143,7 +178,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_node\b/ if @rxng.dtd_node.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.input_node}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w') dtd << @rxng.dtd_node dtd.close else trang_rnc_model_input_node @@ -152,7 +187,7 @@ module SiSU_Initialize end if @rxng.methods.join =~/[^_]dtd_xhtml\b/ if @rxng.dtd_xhtml.length > 200 - dtd=File.new("#{@env.path.output}/#{@env.path.style}/#{@rxng.rng_name.output_xhtml}",'w') + dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w') dtd << @rxng.dtd_xhtml dtd.close else trang_rnc_model_output_xhtml diff --git a/lib/sisu/v6/css.rb b/lib/sisu/v6/css.rb index d4363306..b59458ee 100644 --- a/lib/sisu/v6/css.rb +++ b/lib/sisu/v6/css.rb @@ -1255,7 +1255,7 @@ WOK } li { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; } ul { @@ -1280,7 +1280,7 @@ WOK text-align: left; } li.doc { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; padding-left: 16px; margin-left: 10px; margin-right: 0px; @@ -1292,7 +1292,7 @@ WOK color: #777777; } li.refcenter { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + background: url(../image_sys/bullet_09.png) no-repeat 0px 6px; padding-left: 20px; margin-left: 10%; font-size: 9px; diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 8c9869e2..82d096f2 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -90,6 +90,7 @@ module SiSU_HTML songsheet ensure SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images end end def songsheet diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 0a1df86e..902cedfb 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -7128,8 +7128,13 @@ WOK end end def cp_css - FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}") - css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN + FileUtils::mkdir_p("#{@env.path.output}/#{@env.path.style}") \ + unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}") + css_path=[ + '/etc/sisu/css', + "#{@home}/.sisu/css", + "#{@pwd}/_sisu/css", + ] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ @@ -7146,7 +7151,11 @@ WOK FileUtils::cd(@pwd) end end - else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/ + else + SiSU_Screen::Ansi.new( + @cmd, + "*WARN* modify css is not set or is set to: false" + ).warn if @cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new @@ -7178,28 +7187,28 @@ WOK end if @cmd =~/C/ \ or (@cmd =~/[x]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) style=File.new("#{path_style}/#{fn_css.xml_sax}",'w') style << css.xml_sax style.close end if @cmd =~/C/ \ or (@cmd =~/[X]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) style=File.new("#{path_style}/#{fn_css.xml_dom}",'w') style << css.xml_dom style.close end if @cmd =~/C/ \ or (@cmd =~/[xX]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) + and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') style << css.xml_docbook style.close end if @cmd =~/C/ \ or (@cmd =~/[b]/ \ - and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) + and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') style << css.xhtml style.close -- cgit v1.2.3 From 3628703f6688b7c7c8436f97e7aeea1883dd4b28 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:59:40 -0400 Subject: v5 v6: base images & css, continue --- lib/sisu/v5/conf.rb | 14 +++++++------- lib/sisu/v5/harvest.rb | 2 +- lib/sisu/v5/html.rb | 6 +++--- lib/sisu/v5/html_concordance.rb | 2 +- lib/sisu/v5/html_segments.rb | 4 ++-- lib/sisu/v5/manifest.rb | 2 +- lib/sisu/v5/sysenv.rb | 34 +++++++++++++++++----------------- lib/sisu/v5/xhtml.rb | 2 +- lib/sisu/v5/xml_docbook5.rb | 2 ++ lib/sisu/v5/xml_dom.rb | 2 +- lib/sisu/v5/xml_sax.rb | 2 +- lib/sisu/v6/conf.rb | 14 +++++++------- lib/sisu/v6/harvest.rb | 2 +- lib/sisu/v6/html.rb | 6 +++--- lib/sisu/v6/html_concordance.rb | 2 +- lib/sisu/v6/html_segments.rb | 4 ++-- lib/sisu/v6/manifest.rb | 2 +- lib/sisu/v6/sysenv.rb | 34 +++++++++++++++++----------------- lib/sisu/v6/xhtml.rb | 2 +- lib/sisu/v6/xml_docbook5.rb | 2 ++ lib/sisu/v6/xml_dom.rb | 2 +- lib/sisu/v6/xml_sax.rb | 2 +- 22 files changed, 74 insertions(+), 70 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index b13b4bb1..04ac5cfa 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -107,7 +107,7 @@ module SiSU_Initialize 'Make homepage', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).homepage + SiSU_Env::CreateSite.new(@opt).homepage end def cp_local_images SiSU_Screen::Ansi.new( @@ -116,9 +116,9 @@ module SiSU_Initialize 'Copy images', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images - SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary - SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html + SiSU_Env::CreateSite.new(@opt).cp_local_images + SiSU_Env::CreateSite.new(@opt).cp_webserver_images_local #this should not have been necessary + SiSU_Env::CreateSite.new(@opt).cp_base_images #base images (nav etc.) used by all html end def cp_external_images SiSU_Screen::Ansi.new( @@ -127,7 +127,7 @@ module SiSU_Initialize 'Copy external images', '' ).colorize if @opt.act[:verbose_plus][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images + SiSU_Env::CreateSite.new(@opt).cp_external_images end def cp_webserver_images SiSU_Screen::Ansi.new( @@ -136,7 +136,7 @@ module SiSU_Initialize 'Copy webserver/output file images', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images + SiSU_Env::CreateSite.new(@opt).cp_webserver_images end def css SiSU_Screen::Ansi.new( @@ -145,7 +145,7 @@ module SiSU_Initialize 'Configuring CSSs', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end def dtd SiSU_Screen::Ansi.new( diff --git a/lib/sisu/v5/harvest.rb b/lib/sisu/v5/harvest.rb index 6c9b144f..053df905 100644 --- a/lib/sisu/v5/harvest.rb +++ b/lib/sisu/v5/harvest.rb @@ -81,7 +81,7 @@ module SiSU_Harvest cases(@opt,@env) rescue ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end def help diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index d1ee22e5..3258a0e5 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -89,8 +89,8 @@ module SiSU_HTML begin songsheet ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css - SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images + SiSU_Env::CreateSite.new(@opt).cp_css + SiSU_Env::CreateSite.new(@opt).cp_base_images end end def songsheet @@ -177,7 +177,7 @@ module SiSU_HTML @links_guide_toc=[] def initialize(data,md) @data,@md=data,md - @links_guide_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_quick_ref? + @links_guide_=SiSU_Env::CreateSite.new(@md.opt).html_quick_ref? end def toc @links_guide_toc=[] diff --git a/lib/sisu/v5/html_concordance.rb b/lib/sisu/v5/html_concordance.rb index b9030123..cf10e001 100644 --- a/lib/sisu/v5/html_concordance.rb +++ b/lib/sisu/v5/html_concordance.rb @@ -108,7 +108,7 @@ module SiSU_Concordance __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 7a368b9d..12101b67 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -68,7 +68,7 @@ module SiSU_HTML_Seg class Output def initialize(md,outputfile,seg,minitoc,type='') @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type - @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? + @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner? @file=SiSU_Env::FileOp.new(@md) @make=SiSU_Env::ProcessingSettings.new(@md) @cl=(@make.build.html_minitoc?) \ @@ -166,7 +166,7 @@ module SiSU_HTML_Seg else @cl='content' end if @md - @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? + @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner? end end def songsheet diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index e1b6ce80..3216194d 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -106,7 +106,7 @@ module SiSU_Manifest __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index bca188d3..324f96e0 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -7037,8 +7037,8 @@ WOK class CreateSite < InfoEnv require_relative 'css' # css.rb include SiSU_Style - def initialize(cmd) - @cmd=cmd + def initialize(opt) + @opt=opt @env=SiSU_Env::InfoEnv.new @init=SiSU_Env::GetInit.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd @@ -7137,7 +7137,7 @@ WOK ] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ + SiSU_Screen::Ansi.new(@opt.cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @opt.cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) FileUtils::cd(x) @@ -7153,61 +7153,61 @@ WOK end else SiSU_Screen::Ansi.new( - @cmd, + @opt.cmd, "*WARN* modify css is not set or is set to: false" - ).warn if @cmd=~/[MV]/ + ).warn if @opt.cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new path_style="#{@env.path.output}/#{@env.path.style}" FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style) - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.homepage}") style=File.new("#{path_style}/#{fn_css.homepage}",'w') style << css.homepage style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.html_tables}") style=File.new("#{path_style}/#{fn_css.html_tables}",'w') style << css.html_tables style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.html}") style=File.new("#{path_style}/#{fn_css.html}",'w') style << css.html style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.harvest}") style=File.new("#{path_style}/#{fn_css.harvest}",'w') style << css.harvest style.close end - if @cmd =~/C/ \ - or (@cmd =~/[x]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[x]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) style=File.new("#{path_style}/#{fn_css.xml_sax}",'w') style << css.xml_sax style.close end - if @cmd =~/C/ \ - or (@cmd =~/[X]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[X]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) style=File.new("#{path_style}/#{fn_css.xml_dom}",'w') style << css.xml_dom style.close end - if @cmd =~/C/ \ - or (@cmd =~/[xX]/ \ + if @opt.cmd =~/C/ \ + or (@opt.act[:xml_docbook_book][:set] == :on \ and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') style << css.xml_docbook style.close end - if @cmd =~/C/ \ - or (@cmd =~/[b]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[b]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') style << css.xhtml diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 0e0d7781..ad6d3f0e 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -108,7 +108,7 @@ module SiSU_XHTML __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 1ff3a96d..0fb6ee8d 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -87,6 +87,8 @@ module SiSU_XML_Docbook_Book __LINE__.to_s + ':' + __FILE__ end ensure + #SiSU_Env::CreateSite.new(@opt.cmd).cp_css + #SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images end end private diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index c8f3d881..a1b316ac 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -109,7 +109,7 @@ module SiSU_XML_DOM __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v5/xml_sax.rb b/lib/sisu/v5/xml_sax.rb index 1554056b..69a5962d 100644 --- a/lib/sisu/v5/xml_sax.rb +++ b/lib/sisu/v5/xml_sax.rb @@ -109,7 +109,7 @@ module SiSU_XML_SAX end ensure #file closed in songsheet - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v6/conf.rb b/lib/sisu/v6/conf.rb index 8795d8d3..b3a5375e 100644 --- a/lib/sisu/v6/conf.rb +++ b/lib/sisu/v6/conf.rb @@ -107,7 +107,7 @@ module SiSU_Initialize 'Make homepage', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).homepage + SiSU_Env::CreateSite.new(@opt).homepage end def cp_local_images SiSU_Screen::Ansi.new( @@ -116,9 +116,9 @@ module SiSU_Initialize 'Copy images', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images - SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary - SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html + SiSU_Env::CreateSite.new(@opt).cp_local_images + SiSU_Env::CreateSite.new(@opt).cp_webserver_images_local #this should not have been necessary + SiSU_Env::CreateSite.new(@opt).cp_base_images #base images (nav etc.) used by all html end def cp_external_images SiSU_Screen::Ansi.new( @@ -127,7 +127,7 @@ module SiSU_Initialize 'Copy external images', '' ).colorize if @opt.act[:verbose_plus][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images + SiSU_Env::CreateSite.new(@opt).cp_external_images end def cp_webserver_images SiSU_Screen::Ansi.new( @@ -136,7 +136,7 @@ module SiSU_Initialize 'Copy webserver/output file images', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images + SiSU_Env::CreateSite.new(@opt).cp_webserver_images end def css SiSU_Screen::Ansi.new( @@ -145,7 +145,7 @@ module SiSU_Initialize 'Configuring CSSs', '' ).colorize unless @opt.act[:quiet][:set]==:on - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end def dtd SiSU_Screen::Ansi.new( diff --git a/lib/sisu/v6/harvest.rb b/lib/sisu/v6/harvest.rb index 9dfc34d2..be0efe1a 100644 --- a/lib/sisu/v6/harvest.rb +++ b/lib/sisu/v6/harvest.rb @@ -81,7 +81,7 @@ module SiSU_Harvest cases(@opt,@env) rescue ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end def help diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 82d096f2..789f2b1c 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -89,8 +89,8 @@ module SiSU_HTML begin songsheet ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css - SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images + SiSU_Env::CreateSite.new(@opt).cp_css + SiSU_Env::CreateSite.new(@opt).cp_base_images end end def songsheet @@ -177,7 +177,7 @@ module SiSU_HTML @links_guide_toc=[] def initialize(data,md) @data,@md=data,md - @links_guide_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_quick_ref? + @links_guide_=SiSU_Env::CreateSite.new(@md.opt).html_quick_ref? end def toc @links_guide_toc=[] diff --git a/lib/sisu/v6/html_concordance.rb b/lib/sisu/v6/html_concordance.rb index b94949b9..5747deea 100644 --- a/lib/sisu/v6/html_concordance.rb +++ b/lib/sisu/v6/html_concordance.rb @@ -108,7 +108,7 @@ module SiSU_Concordance __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb index 0586cdf6..0ba5f688 100644 --- a/lib/sisu/v6/html_segments.rb +++ b/lib/sisu/v6/html_segments.rb @@ -68,7 +68,7 @@ module SiSU_HTML_Seg class Output def initialize(md,outputfile,seg,minitoc,type='') @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type - @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? + @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner? @file=SiSU_Env::FileOp.new(@md) @make=SiSU_Env::ProcessingSettings.new(@md) @cl=(@make.build.html_minitoc?) \ @@ -166,7 +166,7 @@ module SiSU_HTML_Seg else @cl='content' end if @md - @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? + @title_banner_=SiSU_Env::CreateSite.new(@md.opt).html_seg_title_banner? end end def songsheet diff --git a/lib/sisu/v6/manifest.rb b/lib/sisu/v6/manifest.rb index 27b90eda..7f90636b 100644 --- a/lib/sisu/v6/manifest.rb +++ b/lib/sisu/v6/manifest.rb @@ -106,7 +106,7 @@ module SiSU_Manifest __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 902cedfb..f1b69edc 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -7037,8 +7037,8 @@ WOK class CreateSite < InfoEnv require_relative 'css' # css.rb include SiSU_Style - def initialize(cmd) - @cmd=cmd + def initialize(opt) + @opt=opt @env=SiSU_Env::InfoEnv.new @init=SiSU_Env::GetInit.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd @@ -7137,7 +7137,7 @@ WOK ] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ + SiSU_Screen::Ansi.new(@opt.cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @opt.cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) FileUtils::cd(x) @@ -7153,61 +7153,61 @@ WOK end else SiSU_Screen::Ansi.new( - @cmd, + @opt.cmd, "*WARN* modify css is not set or is set to: false" - ).warn if @cmd=~/[MV]/ + ).warn if @opt.cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new path_style="#{@env.path.output}/#{@env.path.style}" FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style) - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.homepage}") style=File.new("#{path_style}/#{fn_css.homepage}",'w') style << css.homepage style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.html_tables}") style=File.new("#{path_style}/#{fn_css.html_tables}",'w') style << css.html_tables style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.html}") style=File.new("#{path_style}/#{fn_css.html}",'w') style << css.html style.close end - if @cmd =~/C/ \ + if @opt.cmd =~/C/ \ or not FileTest.file?("#{path_style}/#{fn_css.harvest}") style=File.new("#{path_style}/#{fn_css.harvest}",'w') style << css.harvest style.close end - if @cmd =~/C/ \ - or (@cmd =~/[x]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[x]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) style=File.new("#{path_style}/#{fn_css.xml_sax}",'w') style << css.xml_sax style.close end - if @cmd =~/C/ \ - or (@cmd =~/[X]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[X]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) style=File.new("#{path_style}/#{fn_css.xml_dom}",'w') style << css.xml_dom style.close end - if @cmd =~/C/ \ - or (@cmd =~/[xX]/ \ + if @opt.cmd =~/C/ \ + or (@opt.act[:xml_docbook_book][:set] == :on \ and not FileTest.file?("#{path_style}/#{fn_css.xml_docbook}")) style=File.new("#{path_style}/#{fn_css.xml_docbook}",'w') style << css.xml_docbook style.close end - if @cmd =~/C/ \ - or (@cmd =~/[b]/ \ + if @opt.cmd =~/C/ \ + or (@opt.cmd =~/[b]/ \ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) style=File.new("#{path_style}/#{fn_css.xhtml}",'w') style << css.xhtml diff --git a/lib/sisu/v6/xhtml.rb b/lib/sisu/v6/xhtml.rb index 57962961..44b20198 100644 --- a/lib/sisu/v6/xhtml.rb +++ b/lib/sisu/v6/xhtml.rb @@ -108,7 +108,7 @@ module SiSU_XHTML __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index fb1ec342..3baa21d9 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -87,6 +87,8 @@ module SiSU_XML_Docbook_Book __LINE__.to_s + ':' + __FILE__ end ensure + #SiSU_Env::CreateSite.new(@opt.cmd).cp_css + #SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images end end private diff --git a/lib/sisu/v6/xml_dom.rb b/lib/sisu/v6/xml_dom.rb index ace9e800..7960e126 100644 --- a/lib/sisu/v6/xml_dom.rb +++ b/lib/sisu/v6/xml_dom.rb @@ -109,7 +109,7 @@ module SiSU_XML_DOM __LINE__.to_s + ':' + __FILE__ end ensure - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private diff --git a/lib/sisu/v6/xml_sax.rb b/lib/sisu/v6/xml_sax.rb index 53a258dc..ee369721 100644 --- a/lib/sisu/v6/xml_sax.rb +++ b/lib/sisu/v6/xml_sax.rb @@ -109,7 +109,7 @@ module SiSU_XML_SAX end ensure #file closed in songsheet - SiSU_Env::CreateSite.new(@opt.cmd).cp_css + SiSU_Env::CreateSite.new(@opt).cp_css end end private -- cgit v1.2.3 From 4ef1c3099119cedff245acfe1ef26e5829e5bf62 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 19:02:12 -0400 Subject: v5 v6: document images (more to clean up) --- lib/sisu/v5/options.rb | 12 ++++++------ lib/sisu/v5/shared_markup_alt.rb | 7 ++++++- lib/sisu/v5/src_shared.rb | 4 +--- lib/sisu/v5/sysenv.rb | 18 ++++++++++++++---- lib/sisu/v5/utils.rb | 7 +++++++ lib/sisu/v5/xml_docbook5.rb | 22 ++++++++++++++++++++++ lib/sisu/v6/options.rb | 12 ++++++------ lib/sisu/v6/shared_markup_alt.rb | 7 ++++++- lib/sisu/v6/src_shared.rb | 4 +--- lib/sisu/v6/sysenv.rb | 18 ++++++++++++++---- lib/sisu/v6/utils.rb | 7 +++++++ lib/sisu/v6/xml_docbook5.rb | 22 ++++++++++++++++++++++ 12 files changed, 112 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index bc4d7da0..f40f0388 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -154,20 +154,20 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a,call_path) - @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path=SiSU_Utils::Path.new.base_markup(call_path) - r=Px[:lng_lst_rgx] - u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ - @base_stub=@base_path.gsub(u,'\1') + pth=SiSU_Utils::Path.new(call_path) + @base_path=pth.base_markup + @base_stub=pth.base_markup_stub + @image_src_path=pth.image_src @a=sisu_glob_rules(a) @a.freeze @make_instructions=HeaderCommon.new.sisu_document_make_instructions diff --git a/lib/sisu/v5/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index 1fb078c6..92db52f3 100644 --- a/lib/sisu/v5/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -279,7 +279,12 @@ module SiSU_TextRepresentation elsif FileTest.file?("#{@env.path.image_source_include}/#{i}") @env.path.image_source_include else - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "ERROR - image:", + %{"#{i}" missing}, + "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}" + ).error2 unless @md.opt.act[:quiet][:set]==:on nil end img_type = /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v5/src_shared.rb b/lib/sisu/v5/src_shared.rb index 03d902fd..068120f5 100644 --- a/lib/sisu/v5/src_shared.rb +++ b/lib/sisu/v5/src_shared.rb @@ -157,9 +157,7 @@ module SiSU_Source images.delete_if {|x| x =~/https?:\/\// } #images=images.sort FileUtils::mkdir_p(@path_pod[:image]) - #unattractive hard coding ... ! - image_path='_sisu/image' - images_pwd="#{@opt.base_path}/#{image_path}" + images_pwd=@opt.image_src_path ##sequence copies base images, defaults used in all html outputs #image_source_base='/usr/share/sisu/image' #dir_pwd=Dir.pwd diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 324f96e0..8d73e832 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -2716,7 +2716,11 @@ WOK else if @@local_image==true cmd=@cmd ? @cmd : '' - SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/ + SiSU_Screen::Ansi.new( + cmd, + "WARNING - no local image directory or images:", + defaults[:image_local] + ).warn unless cmd =~/q/ @@local_image=false end url.images @@ -2727,14 +2731,20 @@ WOK if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") pth="#{path.webserv}/#{@base_markup_dir_stub}" - FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") - images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 + FileUtils::mkdir_p("#{pth}/_sisu/image_external") \ + unless FileTest.directory?("#{pth}/_sisu/image_external") + images.each { |i| File.install(i,"#{pth}/#{i}") } \ + unless images.length > 0 @@image_flag=false end "#{Xx[:html_relative2]}/_sisu/image_external" else if @@local_image==true - SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ).warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new( + @cmd, + "WARNING - image directory for external images or no such images:", + :image_external + ).warn unless @cmd =~/q/ @@local_image=false end url.images_external diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 7db4143a..4d30d031 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -184,6 +184,13 @@ module SiSU_Utils m=/.+\/(?:src\/)?(\S+)/im base_markup[m,1] end + def image_src + if base_markup =~/sisupod\/doc[\/]?$/ + base_markup.gsub(/\/doc[\/]?$/,'/image') + elsif FileTest.directory?("#{base_markup}/_sisu/image") + "#{base_markup}/_sisu/image" + end + end def bmd base_markup end diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 0fb6ee8d..62b8845c 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -128,8 +128,30 @@ module SiSU_XML_Docbook_Book #extract_endnotes data=markup_text(data) structure_build_collapsed(data) + document_images if @md.ec[:image] and @md.ec[:image].length > 0 #tail end + def document_images + img_pth={ + src: @md.opt.image_src_path, + dest: @md.env.path.webserv + '/_sisu/image', + } + unless FileTest.directory?(img_pth[:dest]) + #mkdir? + end + if FileTest.directory?(img_pth[:dest]) + @md.ec[:image].each do |x| + img={ + src: "#{img_pth[:src]}/#{x}", + dest: "#{img_pth[:dest]}/#{x}", + } + if FileTest.file?(img[:src]) + FileUtils::cp(img[:src],img[:dest]) + else p "Not Found: #{img[:src]}/#{x}" + end + end + end + end def spaces Ax[:spaces] end diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index eed42e51..104243a3 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -154,20 +154,20 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a,call_path) - @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@sub_location='' + @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location='' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path=SiSU_Utils::Path.new.base_markup(call_path) - r=Px[:lng_lst_rgx] - u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ - @base_stub=@base_path.gsub(u,'\1') + pth=SiSU_Utils::Path.new(call_path) + @base_path=pth.base_markup + @base_stub=pth.base_markup_stub + @image_src_path=pth.image_src @a=sisu_glob_rules(a) @a.freeze @make_instructions=HeaderCommon.new.sisu_document_make_instructions diff --git a/lib/sisu/v6/shared_markup_alt.rb b/lib/sisu/v6/shared_markup_alt.rb index 3bf3c7e4..1586f0c2 100644 --- a/lib/sisu/v6/shared_markup_alt.rb +++ b/lib/sisu/v6/shared_markup_alt.rb @@ -279,7 +279,12 @@ module SiSU_TextRepresentation elsif FileTest.file?("#{@env.path.image_source_include}/#{i}") @env.path.image_source_include else - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "ERROR - image:", + %{"#{i}" missing}, + "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}" + ).error2 unless @md.opt.act[:quiet][:set]==:on nil end img_type = /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v6/src_shared.rb b/lib/sisu/v6/src_shared.rb index 495cc584..514e0458 100644 --- a/lib/sisu/v6/src_shared.rb +++ b/lib/sisu/v6/src_shared.rb @@ -157,9 +157,7 @@ module SiSU_Source images.delete_if {|x| x =~/https?:\/\// } #images=images.sort FileUtils::mkdir_p(@path_pod[:image]) - #unattractive hard coding ... ! - image_path='_sisu/image' - images_pwd="#{@opt.base_path}/#{image_path}" + images_pwd=@opt.image_src_path ##sequence copies base images, defaults used in all html outputs #image_source_base='/usr/share/sisu/image' #dir_pwd=Dir.pwd diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index f1b69edc..72aaf2b9 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -2716,7 +2716,11 @@ WOK else if @@local_image==true cmd=@cmd ? @cmd : '' - SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/ + SiSU_Screen::Ansi.new( + cmd, + "WARNING - no local image directory or images:", + defaults[:image_local] + ).warn unless cmd =~/q/ @@local_image=false end url.images @@ -2727,14 +2731,20 @@ WOK if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") pth="#{path.webserv}/#{@base_markup_dir_stub}" - FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") - images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 + FileUtils::mkdir_p("#{pth}/_sisu/image_external") \ + unless FileTest.directory?("#{pth}/_sisu/image_external") + images.each { |i| File.install(i,"#{pth}/#{i}") } \ + unless images.length > 0 @@image_flag=false end "#{Xx[:html_relative2]}/_sisu/image_external" else if @@local_image==true - SiSU_Screen::Ansi.new(@cmd,"WARNING - image directory for external images or no such images:", :image_external ).warn unless @cmd =~/q/ + SiSU_Screen::Ansi.new( + @cmd, + "WARNING - image directory for external images or no such images:", + :image_external + ).warn unless @cmd =~/q/ @@local_image=false end url.images_external diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 8995a860..4e7cb6e3 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -184,6 +184,13 @@ module SiSU_Utils m=/.+\/(?:src\/)?(\S+)/im base_markup[m,1] end + def image_src + if base_markup =~/sisupod\/doc[\/]?$/ + base_markup.gsub(/\/doc[\/]?$/,'/image') + elsif FileTest.directory?("#{base_markup}/_sisu/image") + "#{base_markup}/_sisu/image" + end + end def bmd base_markup end diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index 3baa21d9..f105eab9 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -128,8 +128,30 @@ module SiSU_XML_Docbook_Book #extract_endnotes data=markup_text(data) structure_build_collapsed(data) + document_images if @md.ec[:image] and @md.ec[:image].length > 0 #tail end + def document_images + img_pth={ + src: @md.opt.image_src_path, + dest: @md.env.path.webserv + '/_sisu/image', + } + unless FileTest.directory?(img_pth[:dest]) + #mkdir? + end + if FileTest.directory?(img_pth[:dest]) + @md.ec[:image].each do |x| + img={ + src: "#{img_pth[:src]}/#{x}", + dest: "#{img_pth[:dest]}/#{x}", + } + if FileTest.file?(img[:src]) + FileUtils::cp(img[:src],img[:dest]) + else p "Not Found: #{img[:src]}/#{x}" + end + end + end + end def spaces Ax[:spaces] end -- cgit v1.2.3