diff options
| author | Ralph Amissah <ralph@amissah.com> | 2014-07-15 19:03:56 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2014-07-15 19:03:56 -0400 | 
| commit | d325316ca6328472bd462cfc49e33e3ae207a512 (patch) | |
| tree | 6fac2c53e85a00ce88d79be9baa0f2c85ae40236 /lib | |
| parent | debian/changelog (5.5.0-1) (diff) | |
| parent | v5 v6: document images (more to clean up) (diff) | |
Merge tag 'sisu_5.5.1' into debian/sid
SiSU 5.5.1
Diffstat (limited to 'lib')
56 files changed, 696 insertions, 398 deletions
| 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/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/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/conf.rb b/lib/sisu/v5/conf.rb index 1365a90e..04ac5cfa 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_Env::CreateSite.new(@opt.cmd).homepage +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Make homepage', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      SiSU_Env::CreateSite.new(@opt).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_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_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Copy images', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      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(@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 +      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).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_Env::CreateSite.new(@opt.cmd).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_Env::CreateSite.new(@opt).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_Env::CreateSite.new(@opt.cmd).cp_css +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Configuring CSSs', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      SiSU_Env::CreateSite.new(@opt).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/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/css.rb b/lib/sisu/v5/css.rb index 676290d8..d9b2aa8c 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 @@ -1248,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 { @@ -1273,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; @@ -1285,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; @@ -3122,7 +3129,7 @@ WOK      br { display: block; }  WOK      end -    def docbook_xml                               #stylesheet for docbook +    def xml_docbook                               #stylesheet for docbook  <<WOK  /* SiSU css docbook.xml default style */      book { 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/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 4a911d2c..3258a0e5 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -89,7 +89,8 @@ module SiSU_HTML        begin          songsheet        ensure -        SiSU_Env::CreateSite.new(@opt.cmd).cp_css +        SiSU_Env::CreateSite.new(@opt).cp_css +        SiSU_Env::CreateSite.new(@opt).cp_base_images        end      end      def songsheet @@ -176,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/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/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/options.rb b/lib/sisu/v5/options.rb index 591bb990..f40f0388 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,21 +154,20 @@ 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,: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) -      @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=@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? -      @@sisu_call_origin_path ||=Dir.pwd -      @base_path=@@sisu_call_origin_path -      r=Px[:lng_lst_rgx] -      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -      @base_stub=@base_path.gsub(u,'\1') +      @call_path=call_path +      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/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/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_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/v5/src_shared.rb b/lib/sisu/v5/src_shared.rb index a4b3a974..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 @@ -245,7 +243,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 +254,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 +270,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 +286,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/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/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 7358ff40..8d73e832 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 @@ -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 @@ -2726,15 +2730,21 @@ WOK          if FileTest.directory?(image_external)            if @@image_flag              images=Dir.glob("#{image_external}/*.{png,jpg,gif}") -            pth="#{path.webserv}/#{@stub_pwd}" -            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 +            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            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 @@ -3497,9 +3507,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 +3554,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 +3572,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 +3601,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 +3758,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 +3784,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 +3796,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 +3821,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) @@ -6315,7 +6325,7 @@ WOK        end        def xml_docbook          def ft -         'docbook' + DEVELOPER[:under_construction] +         'docbook'          end          def dir            set_path(ft).dir.abc @@ -6363,7 +6373,7 @@ WOK        end        def xml_docbook_book          def ft -         'docbook' + DEVELOPER[:under_construction] +         'docbook'          end          def dir            set_path(ft).dir.abc @@ -6912,7 +6922,7 @@ WOK      def xml_dom        'dom.css'      end -    def docbook_xml +    def xml_docbook        'docbook.css'      end      def homepage @@ -6931,8 +6941,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 +6951,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 +6960,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 +6969,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,26 +6978,26 @@ 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 -    def docbook_xml +    def xml_docbook        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" -      else SiSU_Env::CSS_Default.new.docbook_xml +      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.xml_docbook        end      end      def homepage        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 @@ -7029,12 +7039,16 @@ WOK        stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}"        %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}      end +    def xml_docbook +      stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_docbook}" +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end    end    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 @@ -7047,8 +7061,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 +7073,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 +7102,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 +7116,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,25 +7124,30 @@ 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)        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]/ +        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) @@ -7142,53 +7161,64 @@ 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( +          @opt.cmd, +          "*WARN* modify css is not set or is set to: false" +        ).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]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) +      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]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) +      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 =~/[b]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) +      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 @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          style.close diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 9d9a3a51..4d30d031 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -174,8 +174,22 @@ 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 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 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 3a59f839..62b8845c 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 @@ -126,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 @@ -154,8 +178,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  <?xml version="1.0" encoding="utf-8"?> +#{stylesheet.css_head_xml} +#{rdf.comment_xml}  <book xmlns="http://docbook.org/ns/docbook"    xmlns:xl="http://www.w3.org/1999/xlink"    version="5.0"> @@ -163,7 +191,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_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/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index f1113495..77df1a30 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -477,15 +477,21 @@ module SiSU_XML_Munge            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').            gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # 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:<figure id="\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="images/\\1" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). -          gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). +          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:<figure id="fig-\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="../../_sisu/image/\\1.\\2" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). # common image location, else use ./images +          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, +            '<ulink url="\2">\1</ulink>'). +          gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, +            '<ulink url="\1">\1</ulink>').            gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').            gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available            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(/</,'<').gsub(/>/,'>') +      else # p dob.is ??        end        dob      end 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/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 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/conf.rb b/lib/sisu/v6/conf.rb index c2333191..b3a5375e 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_Env::CreateSite.new(@opt.cmd).homepage +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Make homepage', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      SiSU_Env::CreateSite.new(@opt).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_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_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Copy images', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      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(@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 +      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).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_Env::CreateSite.new(@opt.cmd).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_Env::CreateSite.new(@opt).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_Env::CreateSite.new(@opt.cmd).cp_css +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'invert', +        'Configuring CSSs', +        '' +      ).colorize unless @opt.act[:quiet][:set]==:on +      SiSU_Env::CreateSite.new(@opt).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/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/css.rb b/lib/sisu/v6/css.rb index 81cb115b..b59458ee 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 @@ -1248,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 { @@ -1273,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; @@ -1285,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; @@ -3122,7 +3129,7 @@ WOK      br { display: block; }  WOK      end -    def docbook_xml                               #stylesheet for docbook +    def xml_docbook                               #stylesheet for docbook  <<WOK  /* SiSU css docbook.xml default style */      book { 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/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 8c9869e2..789f2b1c 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -89,7 +89,8 @@ module SiSU_HTML        begin          songsheet        ensure -        SiSU_Env::CreateSite.new(@opt.cmd).cp_css +        SiSU_Env::CreateSite.new(@opt).cp_css +        SiSU_Env::CreateSite.new(@opt).cp_base_images        end      end      def songsheet @@ -176,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/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/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/options.rb b/lib/sisu/v6/options.rb index e181ee8e..104243a3 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,21 +154,20 @@ 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,: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) -      @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=@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? -      @@sisu_call_origin_path ||=Dir.pwd -      @base_path=@@sisu_call_origin_path -      r=Px[:lng_lst_rgx] -      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -      @base_stub=@base_path.gsub(u,'\1') +      @call_path=call_path +      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/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/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_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(%{ diff --git a/lib/sisu/v6/src_shared.rb b/lib/sisu/v6/src_shared.rb index cee7e1c5..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 @@ -245,7 +243,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 +254,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 +270,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 +286,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/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 diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 3c774c46..72aaf2b9 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 @@ -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 @@ -2726,15 +2730,21 @@ WOK          if FileTest.directory?(image_external)            if @@image_flag              images=Dir.glob("#{image_external}/*.{png,jpg,gif}") -            pth="#{path.webserv}/#{@stub_pwd}" -            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 +            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            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 @@ -3497,9 +3507,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 +3554,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 +3572,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 +3601,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 +3758,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 +3784,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 +3796,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 +3821,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) @@ -6315,7 +6325,7 @@ WOK        end        def xml_docbook          def ft -         'docbook' + DEVELOPER[:under_construction] +         'docbook'          end          def dir            set_path(ft).dir.abc @@ -6363,7 +6373,7 @@ WOK        end        def xml_docbook_book          def ft -         'docbook' + DEVELOPER[:under_construction] +         'docbook'          end          def dir            set_path(ft).dir.abc @@ -6912,7 +6922,7 @@ WOK      def xml_dom        'dom.css'      end -    def docbook_xml +    def xml_docbook        'docbook.css'      end      def homepage @@ -6931,8 +6941,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 +6951,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 +6960,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 +6969,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,26 +6978,26 @@ 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 -    def docbook_xml +    def xml_docbook        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" -      else SiSU_Env::CSS_Default.new.docbook_xml +      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.xml_docbook        end      end      def homepage        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 @@ -7029,12 +7039,16 @@ WOK        stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_dom}"        %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>}      end +    def xml_docbook +      stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_docbook}" +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end    end    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 @@ -7047,8 +7061,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 +7073,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 +7102,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 +7116,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,25 +7124,30 @@ 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)        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]/ +        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) @@ -7142,53 +7161,64 @@ 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( +          @opt.cmd, +          "*WARN* modify css is not set or is set to: false" +        ).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]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}")) +      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]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}")) +      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 =~/[b]/ \ -        and not FileTest.file?("#{path_style}/#{fn_css.xhtml}")) +      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 @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          style.close diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 5879db27..4e7cb6e3 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -174,8 +174,22 @@ 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 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 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 b3e9e035..f105eab9 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 @@ -126,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 @@ -154,8 +178,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  <?xml version="1.0" encoding="utf-8"?> +#{stylesheet.css_head_xml} +#{rdf.comment_xml}  <book xmlns="http://docbook.org/ns/docbook"    xmlns:xl="http://www.w3.org/1999/xlink"    version="5.0"> @@ -163,7 +191,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_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 diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index 3e8ddf50..38c21802 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -477,15 +477,21 @@ module SiSU_XML_Munge            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').            gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # 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:<figure id="\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="images/\\1" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). -          gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). +          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:<figure id="fig-\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="../../_sisu/image/\\1.\\2" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). # common image location, else use ./images +          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, +            '<ulink url="\2">\1</ulink>'). +          gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/, +            '<ulink url="\1">\1</ulink>').            gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').            gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available            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(/</,'<').gsub(/>/,'>') +      else # p dob.is ??        end        dob      end | 
