diff options
Diffstat (limited to 'lib')
160 files changed, 20496 insertions, 15066 deletions
diff --git a/lib/sisu/v5/db_columns.rb b/lib/sisu/v5/db_columns.rb index 42c23cfc..04be289d 100644 --- a/lib/sisu/v5/db_columns.rb +++ b/lib/sisu/v5/db_columns.rb @@ -69,8 +69,11 @@ module SiSU_DbColumns        @md=md        @db=SiSU_Env::InfoDb.new #watch        @lang ||=SiSU_i18n::Languages.new -      if defined? md.opt.mod \ -      and md.opt.mod.inspect=~/import|update/ \ +      if defined? md.opt.act \ +      and ((md.opt.act[:psql_import][:set]==:on \ +      || md.opt.act[:psql_update][:set]==:on) \ +      or (md.opt.act[:sqlite_import][:set]==:on \ +      || md.opt.act[:sqlite_update][:set]==:on)) \        and FileTest.exist?(md.fns)          txt_arr=IO.readlines(md.fns,'')          src=txt_arr.join("\n") @@ -1920,7 +1923,10 @@ module SiSU_DbColumns             IS 'sisu markup source text (if shared)';}          end          def tuple -          if @md.opt.mod.inspect=~/import|update/ \ +          if ((@md.opt.act[:psql_import][:set]==:on \ +          || @md.opt.act[:psql_update][:set]==:on) \ +          or (@md.opt.act[:sqlite_import][:set]==:on \ +          || @md.opt.act[:sqlite_update][:set]==:on)) \            and FileTest.exist?(@md.fns)              ["#{name}, ","'#{@sisutxt}', "]            else ['',''] @@ -1944,7 +1950,10 @@ module SiSU_DbColumns              IS 'document full text clean, searchable';}          end          def tuple -          if @md.opt.mod.inspect=~/import|update/ \ +          if ((@md.opt.act[:psql_import][:set]==:on \ +          || @md.opt.act[:psql_update][:set]==:on) \ +          or (@md.opt.act[:sqlite_import][:set]==:on \ +          || @md.opt.act[:sqlite_update][:set]==:on)) \            and  FileTest.exist?(@md.fns)              ["#{name}, ","'#{@fulltext}', "]            else ['',''] diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index 78277c8b..142318f5 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -85,8 +85,16 @@ module SiSU_DbCreate      def create_db        @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.base_markup_dir_stub}"}) +      ? 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.base_markup_dir_stub}"} +        )        if (@opt.act[:verbose][:set]==:on \        || @opt.act[:verbose_plus][:set]==:on \        || @opt.act[:maintenance][:set]==:on) @@ -96,7 +104,7 @@ module SiSU_DbCreate      end      def output_dir?        dir=SiSU_Env::InfoEnv.new('') -      if @opt.cmd =~/d/ +      if @opt.act[:sqlite][:set]==:on          dir.path.webserv_stub_ensure        end      end diff --git a/lib/sisu/v5/db_dbi.rb b/lib/sisu/v5/db_dbi.rb index 05c44220..06c3fb0c 100644 --- a/lib/sisu/v5/db_dbi.rb +++ b/lib/sisu/v5/db_dbi.rb @@ -91,7 +91,7 @@ module  SiSU_DbDBI    end    class LoadUrls <SiSU_DbTuple::LoadUrls                                    # db_update urls    end -  class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize                  # db_import.rb +  class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize                 # db_import.rb    end  end  __END__ diff --git a/lib/sisu/v5/db_drop.rb b/lib/sisu/v5/db_drop.rb index 75e98faa..ba7b57cd 100644 --- a/lib/sisu/v5/db_drop.rb +++ b/lib/sisu/v5/db_drop.rb @@ -206,7 +206,7 @@ module SiSU_DbDrop          self        end        indexes.base -      @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : indexes.text) +      @opt.act[:psql][:set]==:on ? '' : indexes.text        self      end    end diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 9e88e7ee..3e9d19ec 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -91,7 +91,9 @@ module SiSU_DbImport        @counter={}        @db=SiSU_Env::InfoDb.new        if @sql_type==:sqlite -        @driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ +        @driver_sqlite3= +        (@conn.inspect.match(/^(.{10})/)[1] \ +        == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \          ? true          : false        end @@ -100,7 +102,7 @@ module SiSU_DbImport          @col[:lid] ||=0          @col[:lid]=@driver_sqlite3 \          ? @conn.execute( sql ).join.to_i -        : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } +        : @conn.exec( sql ).getvalue(0,0).to_i        rescue          puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on        end @@ -109,7 +111,7 @@ module SiSU_DbImport        begin          @id_n=@driver_sqlite3 \          ? @conn.execute( sql ).join.to_i -        : @id_n=@conn.exec( sql ).getvalue(0,0).to_i +        : @conn.exec( sql ).getvalue(0,0).to_i          @id_n ||=0        rescue          puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on @@ -126,9 +128,16 @@ module SiSU_DbImport        if (@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],"#{@db.psql.db}::#{@opt.fns}").puts_blue +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "#{@db.psql.db}::#{@opt.fns}" +        ).puts_blue        end -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Marshal Load',@fnc).puts_grey if @opt.act[:verbose][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Marshal Load', +        @fnc +      ).puts_grey if @opt.act[:verbose][:set]==:on  #%        select_first_match=%{          SELECT metadata_and_text.tid @@ -172,22 +181,6 @@ module SiSU_DbImport                end              @conn.exec("COMMIT")            end -        rescue DBI::DatabaseError => e -          STDERR.puts "Error code: #{e.err}" -          STDERR.puts "Error message: #{e.errstr}" -          STDERR.puts "Error SQLSTATE: #{e.state}" -          SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do -            __LINE__.to_s + ':' + __FILE__ -          end -          sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql" -          sql=File.new(sqlfn,'w') -          t_d.each {|i| sql.puts i} -          p sqlfn -          if @opt.act[:maintenance][:set]==:on -            puts sql -            p @conn.methods.sort -            puts "#{__FILE__}:#{__LINE__}" -          end          rescue            SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do              __LINE__.to_s + ':' + __FILE__ @@ -261,11 +254,9 @@ module SiSU_DbImport          sql='SELECT MAX(tid) FROM metadata_and_text;'          begin            @@id_t ||=0 -          id_t=if @driver_sqlite3 -            @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i } -          else -            @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } -          end +          id_t=@driver_sqlite3 \ +          ? @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i } +          : @conn.exec( sql ).getvalue(0,0).to_i            @@id_t=id_t if id_t          rescue            puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb index 7e1164ab..b76e4b26 100644 --- a/lib/sisu/v5/db_indexes.rb +++ b/lib/sisu/v5/db_indexes.rb @@ -132,7 +132,7 @@ module SiSU_DbIndex          conn_execute_array(sql_arr)        end        base -      @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : text) +      @opt.act[:psql][:set]==:on ? '' : text      end    end  end diff --git a/lib/sisu/v5/db_remove.rb b/lib/sisu/v5/db_remove.rb index 2dea65f2..1fbf8c9f 100644 --- a/lib/sisu/v5/db_remove.rb +++ b/lib/sisu/v5/db_remove.rb @@ -128,7 +128,10 @@ module SiSU_DbRemove          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey +          SiSU_Screen::Ansi.new( +            @opt.cmd, +            "no such file in database #{@db.psql.db}::#{@opt.fns}" +          ).puts_grey          end        end      end diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 3aebe828..3f232c14 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -67,40 +67,65 @@ module SiSU_DbSelect        @opt,@conn,@sql_type=opt,conn,sql_type        @db=SiSU_Env::InfoDb.new        @file_maint=sql_maintenance_file -      @sdb=SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type)      # db_dbi.rb -      @sdb_index=SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type) # db_dbi.rb -      @sdb_no=SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type)       # db_dbi.rb -      if @opt.mod.inspect =~/update|import/ -        @sdb_import=SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type) -        @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) -      elsif @opt.mod.inspect =~/remove/ -        @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) +      @sdb= +        SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type) +      @sdb_index= +        SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type) +      @sdb_no= +        SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type) +      if (@opt.act[:psql_import][:set]==:on \ +      || @opt.act[:psql_update][:set]==:on) \ +      or (@opt.act[:sqlite_import][:set]==:on \ +      || @opt.act[:sqlite_update][:set]==:on) +        @sdb_import= +          SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type) +        @sdb_remove_doc= +          SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) +      elsif (@opt.act[:psql_remove][:set]==:on \ +      or @opt.act[:sqlite_remove][:set]==:on) +        @sdb_remove_doc= +          SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)        end      end      def db_exist?        if @sql_type==:sqlite \ -      and (not (FileTest.file?(@db.sqlite.db)) or FileTest.zero?(@db.sqlite.db)) -        puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?} +      and (not (FileTest.file?(@db.sqlite.db)) \ +      or FileTest.zero?(@db.sqlite.db)) +        puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +        + %{    sisu --#{@sql_type} --createall\n} \ +        + %{  before attempting to populate the database}          exit        end        if @conn.is_a?(NilClass) -        db=@sql_type==:sqlite \ -        ? @db.sqlite.db -        : @db.psql.db -        puts %{no connection with #{@sql_type} database established, createdb "#{db}"?} +        db=if @sql_type==:sqlite +          puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +          + %{    sisu --#{@sql_type} --createall\n} \ +          + %{  before attempting to populate the database} +          @db.sqlite.db +        else +          puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +          + %{    createdb "#{@db.psql.db}"\n} \ +          + %{  after that don't forget to run:\n} \ +          + %{    sisu --#{@sql_type} --createall\n} \ +          + %{  before attempting to populate the database} +          @db.psql.db +        end          exit        end      end      def sql_maintenance_file -      file=if @opt.inspect =~/M/ +      file=if @opt.act[:maintenance][:set]==:on          if @opt.fns and not @opt.fns.empty?            @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns -          puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on +          if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on +            puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" +          end            @db=SiSU_Env::InfoDb.new            @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"            File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')          elsif @opt.fns \ -        and @opt.fns.inspect =~/create/ +        and (@opt.act[:sqlite_create][:set] ==:on \ +        || @opt.act[:psql_create][:set] ==:on)            nil #sort variations later          else nil          end @@ -108,116 +133,88 @@ module SiSU_DbSelect        end        file      end -    def cases -      @opt.mod.each do |mod| -        case mod -        when /^--createdb$/ -          @sdb.output_dir? -          begin -            @sdb.create_db -          rescue; @sdb.output_dir? -          end -        when /^--(?:init(?:ialize)?|create(?:all)?)$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue -            SiSU_Errors::Rescued.new($!,$@,'-D').location; @sdb.output_dir? do -              __LINE__.to_s + ':' + __FILE__ -            end -          end -        when /^--createtables?$/ +    def db_action +      def createdb +        @sdb.output_dir? +        begin +          @sdb.create_db +        rescue            @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue; @sdb.output_dir? -          end -        when /^--recreate$/ -          @sdb.output_dir? -          begin -            @sdb_no.drop.tables -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue; @sdb.output_dir? -          end -        when /^--cr(eate)?lex$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.doc_objects -          rescue; @sdb.output_dir? -          end -        when /^--cr(eate)?metadata$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -          rescue; @sdb.output_dir? -          end -        when /^--import$/ -          db_exist? -          @sdb_import.marshal_load -          tell=case @sql_type -          when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") -          when :pg     then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") -          else '???' -          end -          tell.puts_grey if @opt.act[:verbose][:set]==:on -        when /^--update$/ -          db_exist? -          @sdb_remove_doc.remove -          @sdb_import.marshal_load -          tell=case @sql_type -          when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") -          when :pg     then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") -          else '???' -          end -          tell.puts_grey if @opt.act[:verbose][:set]==:on -        when /^--remove$/ -          db_exist? -          @sdb_remove_doc.remove -        when /^--index$/ -          db_exist? +        end +      end +      def drop +        @sdb_no.drop.tables +      end +      def create +        @sdb.output_dir? +        begin +          @sdb.create_table.metadata_and_text +          @sdb.create_table.doc_objects +          @sdb.create_table.endnotes +          @sdb.create_table.endnotes_asterisk +          @sdb.create_table.endnotes_plus +          @sdb.create_table.urls            @sdb_index.create_indexes -        when /^--droptable(s)?$/ -          db_exist? -          @sdb_no.drop.tables -        when /^--dropindex(es)?$/ -          db_exist? -          @sdb_no.drop.indexes -        when /^--(?:dropall|drop)$/ -          db_exist? -          @sdb_no.drop.tables -        when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/ -        when /^--(?:v\d+|dev)$/ -        else +        rescue +          SiSU_Errors::Rescued.new($!,$@,'--sqlite').location +          @sdb.output_dir? do +            __LINE__.to_s + ':' + __FILE__ +          end          end -        if @opt.act[:maintenance][:set]==:on \ -        and @opt.cmd  =~/d/ -          puts @job +      end +      def import +        db_exist? +        @sdb_import.marshal_load +        tell=case @sql_type +        when :sqlite +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "sqlite3 #{@db.sqlite.db} database?" +          ) +        when :pg +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "pgaccess or psql #{@db.psql.db} database?" +          ) +        else '???'          end +        tell.puts_grey if @opt.act[:verbose][:set]==:on +      end +      def remove +        db_exist? +        @sdb_remove_doc.remove        end -      if @opt.act[:psql][:set]==:on \ -      and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/ -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"--pg requires further instruction").warn unless @opt.act[:quiet][:set]==:on +      def update +        remove +        import        end -      begin -      rescue; @sdb.output_dir? +      self +    end +    def cases +      if @opt.act[:psql_drop][:set] ==:on \ +      or @opt.act[:sqlite_drop][:set] ==:on +        db_action.drop +      end +      if @opt.act[:psql_createdb][:set] ==:on \ +      or @opt.act[:sqlite_createdb][:set] ==:on +        db_action.createdb +      end +      if @opt.act[:psql_create][:set] ==:on \ +      or @opt.act[:sqlite_create][:set] ==:on +        db_action.create +      end +      if @opt.act[:psql_update][:set] ==:on \ +      or @opt.act[:sqlite_update][:set] ==:on +        db_action.update +      else +        if @opt.act[:psql_remove][:set] ==:on \ +        or @opt.act[:sqlite_remove][:set] ==:on +          db_action.remove +        end +        if @opt.act[:psql_import][:set] ==:on \ +        or @opt.act[:sqlite_import][:set] ==:on +          db_action.import +        end        end      end    end diff --git a/lib/sisu/v5/db_sqltxt.rb b/lib/sisu/v5/db_sqltxt.rb index 394328bd..a07ee018 100644 --- a/lib/sisu/v5/db_sqltxt.rb +++ b/lib/sisu/v5/db_sqltxt.rb @@ -84,14 +84,22 @@ module SiSU_DbText            and not @md.creator.author.empty?              s=s.gsub(/@author/,@md.creator.author)            else -            SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              'v', +              'WARNING Document Author information missing; provide @creator: :author:', +              @md.fnb +            ).warn unless @md.opt.act[:quiet][:set]==:on            end            if defined? @md.title \            and defined? @md.title.full \            and not @md.title.full.empty?              s=s.gsub(/@title/,@md.title.full)            else -            SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              'v', +              'WARNING Document Title missing; provide @title:', +              @md.fnb +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          end          s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,''). diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index 0e438c3e..83021b20 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -73,22 +73,18 @@ module  SiSU_DBI      def initialize(opt)        @opt=opt        @db=SiSU_Env::InfoDb.new -      if @opt.cmd =~/[Dd]/ \ -      or  @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ -        @sql_type=if @opt.cmd=~/D/ \ -        or @opt.mod.inspect =~/--pg(?:sql)?/ +      if @opt.act[:psql][:set]==:on \ +      or @opt.act[:sqlite][:set]==:on +        @sql_type=if @opt.act[:psql][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :pg -        elsif @opt.cmd =~/d/ \ -        and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ +        elsif @opt.act[:psql][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :pg -        elsif @opt.cmd=~/d/ \ -        or @opt.mod.inspect =~/--(?:sq)?lite/ +        elsif @opt.act[:sqlite][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :sqlite -        elsif @opt.cmd =~/d/ \ -        and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ +        elsif @opt.act[:sqlite][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :sqlite          else @@ -110,7 +106,7 @@ module  SiSU_DBI          require 'pg'          @conn=@db.psql.conn_pg        rescue -        if @opt.mod.inspect=~/--(?:createall|create)/ +        if @opt.act[:psql_create][:set]==:on            cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX            puts <<-WOK  manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet exist @@ -136,7 +132,11 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet        when :pg     then read_psql #read_pg        when :sqlite then read_sqlite        end -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "DBI (#{@sql_type}) #{@opt.mod}", +        @opt.fno +      ).dbi_title unless @opt.act[:quiet][:set]==:on        begin          SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases        rescue diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 0b42c50e..a2aa3d09 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -81,8 +81,7 @@ module  SiSU_DBI_Discrete                               #% database building        @opt=opt        @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)        @md=@particulars.md -      if @opt.cmd =~/[d]/ \ -      or  @opt.mod.inspect =~/--((?:sq)?lite)/ +      if @opt.act[:sqlite][:set]==:on          @sql_type=:sqlite          maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on        end @@ -96,8 +95,8 @@ module  SiSU_DBI_Discrete                               #% database building        create_and_populate      end      def maintenance_check(opt,file,line) -      p opt.mod -      p opt.cmd +      #p opt.mod +      #p opt.cmd        p "at #{file} #{line}"      end      def prepare @@ -126,7 +125,11 @@ module  SiSU_DBI_Discrete                               #% database building        sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,:sqlite)        sdb.output_dir?        begin -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'SQLite', +          "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" +        ).green_title_hi unless @opt.act[:quiet][:set]==:on          sdb.create_db          sdb.create_table.metadata_and_text          sdb.create_table.doc_objects @@ -138,7 +141,10 @@ module  SiSU_DBI_Discrete                               #% database building          db_exist?(db,conn)          sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file_maint,:sqlite)          sdb_import.marshal_load -        tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{db.sqlite.db} database?") +        tell=SiSU_Screen::Ansi.new( +               @opt.act[:color_state][:set], +               "sqlite3 #{db.sqlite.db} database?" +             )          tell.puts_grey if @opt.act[:verbose][:set]==:on        rescue          SiSU_Errors::Rescued.new($!,$@,'-d').location do @@ -159,7 +165,11 @@ module  SiSU_DBI_Discrete                               #% database building      end      def connect        begin -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "DBI (#{@sql_type}) #{@opt.mod}", +          @opt.fns +        ).dbi_title unless @opt.act[:quiet][:set]==:on          @db.sqlite_discrete.conn_sqlite3        rescue          SiSU_Errors::Rescued.new($!,$@,@cf,@opt.fns).location do diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb index 06851739..662fa23d 100644 --- a/lib/sisu/v5/digests.rb +++ b/lib/sisu/v5/digests.rb @@ -86,11 +86,23 @@ module SiSU_DigestView            (@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],"Document #{@dg} Digests",tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Document #{@dg} Digests",tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Document #{@dg} Digests", +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Document #{@dg} Digests", +              tool +            ).green_title_hi            if @opt.act[:verbose_plus][:set]==:on \            or @opt.act[:maintenance][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" +            ).flow            end          end          if SiSU_Env::SystemCall.new.openssl diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb index d04aafee..e7d2fcc1 100644 --- a/lib/sisu/v5/git.rb +++ b/lib/sisu/v5/git.rb @@ -112,12 +112,24 @@ module SiSU_Git          (@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],'Git path',@git_path[:fnb]).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Git path',@git_path[:fnb]).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Git path', +            @git_path[:fnb] +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Git path', +            @git_path[:fnb] +          ).green_title_hi          if (@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],"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "Git path", +            "#{@opt.fns} -> #{@git_path[:fnb]}" +          ).warn          end        end      end diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index a4d6c530..361b9a8f 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -202,7 +202,11 @@ module SiSU_HarvestAuthors          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          ? ("file://#{file}") : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest authors (#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "harvest authors (#{@opt.files.length} files)", +          fileinfo +        ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on          @output[lng][:html]=File.new(file,'w')        end      end diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index 09739200..c68293b0 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -486,7 +486,11 @@ module SiSU_HarvestTopics          || @opt.act[:maintenance][:set]==:on) \          ? ("file://#{file}")          : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest topics(#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "harvest topics(#{@opt.files.length} files)", +          fileinfo +        ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on          @output[lng][:html]=File.new(file,'w')          if @opt.act[:maintenance][:set]==:on            @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 3258a0e5..13aaf58d 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -110,11 +110,23 @@ module SiSU_HTML            (@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],'HTML',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'HTML',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'HTML', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'HTML', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{primary_output_file}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{primary_output_file}" +            ).flow            end          end          data=nil @@ -253,7 +265,10 @@ module SiSU_HTML          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Toc' +          ).txt_grey          end          toc=nil          @@firstseg=nil @@ -592,7 +607,10 @@ WOK          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Scroll & Segtoc' +          ).txt_grey          end          format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)          dochead=format_head_toc.head diff --git a/lib/sisu/v5/html_concordance.rb b/lib/sisu/v5/html_concordance.rb index cf10e001..f336937f 100644 --- a/lib/sisu/v5/html_concordance.rb +++ b/lib/sisu/v5/html_concordance.rb @@ -89,18 +89,32 @@ module SiSU_Concordance            (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) \ -          ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Concordance",tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Concordance',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Concordance", +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Concordance', +              tool +            ).green_title_hi          end          wordmax=@env.concord_max          unless @md.wc_words.nil?            if @md.wc_words < wordmax              SiSU_Concordance::Source::Words.new(@particulars).songsheet            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})" +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words" +          ).warn unless @md.opt.act[:quiet][:set]==:on            SiSU_Concordance::Source::Words.new(@particulars).songsheet          end        rescue @@ -373,7 +387,11 @@ WOK          @file_concordance << %{</div></body>\n</html>} # footer          if @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            @md.fns, +            "#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" +          ).flow          end        end      end diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index e109debc..3ce59049 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -126,7 +126,14 @@ module SiSU_FormatShared                u=u.gsub(/^\.\.\//,'')                "#{@env.url.root}/#{u}"              else -              "#{@env.url.root}/#{@md.fnb}/#{map_nametags[u][:segname]}#{Sfx[:html]}##{u}" +              if not map_nametags[u].nil? +                @env.url.root + '/' \ +                + @md.fnb + '/' \ +                + map_nametags[u][:segname] \ +                + Sfx[:html] \ +                + '#' + u +              else '' +              end              end              link=m[/(.+)/m]              png=m.scan(/\S+/)[0].strip diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index d9157b49..f10bdb51 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -417,7 +417,10 @@ WOK            end          end        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* category not found: #{category}").warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          "*WARN* category not found: #{category}" +        ).warn unless @md.opt.act[:quiet][:set]==:on        end        adverts.join      end diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 12101b67..5826163e 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -210,7 +210,10 @@ module SiSU_HTML_Seg        if (@md.opt.act[:verbose][:set]==:on \        || @md.opt.act[:verbose_plus][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on) -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length).segmented +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          @@seg_name.length +        ).segmented        end        map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob| diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 5d291f9b..510e2092 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -93,6 +93,22 @@ module SiSU        end      end    end +  class HubClose +    def initialize(call_path) +      begin +        @env=SiSU_Env::InfoEnv.new +      rescue +      ensure +        if FileTest.directory?(@env.processing_path.processing) \ +        and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ +          FileUtils::cd(@env.processing_path.processing_base_tmp) do +            FileUtils::rm_rf('.') +          end +        end +        Dir.chdir(call_path) +      end +    end +  end    class OptionLoopFiles      attr_reader :opt      def initialize(opt) @@ -111,6 +127,7 @@ module SiSU          @opt.pth=@opt.f_pths[i][:pth]          @opt.lng=@opt.f_pths[i][:lng]          Dir.chdir(@opt.f_pth[:pth]) #watch +        SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track          @env=SiSU_Env::InfoEnv.new(fno)          yield        end @@ -612,20 +629,12 @@ module SiSU          path[:xsd]=path[:xml] + '/rng'          re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/          unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line -        # unless ( FileTest.directory?(path[:css]) \ -        # and FileTest.directory?(path[:xsd]) ) -        #   @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX -        # end            if @opt.act[:maintenance][:set] ==:on              $VERBOSE=false                               #debug $VERBOSE=true            end          end          re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/          unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line -        # unless ( FileTest.directory?(path[:css]) \ -        # and FileTest.directory?(path[:xsd]) ) -        #   @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX -        # end            if @opt.act[:maintenance][:set] ==:on              $VERBOSE=false                               #debug $VERBOSE=true            end @@ -792,8 +801,10 @@ module SiSU            and @@env.user \            and FileTest.directory?(@@env.processing_path.processing) \            and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area -            FileUtils::cd(@@env.processing_path.processing_base_tmp) do -              FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on +            if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ +              FileUtils::cd(@@env.processing_path.processing_base_tmp) do +                FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on +              end              end            end          elsif action_on_file_ == :true \ diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index 3216194d..faca95af 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -88,15 +88,29 @@ module SiSU_Manifest          browser=@env.program.console_web_browser  #       webserv_url=@env.path.url.output_tell #fix in sysenv          unless @opt.act[:quiet][:set]==:on -          url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +          url_html='file://' \ +          + @md.file.output_path.manifest.dir + '/' \ +          + @md.file.base_filename.manifest            (@opt.act[:verbose][:set]==:on \            || @opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) \ -          ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest',"#{xbrowser} #{url_html}").green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Manifest', +              "#{xbrowser} #{url_html}" +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Manifest', +              "[#{@opt.f_pth[:lng_is]}]", +              "#{url_html}" +            ).grey_title_grey_blue            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{browser} #{url_html}").grey_tab +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "#{browser} #{url_html}" +            ).grey_tab            end          end          data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -177,12 +191,20 @@ module SiSU_Manifest          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{dgst[1]} #{file}").warn +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "#{dgst[1]} #{file}" +          ).warn          end          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}#{url_make(url,file,:src)}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/ +        @manifest[:html] << %{<tr>} \ +        + %{<th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th>} \ +        + %{<td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}#{url_make(url,file,:src)}</p></td>} \ +        + %{<td class="right"><p class="right">#{kb}</p></td>} \ +        + %{</tr>\n} \ +          if kb and kb =~/\d+/        end        def published_manifests?          @f=SiSU_Env::FileOp.new(@md) #.base_filename diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb index e675da3b..526e0286 100644 --- a/lib/sisu/v5/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -95,11 +95,23 @@ module SiSU_Manpage          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          && @opt.cmd !~/q/ \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Manpage', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Manpage', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" +          ).flow          end          @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here          SiSU_Manpage::Source::Scroll.new(@md,@ao_array).songsheet @@ -337,7 +349,7 @@ WOK                paranum=dob.obj[@regx,3]                @p_num=SiSU_ManpageFormat::ParagraphNumber.new(paranum)              end -            x=SiSU_ManpageFormat::FormatTextObject.new(@md,dob) +            SiSU_ManpageFormat::FormatTextObject.new(@md,dob) #check              if dob.is==:heading                manpage_structure(dob)              elsif dob.is==:para diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index f40f0388..e90fe668 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -70,7 +70,7 @@ module SiSU_Commandline    require_relative 'sysenv'                             # sysenv.rb    require_relative 'param_make'                         # param_make.rb    class HeaderCommon -    def sisu_document_make_instructions +    def sisu_document_make_instructions(make_instruct_array=:nil)        @pagenew=          @pagebreak=          @pageline= @@ -87,7 +87,9 @@ module SiSU_Commandline          @home_button_links=          @links=          nil -      make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read +      make_instruct_array=make_instruct_array==:nil \ +      ? SiSU_Env::GetInit.new.sisu_document_make.makefile_read +      : make_instruct_array        @makeset=false        if make_instruct_array          make_instruct_array.each do |para|                                     #% scan document @@ -282,7 +284,10 @@ module SiSU_Commandline          end          if @cmd =~/[vVM]/ \          && @cmd !~/-[ku]*v[ku]*$/ -          SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown +          SiSU_Screen::Ansi.new( +            @cmd, +            "\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n" +          ).print_brown          end        end        @@act ? @act=@@act : @@act=@act=opt_act @@ -331,7 +336,7 @@ module SiSU_Commandline              pod_make_path=fullname + '/sisupod/doc/_sisu'              make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)              @make_instructions_pod= -              HeaderCommon.new(make_instruct_array).sisu_document_make_instructions +              HeaderCommon.new.sisu_document_make_instructions(make_instruct_array)              Dir.chdir(pt.realpath)              system("                chdir #{fullname} @@ -532,6 +537,7 @@ module SiSU_Commandline              mod << s            when /^--(?:epub)$/                                                       then c=c+'e'            when /^--(?:od[ft])$/                                                     then c=c+'o' +          when /^--docbook$/                                                     then c=c+'d'            when /^--(?:pdf)$/                                                        then c=c+'p'            when /^--pdf-(?:a4|a5|b5|legal|letter)$/                                  then c=c+'p'            when /^--pdf-(?:p|l|portrait|landscape)$/                                 then c=c+'L' @@ -544,13 +550,11 @@ module SiSU_Commandline            when /^--(?:xml-sax)$/                                                    then c=c+'x'            when /^--(?:xml-dom)$/                                                    then c=c+'X'            when /^--(?:images)$/                                                     then c=c+'j' -          when /^--(?:hash-digests)$/                                               then c=c+'N' +          when /^--(?:digests?|hash-digests)$/                                      then c=c+'N'            when /^--(?:po4a|pot?)$/                                                  then c=c+'P'            when /^--(?:termsheet)$/                                                  then c=c+'T'            when /^--(?:manifest)$/                                                   then c=c+'y'            when /^--(?:qrcode)$/                                                     then c=c+'Q' -          when /^--(?:sqlite)$/                                                     then c=c+'d' -          when /^--(?:pg|pg?sql|postgresql)$/                                       then c=c+'D'            when /^--(?:remote|rsync)$/                                               then c=c+'R'            when /^--(?:scp)$/                                                        then c=c+'r'            when /^--(?:source)$/                                                     then c=c+'s' @@ -582,8 +586,7 @@ module SiSU_Commandline          extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \          and cmd !~/[mn]/            'm'                        #% add ao -        elsif ((cmd =~/[Dd]/ \ -        or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ +        elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \          and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \          and cmd !~/[mn]/            'm'                        #% add ao @@ -591,18 +594,17 @@ module SiSU_Commandline          end        end        if cmd !~/j/ -        extra+=if cmd =~/[bHhwXxyz]/ \ +        extra+=if cmd =~/[bdHhwXxyz]/ \          and cmd !~/[j]/            'j'                        #% copy images          else ''          end        end        if cmd !~/y/ -        extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ +        extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \          and cmd !~/y/            'ym'                       #% add manifest -        elsif (cmd =~/[Dd]/ \ -        or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ +        elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \          and files[0] !~/^remove$/ \          and cmd !~/y/            'ym'                       #% add manifest @@ -911,7 +913,8 @@ module SiSU_Commandline          || mod.inspect =~/"--xml-dom"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } -        act[:xml_docbook_book]=mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/ \ +        act[:xml_docbook_book]=(cmd =~/d/ \ +        || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:xml_fictionbook]=(cmd =~/f/ \ @@ -962,19 +965,134 @@ module SiSU_Commandline          || mod.inspect =~/"--texinfo"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } -        act[:psql]=(cmd =~/D/ \ -        || mod.inspect =~/"--pg"|"--pgsql"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:sqlite]=(cmd =~/d/ \ -        || mod.inspect =~/"--sqlite"/) \ -        && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:sqlite_discrete]=(cmd =~/d/ \ -        || mod.inspect =~/"--sql"|"--sqlite"/) \ -        && (mod.inspect =~/"--both"/ \ -        || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ +        act[:psql]=if mod.inspect =~/"--pg-\S+"/ \ +        or ((mod.inspect =~/"--pg"/) \ +        && (mod.inspect \ +        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) +          act[:psql_createdb]=if mod.inspect \ +          =~/"--pg-createdb"|"--createdb"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          if mod.inspect \ +          =~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/ +            act[:psql_drop]={ bool: true, set: :on } +            act[:psql_create]={ bool: true, set: :on } +          else +            act[:psql_drop]=if mod.inspect \ +            =~/"--pg-dropall"|"--dropall"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            act[:psql_create]=if mod.inspect \ +            =~/"--pg-create(?:all)?"|"--create(?:all)?"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +          end +          act[:psql_import]=if mod.inspect \ +          =~/"--pg-import"|"--import"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          act[:psql_update]=if mod.inspect \ +          =~/"--pg-update"|"--update"/ +            act[:psql_remove]={ bool: true, set: :on } +            { bool: true, set: :on } +          else +            act[:psql_remove]=if mod.inspect \ +            =~/"--pg-remove"|"--remove"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            { bool: false, set: :na } +          end +          { bool: true, set: :on } +        else +          act[:psql_createdb]= +            { bool: false, set: :na } +          act[:psql_drop]= +            { bool: false, set: :na } +          act[:psql_create]= +            { bool: false, set: :na } +          act[:psql_import]= +            { bool: false, set: :na } +          act[:psql_update]= +            { bool: false, set: :na } +          act[:psql_remove]= +            { bool: false, set: :na } +          { bool: false, set: :na } +        end +        act[:sqlite]=if (mod.inspect =~/"--sqlite-\S+"/) \ +        or ((mod.inspect =~/"--sqlite"/) \ +        && (mod.inspect \ +        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) +          act[:sqlite_createdb]=if mod.inspect \ +          =~/"--sqlite-createdb"|"--createdb"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          if mod.inspect \ +          =~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/ +            act[:sqlite_drop]={ bool: true, set: :on } +            act[:sqlite_create]={ bool: true, set: :on } +          else +            act[:sqlite_create]=if mod.inspect \ +            =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            act[:sqlite_drop]=if mod.inspect \ +            =~/"--sqlite-dropall"|"--dropall"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +          end +          act[:sqlite_import]=if mod.inspect \ +          =~/"--sqlite-import"|"--import"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          act[:sqlite_update]=if mod.inspect \ +          =~/"--sqlite-update"|"--update"/ +            act[:sqlite_remove]={ bool: true, set: :on } +            { bool: true, set: :on } +          else +            act[:sqlite_remove]=if mod.inspect \ +            =~/"--sqlite-remove"|"--sqlite-remove"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            { bool: false, set: :na } +          end +          { bool: true, set: :on } +        else +          act[:sqlite_createdb]= +            { bool: false, set: :na } +          act[:sqlite_drop]= +            { bool: false, set: :na } +          act[:sqlite_create]= +            { bool: false, set: :na } +          act[:sqlite_import]= +            { bool: false, set: :na } +          act[:sqlite_update]= +            { bool: false, set: :na } +          act[:sqlite_remove]= +            { bool: false, set: :na } +          { bool: false, set: :na } +        end +        act[:sqlite_discrete]=mod.inspect =~/"--sql"|"--sqlite"/ \ +        && (mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:harvest]=(mod.inspect =~/"--harvest"/) \ @@ -989,7 +1107,7 @@ module SiSU_Commandline          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:hash_digests]=(cmd =~/N/ \ -        || mod.inspect =~/"--hash-digests"/) \ +        || mod.inspect =~/"--digests?"|"--hash-digests"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:pdf_font_size]=if mod.inspect =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/ diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index ed28701c..4621f460 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -143,7 +143,11 @@ module SiSU_Param            if (@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],param_msg,@md.title.main).txt_grey +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              param_msg, +              @md.title.main +            ).txt_grey            end          end          @@md=@md diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index 17d3b9a3..578e4fb9 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -77,7 +77,11 @@ module SiSU_Param_Make          STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"          s        else -        SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          'v', +          "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped", +          @opt.fns +        ).warn unless @opt.act[:quiet][:set]==:on          nil        end      end diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb index 0b11600a..3b800e83 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -121,7 +121,11 @@ module SiSU_Po4a              if (@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],@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                @opt.fns, +                "#{path}/#{md.fnb}/#{md.fn[:plain]}" +              ).flow              end            end            if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \ diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb index e17b1d86..f6fd78bf 100644 --- a/lib/sisu/v5/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -89,12 +89,23 @@ module SiSU_QRcode            (@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],'QR code',"#{xbrowser} #{url_html}").green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'QR code', +              "#{xbrowser} #{url_html}" +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'QR code', +              "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" +            ).green_title_hi            if (@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],"#{browser} #{url_html}").grey_tab +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "#{browser} #{url_html}" +            ).grey_tab            end          end          data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -181,7 +192,10 @@ WOK          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn +          SiSU_Screen::Ansi.new( +            @md.opt.cmd, +            "#{dgst[1]} #{file}" +          ).warn          end          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb index 191b2edc..672eff9e 100644 --- a/lib/sisu/v5/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -73,35 +73,67 @@ module SiSU_Remote        @remote=SiSU_Env::InfoRemote.new(opt)      end      def rsync -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        @put +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.document      end      def rsync_base -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'rsync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_base      end      def rsync_base_sync -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'rsync and sync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_base_sync      end      def rsync_sitemaps -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement sitemaps ->', +        'rsync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync_sitemaps      end      def rsync_harvest -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement metadata harvest ->', +        'rsync_harvest' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_harvest      end      def scp -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        @put +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.document      end      def scp_base -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement of base site ->', +        'excluding images' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.site_base      end      def scp_base_all -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','complete').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'complete' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.site_base_all      end    end @@ -109,7 +141,11 @@ module SiSU_Remote      def initialize(opt,get_s)        @opt,@get_s=opt,get_s        @msg,@msgs='',nil -      @tell=lambda { SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@msg,"#{@msgs.inspect if @msgs}") } +      @tell=lambda { +        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set], +        @msg, +        "#{@msgs.inspect if @msgs}") +      }      end      def fns        begin diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb index bc9f7541..f7a2c968 100644 --- a/lib/sisu/v5/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -100,11 +100,20 @@ module SiSU_Rexml              xmlfile=IO.readlines(@fnap,'').join              begin                @xmldoc=REXML::Document.new xmlfile -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.act[:quiet][:set]==:on +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'REXML', +                "XML document #{@fnap} loaded" +              ).colorize unless @md.opt.act[:quiet][:set]==:on                if (@opt.act[:verbose][:set]==:on \                || @opt.act[:verbose_plus][:set]==:on)                  @xmldoc.elements.each(@e_head) do |e| -                  SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'brown',e).colorize unless @md.opt.act[:quiet][:set]==:on +                  SiSU_Screen::Ansi.new( +                    @md.opt.act[:color_state][:set], +                    'brown', +                    e +                  ).colorize unless @md.opt.act[:quiet][:set]==:on                  end                end              rescue REXML::ParseException @@ -112,7 +121,12 @@ module SiSU_Rexml              end            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'fuchsia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'fuchsia', +            "File Not Found #{xmlfile}", +            'requested XML processing skipped' +          ).colorize unless @md.opt.act[:quiet][:set]==:on            exit          end        rescue diff --git a/lib/sisu/v5/se_cleanoutput.rb b/lib/sisu/v5/se_cleanoutput.rb new file mode 100644 index 00000000..3e1ddde4 --- /dev/null +++ b/lib/sisu/v5/se_cleanoutput.rb @@ -0,0 +1,151 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_cleanoutput.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Clean_Output +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class CleanOutput +    begin +      require 'fileutils' +        include FileUtils::Verbose +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('fileutils NOT FOUND (LoadError)') +    end +    def initialize(opt) +      @opt=opt +      z=SiSU_Env::FileMap.new(opt) +      zap=z.local_sisu_source +      if opt.cmd =~ /h/i +        zap=Dir.glob(zap).join(' ') +        @zap=if opt.cmd !~ /w/ +          zap.gsub(/#{@source_path}\/concordance.html/,'') +        else zap +        end +      end +      @env=SiSU_Env::InfoEnv.new +    end +    def zap +      def deletion(fn) +        if FileTest.file?(fn)==true +          File.delete(fn) +          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn) +          tell.warn unless @opt.cmd =~/q/ +        end +      end +      def remove_output +        if @opt.act[:maintenance][:set] == :on +          m=InfoFile.new(@opt.fnc) +          tell=SiSU_Screen::Ansi.new( +            @opt.cmd,@opt.fns, +            'remove maintenance files from: ' + @env.processing_path.ao +          ) +          tell.warn unless @opt.cmd =~/q/ +          deletion(m.marshal.ao_content) +          deletion(m.marshal.ao_idx_sst_rel_html_seg) +          deletion(m.ao_idx_sst_rel) +          deletion(m.ao_idx_html) +          deletion(m.ao_idx_xhtml) +          deletion(m.ao_metadata) +          deletion(m.ao_map_nametags) +          deletion(m.ao_map_ocn_htmlseg) +          deletion(m.html_tune) +        end +        md=SiSU_Param::Parameters.new(@opt).get +        f=SiSU_Env::FileOp.new(md) +        deletion(f.place_file.html_segtoc.dir) +        deletion(f.place_file.html_scroll.dir) +        deletion(f.place_file.html_book_index.dir) +        deletion(f.place_file.html_concordance.dir) +        deletion(f.place_file.epub.dir) +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") +        deletion(f.place_file.odt.dir) +        deletion(f.place_file.xhtml.dir) +        deletion(f.place_file.xml_sax.dir) +        deletion(f.place_file.xml_dom.dir) +        deletion(f.place_file.xml_scaffold_structure_sisu.dir) +        deletion(f.place_file.xml_scaffold_structure_collapse.dir) +        deletion(f.place_file.info.dir) +        deletion(f.place_file.manpage.dir) +        deletion(f.place_file.sqlite_discrete.dir) +        deletion(f.place_file.txt.dir) +        deletion(f.place_file.hash_digest.dir) +        deletion(f.place_file.manifest.dir) +        deletion(f.place_file.qrcode_md.dir) +        deletion(f.place_file.qrcode_title.dir) +        deletion(f.place_file.src.dir) +        deletion(f.place_file.sisupod.dir) +      end +      self +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_clear.rb b/lib/sisu/v5/se_clear.rb new file mode 100644 index 00000000..1e908d3f --- /dev/null +++ b/lib/sisu/v5/se_clear.rb @@ -0,0 +1,112 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_clear.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Clear +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class Clear < SiSU_Info_Env::InfoEnv                     # se_info_env.rb +    #todo unify with FileOp +    def initialize(cmd,fns,operation='') +      @cmd=cmd +      begin +        super(fns) +        @env=SiSU_Env::InfoEnv.new(fns) +        SiSU_Env::InfoVersion.instance +        if operation.class.inspect =~/SiSU_Param/ +          @md=operation +        end +        case operation #watch +        when /pdf/                 then @env_out='' +        when /sql/ +        when /xml|plaintext|ascii/ then @env_out=@env.path.output + @fnb #check change of name to plaintext from ascii +        else +          if defined? @md.sfx_src \ +          and @md.sfx_src =~/ss[ftsumc]/ +            @env_out_root=@env.path.output +            @env_out="#{@env.path.output}/#{@fnb}" +            @@publisher='SiSU http://www.jus.uio.no/sisu' +            @env_pdf="#{@env_out_root}/pdf" +          end +        end +      rescue +        SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def param_instantiate +      @cX||=SiSU_Screen::Ansi.new(@cmd) +      @@date=SiSU_Env::InfoDate.new +      @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil +      @@publisher='SiSU scribe' +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_createsite.rb b/lib/sisu/v5/se_createsite.rb new file mode 100644 index 00000000..42d86aad --- /dev/null +++ b/lib/sisu/v5/se_createsite.rb @@ -0,0 +1,275 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_createsite.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Create_Site +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'screen_text_color'                     # screen_text_color.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class CreateSite < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    require_relative 'css'                                 # css.rb +      include SiSU_Style +    def initialize(opt) +      @opt=opt +      @env=SiSU_Env::InfoEnv.new +      @init=SiSU_Env::GetInit.new +      @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @vz=SiSU_Viz::Defaults.new +      @vz_home=SiSU_Viz::Home.new +    end +    def create_default_sisu_homepage(action=:none) +      if action==:none +        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.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 +        file_home_toc << @vz_home.homepage +        file_homepage.close +        file_home_toc.close +      end +    end +    def homepage +      home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") +      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.base_markup_dir_stub}") +        end +      else +        create_default_sisu_homepage(:none) +        #create_default_sisu_homepage(:default) +      end +    end +    def cp_images(src_path,dest_path) +      if FileTest.directory?(src_path) +        FileUtils::cd(src_path) +        source=Dir.glob("*.{png,jpg,gif,ico}") +        FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) +        FileUtils::chmod(0755,dest_path) +        source.each do |i| +          if FileTest.file?(i) +            FileUtils::cp(i,"#{dest_path}/#{i}") +            FileUtils::chmod(0644,"#{dest_path}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +          end +        end +        FileUtils::cd(@pwd) +      else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} +      end +    end +    def cp_local_images +      src=@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.base_markup_dir_stub + '/' \ +        + '_sisu/image_external' +      if FileTest.directory?(src) +        cp_images(src,dest) if FileTest.directory?(src) +      end +    end +    def cp_webserver_images +      src=@env.path.image_source +      dest_arr=[ +        "#{@env.path.webserv}/_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) +      end +    end +    def cp_webserver_images_local      #this should not have been necessary +      src=@env.path.image_source +      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.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 +      if defined? @rc['permission_set']['css_modify'] \ +      and @rc['permission_set']['css_modify'] +        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) +            source=Dir.glob("*.{css}") +            source.each do |i| +              if FileTest.file?(i) +                FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") +              else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} +              end +            end +            FileUtils::cd(@pwd) +          end +        end +      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 @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 @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 @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 @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 @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 @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 @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 +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_css.rb b/lib/sisu/v5/se_css.rb new file mode 100644 index 00000000..394b20a9 --- /dev/null +++ b/lib/sisu/v5/se_css.rb @@ -0,0 +1,227 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_css.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_CSS +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class CSS_Default +    def html +      'html.css' +    end +    def html_tables +      'html_tables.css' +    end +    def xhtml +      'xhtml.css' +    end +    def xml_sax +      'sax.css' +    end +    def xml_dom +      'dom.css' +    end +    def xml_docbook +      'docbook.css' +    end +    def homepage +      'homepage.css' +    end +    def harvest +      'harvest.css' +    end +  end +  class CSS_Select < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    def initialize(md) +      @md=md +      @env=SiSU_Env::InfoEnv.new('',@md) +    end +    def html +      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.base_markup_dir_stub}_html.css") +        @env.path.base_markup_dir_stub + '_html.css' +      else +        SiSU_Env::CSS_Default.new.html +      end +    end +    def html_tables +      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.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 +    def xhtml +      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.base_markup_dir_stub}_xhtml.css") +        @env.path.base_markup_dir_stub + '_xhtml.css' +      else SiSU_Env::CSS_Default.new.xhtml +      end +    end +    def xml_sax +      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.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 +    def xml_dom +      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.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 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.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.base_markup_dir_stub}_homepage.css") +        @env.path.base_markup_dir_stub + '_homepage.css' +      else SiSU_Env::CSS_Default.new.homepage +      end +    end +  end +  class CSS_Stylesheet +    def initialize(md) +      @md=md +      @css=SiSU_Env::CSS_Select.new(@md) +      @env=SiSU_Env::InfoEnv.new('',@md) +      @file=SiSU_Env::FileOp.new(@md) +    end +    def html +      stylesheet= +        @file.path_rel_links.html_scroll_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def html_seg +      stylesheet= +        @file.path_rel_links.html_seg_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def html_tables +      stylesheet= +        @file.path_rel_links.html_seg_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def xhtml_epub +      %{  <link rel="stylesheet" href="css/xhtml.css" type="text/css" />} +    end +    def epub +      xhtml_epub +    end +    def xhtml +      stylesheet= +        @file.path_rel_links.xhtml_css \ +        + @env.path.style + '/' \ +        + @css.xhtml +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end +    def xml_sax +      stylesheet= +        @file.path_rel_links.xml_css \ +        + @env.path.style + '/' \ +        + @css.xml_sax +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end +    def xml_dom +      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 +end +__END__ diff --git a/lib/sisu/v5/se_date.rb b/lib/sisu/v5/se_date.rb new file mode 100644 index 00000000..6e8ac539 --- /dev/null +++ b/lib/sisu/v5/se_date.rb @@ -0,0 +1,98 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_date.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Date +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoDate +    begin +      require 'date' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('date NOT FOUND (LoadError)') +    end +    attr_accessor :dt,:t +    def initialize +      @dt,@t=Date.today.to_s,Time.now +    end +    def week +      w=@t.strftime('%W') +      "#{@t.year}w#{w}" +    end +    def month +      "#{@t.year}#{@t.month}" +    end +    def year +      @t.year +    end +    def weekonly +      @t.strftime('%W') +    end +    def monthonly +      @t.month +    end +    def year_static +      YEAR +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_db.rb b/lib/sisu/v5/se_db.rb new file mode 100644 index 00000000..8ed78afa --- /dev/null +++ b/lib/sisu/v5/se_db.rb @@ -0,0 +1,215 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_db.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Db +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoDb < SiSU_Info_Env::InfoEnv                    # se_info_env.rb +    @@rc=nil +    def initialize +      @@pwd=@pwd=SiSU_Utils::Path.new.base_markup +      @env=SiSU_Env::InfoEnv.new +      pt=Pathname.new(@pwd) +      r=Px[:lng_lst_rgx] +      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ +      @pwd_stub=pt.realpath.to_s[u,1] +      @rc=@@rc ||=SiSU_Env::GetInit.new.sisu_yaml.rc +      @defaults=SiSU_Env::InfoEnv.new.defaults +    end +    def share_source? +      ((defined? @rc['db']['share_source']) \ +      && @rc['db']['share_source']==true) \ +      ? @rc['db']['share_source'] +      : false +    end +    def engine +      def default +        ((defined? @rc['db']['engine']['default']) \ +        && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ +        ? @rc['db']['engine']['default'] +        : 'sqlite' +      end +      self +    end +    def psql +      def user(opt=nil) +        if opt \ +        and opt.mod.inspect =~/--db-user[=-]["']?(\S+)["']+/ +          $1 +        elsif opt \ +        and opt.mod =~/--webserv[=-]webrick/ +          @env.user +        else +          ((defined? @rc['db']['postgresql']['user']) \ +          && @rc['db']['postgresql']['user']=~/\S+/) \ +          ? @rc['db']['postgresql']['user'] +          : @env.user +        end +      end +      def db #db_name +        "#{Db[:name_prefix]}#{@pwd_stub}" +      end +      def port #PGPORT +        ((defined? @rc['db']['postgresql']['port']) \ +        && ( @rc['db']['postgresql']['port'] =~/\d+/ \ +        || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \ +        ? @rc['db']['postgresql']['port'] +        : (@defaults[:postgresql_port]) +      end +      def password +        ((defined? @rc['db']['postgresql']['password']) \ +        && @rc['db']['postgresql']['password']=~/\S+/) \ +        ? @rc['db']['postgresql']['password'] +        : '' +      end +      def host +        ((defined? @rc['db']['postgresql']['host']) \ +        && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ +        ? @rc['db']['postgresql']['host'] +        : '' +      end +      def dbi +        PG::Connection.open(:dbname =>  psql.db) +      end +      def dbi_ +        (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ +        ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" +        : "DBI:Pg:database=#{psql.db};port=#{psql.port}" +      end +      def conn_dbi +        DBI.connect(psql.dbi,psql.user,psql.db) +      end +      def conn_pg +        require 'pg' +        PG::Connection.new(dbname: psql.db, port: psql.port) +      end +     self +    end +    def sqlite +      def db +        "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" +      end +      def db_discrete(md) +        # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" +      end +      def dbi +        "DBI:SQLite3:#{sqlite.db}" #sqlite3 ? +      end +      def sqlite3 +        sqlite.db #sqlite3 ? +      end +      def conn_dbi +        DBI.connect(sqlite.dbi) +      end +      def conn_sqlite3 +        SQLite3::Database.new(sqlite.sqlite3) +      end +      self +    end +  end +end +module SiSU_Db_Op +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class DbOp < SiSU_Info_Db::InfoDb +    def initialize(md) +      begin +        @md=md +      rescue +        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def sqlite_discrete +      def db +        @md.file.output_path.sqlite_discrete.dir \ +        + '/' \ +        + @md.file.base_filename.sqlite_discrete +      end +      def dbi +        "DBI:SQLite3:#{sqlite_discrete.db}" +      end +      def sqlite3 +        sqlite_discrete.db +      end +      def conn_dbi +        DBI.connect(sqlite_discrete.dbi) +      end +      def conn_sqlite3 +        begin +          $sqlite3=:yes +          require 'sqlite3' +          SQLite3::Database.new(sqlite_discrete.sqlite3) +        rescue LoadError +          $sqlite3=:no +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error('sqlite3 NOT FOUND (LoadError)') +        end +      end +      self +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_envcall.rb b/lib/sisu/v5/se_envcall.rb new file mode 100644 index 00000000..defc51e4 --- /dev/null +++ b/lib/sisu/v5/se_envcall.rb @@ -0,0 +1,329 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_envcall.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Env_Call +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class EnvCall +    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil +    @@ad={} +    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad +    def initialize(fns='') +      @fns=fns +      @sys=SiSU_Info_Sys::InfoSystem.instance +      get_init=SiSU_Env::GetInit.new +      @rc=get_init.sisu_yaml.rc +      @ad=get_init.ads +      if @fns \ +      and @fns != '' \ +      and @fns !=@@fns +        @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil +      end +      if @fns \ +      and @fns != '' #watch +        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ +        @@fnn ||=@fns[m,1] +        @@fnb ||=@fns[m,2] +        @@fnt ||=@fns[m,3] +        @@flv ||=document_language_versions_found[:f] +        unless @@fns =~/\S+?\.txz/ +          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' +          elsif @@fnb; @@fnb + '.sst.txz' +          else '' # e.g. termsheet +          end +        end +      end +      @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz +    end +    def default_language? +      if @rc \ +      && defined? @rc['language_default'] +        if (@rc['language_default'].is_a?(String)) \ +        && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/) +          @rc['language_default'] +        else 'en' +        end +      else 'en' +      end +    end +    def mono_multi_lingual? +      if @rc \ +      && defined? @rc['lingual'] +        if (@rc['lingual'].is_a?(String)) \ +        && (@rc['lingual'] =~/mono(?:lingual)?/) +          :mono +        elsif  (@rc['lingual'].is_a?(String)) \ +        && (@rc['lingual'] =~/multi(?:lingual)?/) +          :multi +        else :multi +        end +      else :multi +      end +    end +    def output_dir_structure +      def by? +        output_structure=:filename #set default output structure +        if @rc \ +        && defined? @rc['output_dir_structure_by'] +          output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ +          or ((defined? @rc['output_structure']['dump']) \ +          && @rc['output_structure']['dump'] ==true) +            :dump +          elsif (@rc['output_dir_structure_by'] =~/redirect/) \ +          or ((defined? @rc['output_structure']['redirect']) \ +          && @rc['output_structure']['redirect'] ==true) +            :redirect +          elsif (@rc['output_dir_structure_by'] =~/language/) \ +          or ((defined? @rc['output_structure']['by_language']) \ +          && @rc['output_structure']['by_language'] ==true) +            :language +          elsif (@rc['output_dir_structure_by'] =~/filetype/) \ +          or ((defined? @rc['output_structure']['by_filetype']) \ +          && @rc['output_structure']['by_filetype'] ==true) +            :filetype +          elsif (@rc['output_dir_structure_by'] =~/filename/) \ +          or ((defined? @rc['output_structure']['by_filename']) \ +          && @rc['output_structure']['by_filename'] ==true) +            :filename +          else #set default +            :language +          end +        else #set default +          :language +        end +      end +      def dump? +        ((by?) ==:dump) \ +        ? true +        : false +      end +      def redirect? +        ((by?) ==:redirect) \ +        ? true +        : false +      end +      def by_language_code? +        ((by?) ==:language) \ +        ? true +        : false +      end +      def by_filetype? +        ((by?) ==:filetype) \ +        ? true +        : false +      end +      def by_filename? +        ((by?) ==:filename) \ +        ? true +        : false +      end +      def multilingual? +        by_language_code? +      end +      self +    end +    def document_language_versions_found #REVISIT +      @fn={} +      filename=(@fns =~/\.ssm\.sst$/) \ +      ? @fns.gsub(/\.ssm\.sst$/,'.ssm') +      : @fns +      if filename.is_a?(String) \ +      and not filename.empty? +        if output_dir_structure.by_language_code? +          m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/ +          @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3] +        else m=/(.+?)\.(sst|ssm)$/ +          @fn[:b]=@fn[:m]=filename[m,1] +          @fn[:t]=filename[m,2] +        end +      end +      lng_base=SiSU_Env::InfoEnv.new.language_default_set +      lang=SiSU_Env::StandardiseLanguage.new +      langs=lang.codes +      x=[] +      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") +        n=@fn[:m].gsub(/^.+?\//,'') +        n =n + '.' + @fn[:t] +        x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } +      end +      langs.each do |l| +        lng=SiSU_Env::StandardiseLanguage.new(l) +        if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +          x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } +        elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") +          x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } +        end +        if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +          if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } +          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } +          end +        end +        if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +          if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } +          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } +          end +        end +      end +      @fn[:f]=x +      @fn +    end +    def published_manifests?(output_base) +      @fn={} +      @m=[] +      unless (@fns.nil? \ +      or @fns.empty?) +        if output_dir_structure.by_language_code? +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ +          @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] +        else m=/(.+?)\.((?:-|ssm\.)?sst$)/ +          @fn[:b]=@fn[:m]=@fns[m,1] +          @fn[:t]=@fns[m,2] +        end +      end +      lang=SiSU_Env::StandardiseLanguage.new +      langs=lang.codes +      x=[] +      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" +      end +      dir=SiSU_Env::InfoEnv.new(@fns) +      @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language +      langs.each do |l| +        lng=SiSU_Env::StandardiseLanguage.new(l) +        fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" +        fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" +        if FileTest.file?(fns_c) +          fn_set_lang=SiSU_Env::StandardiseLanguage.new. +            file_to_language(fns_c) #reconsider file_to_language +          lng=fn_set_lang[:n] +          fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) +          @m << { m: fn[:manifest], l: lng } +        elsif FileTest.file?(fns_l) +          fn_set_lang=SiSU_Env::StandardiseLanguage.new. +            file_to_language(fns_l) #reconsider file_to_language +          @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) +          fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) +          @m << { m: fn[:manifest], l: lng } +        end +      end +      @m=@m.uniq +    end +    def filename(code,name,suffix) +      "#{name}#{suffix}" +    end +    def lang(code) +      { +        html:            filename(code,'','.html'), +        book_index:      filename(code,'book_index','.html'), +        concordance:     filename(code,'concordance','.html'), +        sax:             filename(code,'sax','.xml'), +        dom:             filename(code,'dom','.xml'), +        docbook:         filename(code,'docbook','.xml'), +        xhtml:           filename(code,'scroll','.xhtml'), +        pdf_l:           filename(code,'','.pdf'), +        pdf_p:           filename(code,'','.pdf'), +        pdf_l_a4:        filename(code,"a4",'.pdf'), +        pdf_p_a4:        filename(code,"a4",'.pdf'), +        pdf_l_a5:        filename(code,"a5",'.pdf'), +        pdf_p_a5:        filename(code,"a5",'.pdf'), +        pdf_l_b5:        filename(code,"b5",'.pdf'), +        pdf_p_b5:        filename(code,"b5",'.pdf'), +        pdf_l_letter:    filename(code,"letter",'.pdf'), +        pdf_p_letter:    filename(code,"letter",'.pdf'), +        pdf_l_legal:     filename(code,"legal",'.pdf'), +        pdf_p_legal:     filename(code,"legal",'.pdf'), +        toc:             filename(code,'toc','.html'), +        doc:             filename(code,fnb,'.html'), +        index:           filename(code,'index','.html'), +        po:              filename(code,@fns,'.po'), +        pot:             filename(code,@fns,'.pot'), +        odf:             filename(code,'','.odt'), +        epub:            filename(code,'','.epub'), +        plain:           filename(code,'','.txt'), +        qrcode:          filename(code,'','.jpg'), +        manpage:         filename(code,'','.1'),          #fix, section number +        wiki:            filename(code,'wiki','.txt'), +        digest:          filename(code,'digest','.txt'), +        metadata:        filename(code,'metadata','.html'), #chk +        manifest:        filename(code,'manifest','.html'), +        oai_pmh:         filename(code,'oai_pmh','.xml'), +        sitemap:         filename(code,'sitemap','.xml'), +        sitemap_touch:   filename(code,"sitemap_#{fnb}",'.xml'), +        sxs:             filename(code,fnb,'.sxs.xml'), +        sxd:             filename(code,fnb,'.sxd.xml'), +        sxn:             filename(code,fnb,'.sxn.xml'), +        sisupod:         filename(nil,@fnz,''), +        book_idx_html:   filename(code,'book_index','.html'), +        book_idx_epub:   filename(code,'book_index','.xhtml'), +        epub_concord:    filename(code,'concordance','.xhtml'), +      } +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_file_op.rb b/lib/sisu/v5/se_file_op.rb new file mode 100644 index 00000000..d8a919dd --- /dev/null +++ b/lib/sisu/v5/se_file_op.rb @@ -0,0 +1,2662 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_file_op.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_File +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class InfoFile < SiSU_Info_Env::InfoEnv                  # se_info_env.rb +    #todo unify with FileOp +    def initialize(fns) +      begin +        super(fns) +        @fns=fns +        @env=SiSU_Env::InfoEnv.new(@fns) +        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ +        @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] +      rescue +        SiSU_Screen::Ansi.new('',$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def basefilename #Remove if possible +      m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m +      @fns[m,1] +    end +    def make_file(path,filename) +      (File.writable?("#{path}/.")) \ +      ? File.new("#{path}/#{filename}",'w+') +      : (SiSU_Screen::Ansi.new( +          '', +          "*WARN* is the file or directory writable?, could not create #{filename}" +        ).warn) +    end +    def touch_file(path,filename) +      if File.writable?("#{path}/."); +        FileUtils::touch("#{path}/#{filename}") +      else +        SiSU_Screen::Ansi.new( +          '', +          "*WARN* is the file or directory writable?, could not create #{filename}" +        ).warn +      end +    end +    def make_path(path) +      FileUtils::mkdir_p(path) unless FileTest.directory?(path) +    end +    def marshal +      def ao_content +        @env.processing_path.ao + '/' \ +          + @fns + '.content.rbm' +      end +      def ao_idx_sst_rel_html_seg +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_sst.rbm' +      end +      def ao_idx_sst_rel #used by tex & odf +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_raw.rbm' +      end +      def ao_idx_html +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_html.rbm' +      end +      def ao_idx_xhtml +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_xhtml.rbm' +      end +      def ao_metadata +        @env.processing_path.ao + '/' \ +          + @fns + '.metadata.rbm' +      end +      def ao_map_nametags +        @env.processing_path.ao + '/' \ +          + @fns + '.map_name_tags.rbm' +      end +      def ao_map_ocn_htmlseg +        @env.processing_path.ao + '/' \ +          + @fns + '.map_ocn_htmlseg.rbm' +      end +      def html_tune +        @env.processing_path.tune + '/' \ +          + @fns + '.marshal_tune' +      end +      self +    end +    def write_file_processing +      def html_tune +        File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+') +      end +      self +    end +    def mkdir #check moved from FileOp, existing mkdir +      def processing +        def ao +          FileUtils::mkdir_p(@env.processing_path.ao) \ +            unless FileTest.directory?(@env.processing_path.ao) +        end +        def tune +          FileUtils::mkdir_p(@env.processing_path.tune) \ +            unless FileTest.directory?(@env.processing_path.tune) +        end +        self +      end +    end +  end +end +module SiSU_File_Op +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class FileOp < SiSU_Info_File::InfoFile +    #todo unify with CreateFile +    def initialize(md,fno='') +      begin +        @md,@fno=md,fno +        @env=SiSU_Env::InfoEnv.new(@md.fns) +      rescue +        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def output_dir_structure +      SiSU_Env::ProcessingSettings.new(@md).output_dir_structure +    end +    def mkdir_initialize                # not used but consider using +      FileUtils::mkdir_p(output_path.base.dir) \ +        unless FileTest.directory?(output_path.base.dir) +      FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") \ +        unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") +      FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ +        unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") +      FileUtils::mkdir_p(@env.processing_path.ao) \ +        unless FileTest.directory?(@env.processing_path.ao) +      FileUtils::mkdir_p(@env.processing_path.tune) \ +        unless FileTest.directory?(@env.processing_path.tune) +    end +    def path_rel_links +      def html_scroll_2 +        if output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_seg_2 +        if output_dir_structure.by_language_code? +          '../../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def html_scroll_1 +        if output_dir_structure.by_language_code? +          '../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          './' +        end +      end +      def html_seg_1 +        if output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          './' +        end +      end +      def default_output_css +        if (@md.opt.opt_act[:dump][:bool] \ +        &&  @md.opt.opt_act[:dump][:inst]) \ +        || (@md.opt.opt_act[:redirect][:bool] \ +        &&  @md.opt.opt_act[:redirect][:inst]) +          './' +        elsif output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_scroll_css +        default_output_css +      end +      def xhtml_css +        default_output_css +      end +      def xml_css +        default_output_css +      end +      def html_seg_css +        if output_dir_structure.by_language_code? +          '../../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def manifest_css +        if output_dir_structure.by_language_code? +          '../../_sisu/css' +        elsif output_dir_structure.by_filetype? +          '' +        else +          '../' +        end +      end +      self +    end +    def mkdir +      def output +        def base +          FileUtils::mkdir_p(output_path.base.dir) \ +            unless FileTest.directory?(output_path.base.dir) +        end +        def css +          FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ +            unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") +        end +        def epub +          path=output_path.epub.dir +          make_path(path) +        end +        self +      end +      self +    end +    def mkfile #consider using more +      path="#{output_path.base.dir}/#{@md.fnb}" +      make_path(path) +      filename=@fno +      make_file(path,filename) +    end +    def mkfile_pwd +      path=Dir.pwd +      filename=@fno +      make_file(path,filename) +    end +    def write_file +      def txt +        path=output_path.txt.dir +        make_path(path) +        fn=base_filename.txt +        make_file(path,fn) +      end +      def textile +        path=output_path.textile.dir +        make_path(path) +        fn=base_filename.textile +        make_file(path,fn) +      end +      def asciidoc +        path=output_path.asciidoc.dir +        make_path(path) +        fn=base_filename.asciidoc +        make_file(path,fn) +      end +      def markdown +        path=output_path.markdown.dir +        make_path(path) +        fn=base_filename.markdown +        make_file(path,fn) +      end +      def rst +        path=output_path.rst.dir +        make_path(path) +        fn=base_filename.rst +        make_file(path,fn) +      end +      def html_scroll +        pth=output_path.html.dir +        make_path(pth) +        p_fn=place_file.html_scroll.dir +        @@filename_html_scroll=File.new(p_fn,'w+') +      end +      def html_seg_index +        pth=((output_dir_structure.by_filename?) \ +        || (output_dir_structure.dump?)) \ +        ? "#{output_path.html.dir}" +        : "#{output_path.html.dir}/#{@md.fnb}" +        make_path(pth) +        p_fn=place_file.html_seg_index.dir +        @@filename_html_index=File.new(p_fn,'w+') +      end +      def html_segtoc +        pth=((output_dir_structure.by_filename?) \ +        || (output_dir_structure.dump?) \ +        || (output_dir_structure.redirect?)) \ +        ? "#{output_path.html.dir}" +        : "#{output_path.html.dir}/#{@md.fnb}" +        make_path(pth) +        p_fn=place_file.html_segtoc.dir +        @@filename_html_index=File.new(p_fn,'w+') +      end +      def xhtml +        path=output_path.xhtml.dir +        make_path(path) +        fn=base_filename.xhtml +        make_file(path,fn) +      end +      def xml_sax +        path=output_path.xml.dir +        make_path(path) +        fn=base_filename.xml_sax +        make_file(path,fn) +      end +      def xml_dom +        path=output_path.xml.dir +        make_path(path) +        fn=base_filename.xml_dom +        make_file(path,fn) +      end +      def xml_docbook_book +        path=output_path.xml_docbook_book.dir +        make_path(path) +        fn=base_filename.xml_docbook_book +        make_file(path,fn) +      end +      def xml_fictionbook +        path=output_path.xml_fictionbook.dir +        make_path(path) +        fn=base_filename.xml_fictionbook +        make_file(path,fn) +      end +      def xml_scaffold_structure_sisu +        path=output_path.xml_scaffold_structure_sisu.dir +        make_path(path) +        fn=base_filename.xml_scaffold_structure_sisu +        make_file(path,fn) +      end +      def xml_scaffold_structure_collapse +        path=output_path.xml_scaffold_structure_collapse.dir +        make_path(path) +        fn=base_filename.xml_scaffold_structure_collapse +        make_file(path,fn) +      end +      def manpage +        path=output_path.manpage.dir +        make_path(path) +        fn=base_filename.manpage +        make_file(path,fn) +      end +      def texinfo +        path=output_path.texinfo.dir +        make_path(path) +        fn=base_filename.texinfo +        make_file(path,fn) +      end +      def info +        path=output_path.texinfo.dir +        make_path(path) +        fn=base_filename.info +        make_file(path,fn) +      end +      def hash_digest +        path=output_path.hash_digest.dir +        make_path(path) +        fn=base_filename.hash_digest +        make_file(path,fn) +      end +      def qrcode +        path=output_path.qrcode.dir +        make_path(path) +        fn=base_filename.qrcode +        make_file(path,fn) +      end +      def manifest +        path=output_path.manifest.dir +        make_path(path) +        fn=base_filename.manifest +        make_file(path,fn) +      end +      def manifest_txt +        path=output_path.manifest.dir +        make_path(path) +        fn=base_filename.manifest_txt +        make_file(path,fn) +      end +      def pot +        path=output_path.pot.dir +        make_path(path) +        fn=base_filename.pot +        make_file(path,fn) +      end +      def po +        path=output_path.po.dir +        make_path(path) +        fn=base_filename.po +        make_file(path,fn) +      end +      self +    end +    def place_file +      def txt +        def dir +          output_path.txt.dir + '/' \ +          + base_filename.txt +        end +        def rel +          output_path.txt.rel + '/' \ +          + base_filename.txt +        end +        self +      end +      def textile +        def dir +          output_path.textile.dir + '/' \ +          + base_filename.textile +        end +        def rel +          output_path.textile.rel + '/' \ +          + base_filename.textile +        end +        self +      end +      def asciidoc +        def dir +          output_path.asciidoc.dir + '/' \ +          + base_filename.asciidoc +        end +        def rel +          output_path.asciidoc.rel + '/' \ +          + base_filename.asciidoc +        end +        self +      end +      def markdown +        def dir +          output_path.markdown.dir + '/' \ +          + base_filename.markdown +        end +        def rel +          output_path.markdown.rel + '/' \ +          + base_filename.markdown +        end +        self +      end +      def rst +        def dir +          output_path.rst.dir + '/' \ +          + base_filename.rst +        end +        def rel +          output_path.rst.rel + '/' \ +          + base_filename.rst +        end +        self +      end +      def html_scroll +        def dir +          output_path.html_scroll.dir + '/' \ +          + base_filename.html_scroll +        end +        def rel +          output_path.html_scroll.rel + '/' \ +          + base_filename.html_scroll +        end +        self +      end +      def html_seg_index +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_seg_index +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_seg_index +        end +        self +      end +      def html_segtoc +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_segtoc +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_segtoc +        end +        self +      end +      def html_book_index +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_book_index +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_book_index +        end +        self +      end +      def html_concordance +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_concordance +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_concordance +        end +        self +      end +      def odt +        def dir +          output_path.odt.dir + '/' \ +          + base_filename.odt +        end +        def rel +          output_path.odt.rel + '/' \ +          + base_filename.odt +        end +        self +      end +      def epub +        def dir +          output_path.epub.dir + '/' \ +          + base_filename.epub +        end +        def rel +          output_path.epub.rel + '/' \ +          + base_filename.epub +        end +        self +      end +      def pdf_p +        STDERR.puts 'ERROR not available due to multiple page format sizes' +      end +      def pdf_l +        STDERR.puts 'ERROR not available due to multiple page format sizes' +      end +      def xhtml +        def dir +          output_path.xhtml.dir + '/' \ +          + base_filename.xhtml +        end +        def rel +          output_path.xhtml.rel + '/' \ +          + base_filename.xhtml +        end +        self +      end +      def xml_sax +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_sax +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_sax +        end +        self +      end +      def xml_dom +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_dom +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_dom +        end +        self +      end +      def xml_docbook_book +        def dir +          output_path.xml_docbook.dir + '/' \ +          + base_filename.xml_docbook_book +        end +        def rel +          output_path.xml_docbook.rel + '/' \ +          + base_filename.xml_docbook_book +        end +        self +      end +      def xml_fictionbook +        def dir +          output_path.xml_fictionbook.dir + '/' \ +          + base_filename.xml_fictionbook +        end +        def rel +          output_path.xml_fictionbook.rel + '/' \ +          + base_filename.xml_fictionbook +        end +        self +      end +      def xml_scaffold_structure_sisu +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_scaffold_structure_sisu +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_scaffold_structure_sisu +        end +        self +      end +      def xml_scaffold_structure_collapse +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_scaffold_structure_collapse +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_scaffold_structure_collapse +        end +        self +      end +      def sqlite_discrete +        def dir +          output_path.sqlite_discrete.dir + '/' \ +          + base_filename.sqlite_discrete +        end +        def rel +          output_path.sqlite_discrete.rel + '/' \ +          + base_filename.sqlite_discrete +        end +        self +      end +      def hash_digest +        def dir +          output_path.hash_digest.dir + '/' \ +          + base_filename.hash_digest +        end +        def rel +          output_path.hash_digest.rel + '/' \ +          + base_filename.hash_digest +        end +        self +      end +      def src +        def dir +          output_path.src.dir + '/' \ +            + base_filename.src +        end +        def rel +          output_path.src.rel + '/' \ +          + base_filename.src +        end +        self +      end +      def sisupod +        def dir +          output_path.sisupod.dir + '/' \ +          + base_filename.sisupod +        end +        def rel +          output_path.sisupod.rel + '/' \ +          + base_filename.sisupod +        end +        self +      end +      def po +        def dir +          output_path.po.dir + '/' \ +          + base_filename.po +        end +        def rel +          output_path.po.rel + '/' \ +          + base_filename.po +        end +        self +      end +      def pot +        def dir +          output_path.pot.dir + '/' \ +          + base_filename.pot +        end +        def rel +          output_path.pot.rel + '/' \ +          + base_filename.pot +        end +        self +      end +      def po_git +        def dir +          output_path.po_git + '/' \ +          + base_filename.po +        end +        def rel +          #output_path.po_git + '/' + base_filename.po +        end +        self +      end +      def pot_git +        def dir +          output_path.pot_git + '/' \ +          + base_filename.pot +        end +        def rel +          #output_path.pot_git + '/' + base_filename.pot +        end +        self +      end +      def manpage +        def dir +          output_path.manpage.dir + '/' \ +          + base_filename.manpage +        end +        def rel +          output_path.manpage.rel + '/' \ +          + base_filename.manpage +        end +        self +      end +      def texinfo +        def dir +          output_path.texinfo.dir + '/' \ +          + base_filename.texinfo +        end +        def rel +          output_path.texinfo.rel + '/' \ +          + base_filename.texinfo +        end +        self +      end +      def info +        def dir +          output_path.texinfo.dir + '/' \ +          + base_filename.info +        end +        def rel +          output_path.texinfo.rel + '/' \ +          + base_filename.info +        end +        self +      end +      def qrcode_title +        def dir +          output_path.qrcode.dir + '/' \ +          + base_filename.qrcode_title +        end +        def rel +          output_path.qrcode.rel + '/' \ +          + base_filename.qrcode_title +        end +        self +      end +      def qrcode_md +        def dir +          output_path.qrcode.dir + '/' \ +          + base_filename.qrcode_md +        end +        def rel +          output_path.qrcode.rel + '/' \ +          + base_filename.qrcode_md +        end +        self +      end +      def manifest +        def dir +          output_path.manifest.dir + '/' \ +            + base_filename.manifest +        end +        def rel +          output_path.manifest.rel + '/' \ +            + base_filename.manifest +        end +        self +      end +      self +    end +    def base_filename +      def i18n(f) +        f=default_hash.merge(f) +        f[:lng] ||=@md.lang_code_insert +        f[:fn] + f[:lng] + f[:ft] +      end +      def default_hash +        { +          fn: @md.fnb, +          lng: @md.lang_code_insert, +        } +      end +      def default_hash_build(fh,sfx) +        if fh.is_a?(Hash) +          fh[:fn] ||=@md.fnb +          fh[:lng] ||= @md.lang_code_insert +          fh[:ft]=sfx +          fh +        else +          { +            fn: @md.fnb, +            lng: @md.lang_code_insert, +            ft: sfx, +          } +        end +      end +      def lang_code?(lng) +        (output_dir_structure.by_language_code?) \ +        ? '' +        : (lng ||=@md.lang_code_insert) +      end +      def txt(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def textile(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_textile]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def asciidoc(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_asciidoc]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def markdown(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_markdown]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def rst(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_rst]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_scroll(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_seg_index(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: 'index', +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def html_segtoc(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: fh[:fn] + '.toc', +            ft: fh[:ft], +          } +        else +          { +            fn: 'toc', +            ft: fh[:ft], +            lng: lang_code?(fh[:lng]), +          } +        end +        i18n(fnh) +      end +      def html_seg(fh) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_book_index(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: 'book_index', +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def html_concordance(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: 'concordance', +            ft: fh[:ft], +          } +        else +          { +            fn: 'concordance', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xhtml(fh=nil) +        fh=default_hash_build(fh,Sfx[:xhtml]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def epub(fh=nil) +        fh=default_hash_build(fh,Sfx[:epub]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def odt(fh=nil) +        fh=default_hash_build(fh,Sfx[:odt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'opendocument', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_sax(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_sax]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_dom(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_dom]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_docbook_book(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_docbook_book]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_fictionbook(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_fictionbook]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_scaffold_structure_sisu(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_scaffold_structure_collapse(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def pdf_p(fh=nil) +        fh=default_hash_build(fh,Sfx[:pdf]) +        fh[:lng]=lang_code?(fh[:lng]) +        if output_dir_structure.by_filename? +          'portrait' + fh[:lng] + '.' +        else +          fh[:fn] + '.portrait' + fh[:lng] + '.' +        end +      end +      def pdf_l(fh=nil) +        fh=default_hash_build(fh,Sfx[:pdf]) +        fh[:lng]=lang_code?(fh[:lng]) +        if output_dir_structure.by_filename? +          'landscape' + fh[:lng] + '.' +        else +          fh[:fn] + '.landscape' + fh[:lng] + '.' +        end +      end +      def pdf_p_a4(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_a4] +      end +      def pdf_p_a5(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_a5] +      end +      def pdf_p_b5(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_b5] +      end +      def pdf_p_letter(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_letter] +      end +      def pdf_p_legal(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_legal] +      end +      def pdf_l_a4(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_a4] +      end +      def pdf_l_a5(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_a5] +      end +      def pdf_l_b5(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_b5] +      end +      def pdf_l_letter(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_letter] +      end +      def pdf_l_legal(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_legal] +      end +      def manpage(fh=nil) +        fh=default_hash_build(fh,Sfx[:manpage]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def info(fh=nil) +        fh=default_hash_build(fh,Sfx[:info]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def texinfo(fh=nil) +        fh=default_hash_build(fh,Sfx[:texinfo]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def sqlite_discrete(fh=nil) +        fh=default_hash_build(fh,Sfx[:sql]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def hash_digest(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_language_code? +          { +            fn: fh[:fn] + '.hash_digest', +            ft: fh[:ft], +          } +        elsif output_dir_structure.by_filetype? +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: 'digest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def sitemap(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_language_code? +          { +            fn: fh[:fn] + '.sitemap', +            ft: fh[:ft], +          } +        elsif output_dir_structure.by_filetype? +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: 'sitemap', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def qrcode_title(fh=nil) +        fh=default_hash_build(fh,'.title.png') +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def qrcode_md #check name below +        fh=default_hash_build(fh,'.md.png') +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def manifest_txt(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def manifest(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: fh[:fn] + '.manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        elsif output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def src +        @md.fno +      end +      def po #check +        (@fno.empty?) \ +        ? (@md.fn[:po]) +        : (@fno + '.po') +      end +      def pot +        (@fno.empty?) \ +        ? (@md.fn[:pot]) +        : (@fno + '.pot') +      end +      def sisupod +        (@md.fns =~/\.ssm\.sst$/) \ +        ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz') +        : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz') +      end +      self +    end +    def set_path(ft) +      @ft=ft +      def dir +        def abc +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          elsif output_dir_structure.by_language_code? +            output_path.base.dir + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.base.dir + '/' + @ft +          else +            output_path.base.dir + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          elsif output_dir_structure.by_language_code? +            output_path.base.dir + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.base.dir + '/' + @ft +          end +        end +        def ab_src +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          else +            output_path.base.dir + '/' \ +              + @ft + '/' \ +              + @md.opt.fng + '/' \ +              + Gt[:sisupod] + '/' \ +              + Gt[:doc] + '/' \ +              + @md.opt.lng +          end +        end +        def ab_pod +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          else +            output_path.base.dir + '/' + @ft +          end +        end +        self +      end +      def url +        def abc +          if output_dir_structure.by_language_code? +            output_path.base.url + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.base.url + '/' + @ft +          else +            output_path.base.url + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            output_path.base.url + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.base.url + '/' + @ft +          end +        end +        def ab_src +          output_path.base.url + '/' \ +            + @ft + '/' \ +            + @md.opt.fng + '/' \ +            + Gt[:sisupod] + '/' \ +            + Gt[:doc] + '/' \ +            + @md.opt.lng +        end +        def ab_pod +          output_path.base.url + '/' + @ft +        end +        self +      end +      def rel +        def abc +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            @ft +          else +            @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          else +            @ft +          end +        end +        def ab_src +          @ft +        end +        def ab_pod +          @ft +        end +        self +      end +      def rel_sm +        def abc +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            @ft +          else +            @md.fnb +          end +        end +        def ab +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? \ +          or output_dir_structure.by_filetype? +            '../' + @ft +          else '.' +          end +        end +        def ab_src +          locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? +            '../../' + locate +          else +            '../' + locate +          end +        end +        def ab_pod +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? +            '../../' + @ft +          else +            '../' + @ft +          end +        end +        self +      end +      def rcp +        def abc +          if output_dir_structure.by_language_code? +            output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.stub.rcp + '/' + @ft +          else +            output_path.stub.rcp + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.stub.rcp + '/' + @ft +          end +        end +        self +      end +      self +    end +    def output_path +      def web_base +        def dir +          @env.path.webserv +        end +        def url +          #"#{@env.url.root}" +        end +        def rel +          '.' +        end +        def rcp +          '.' +        end +        self +      end +      def stub +        def dir +          @md.opt.f_pth[:pth_stub] +        end +        #def url +        #  "#{@env.url.root}" +        #end +        def rel +          './' + @md.opt.f_pth[:pth_stub] +        end +        def rcp +          @md.opt.f_pth[:pth_stub] +        end +        self +      end +      def webserver_path +        if output_dir_structure.dump? +          @md.opt.opt_act[:dump][:inst] +        elsif output_dir_structure.redirect? +          @md.opt.opt_act[:redirect][:inst] +        else +          @env.path.webserv +        end +      end +      def base +        def dir +          webserver_path + '/' + @md.opt.f_pth[:pth_stub] +        end +        def url +          @env.url.webserv + '/' + @md.opt.f_pth[:pth_stub] +        end +        def rel +          './' + @md.opt.f_pth[:pth_stub] +        end +        def rcp +          './' + @md.opt.f_pth[:pth_stub] +        end +        self +      end +      def sisugit +        def dir +          output_path.base.dir + '/git' +        end +        def url +          output_path.base.url + '/git' +        end +        def rel +          output_path.base.rel + '/git' +        end +        def rcp +          output_path.base.rcp + '/git' +        end +        self +      end +      #def pod +      #  ft='pod' +      #  path=set_path(ft).dir.ab +      #end +      def src +        def ft +          Gt[:src] +        end +        def dir +          set_path(ft).dir.ab_src +        end +        def url +          set_path(ft).url.ab_src +        end +        def rel +          set_path(ft).rel.ab_src +        end +        def rcp +          set_path(ft).rcp.ab_src +        end +        def rel_sm +          set_path(ft).rel_sm.ab_src +        end +        self +      end +      def sisupod +        def ft +          Gt[:src] +        end +        def dir +          set_path(ft).dir.ab_pod +        end +        def url +          set_path(ft).url.ab_pod +        end +        def rel +          set_path(ft).rel.ab_pod +        end +        def rcp +          set_path(ft).rcp.ab_pod +        end +        def rel_sm +          set_path(ft).rel_sm.ab_pod +        end +        self +      end +      def po +        def dir +          output_path.base.dir + '/' \ +            + Gt[:src] + '/' \ +            + @md.opt.fng + '/po4a/po/' \ +            + @md.opt.lng +        end +        def url +          output_path.base.url + '/po4a/' \ +            + @md.fnb + '/po/' \ +            + @md.opt.lng +        end +        self +      end +      def pot +        def dir +         output_path.base.dir + '/' \ +           + Gt[:src] + '/' \ +           + @md.opt.fng + '/po4a/pot' +        end +        def url +          output_path.base.url + '/po4a/' \ +            + @md.fnb + '/pot' +        end +        def rcp +          #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" +        end +        self +      end +      def po_git # consider !!! +        def ft +          Gt[:po] +        end +        def dir +          pth=@env.processing_path.git + '/' \ +            + @md.fnb + '/' \ +            + ft + '/' \ +            + @md.opt.lng +          FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +          pth +        end +        self +      end +      def pot_git # consider !!! +        def ft +          Gt[:pot] +        end +        def dir +          @env.processing_path.git + '/' \ +            + @md.fnb + '/' \ +            + ft +        end +        self +      end +      def md_harvest +        manifest +        self +      end +      def txt +        def ft +          'txt' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def textile +        def ft +          'textile' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def asciidoc +        def ft +          'asciidoc' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def markdown +        def ft +          'markdown' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def rst +        def ft +          'rst' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def html_scroll +        def ft +          'html' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def html_seg +        def ft +          'html/' + @md.fnb +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def html_concordance +        html_seg +        self +      end +      def html +        def ft +          'html' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).url.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def xhtml +        def ft +          'xhtml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def epub +        def ft +          'epub' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          './image' +        end +        self +      end +      def odt +        def ft +          'odt' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def xml +        def ft +          'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_sax +        xml +        self +      end +      def xml_dom +        xml +        self +      end +      def xml_docbook +        def ft +          'docbook' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_docbook_article +        def ft +          'docbook' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_docbook_book +        def ft +          'docbook' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_fictionbook +        def ft +          'fictionbook' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_scaffold_structure_sisu +        def ft +          'sisu.scaffold.xml' +          #'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_scaffold_structure_collapse +        def ft +          'collapsed.scaffold.xml' +          #'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def pdf +        def ft +          'pdf' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def sqlite_discrete +        def ft +          'sql' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def hash_digest +        def ft +          'hashes' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def manifest +        def ft +          'manifest' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        def rcp +          set_path(ft).rcp.abc +        end +        self +      end +      def qrcode +        def ft +          'manifest/qrcode' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def harvest +        def ft +          'site_metadata' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          if output_dir_structure.by_language_code? +            '' +          elsif output_dir_structure.by_filetype? +            '' +          else +            '' +          end +        end +        self +      end +      def manpage +        def ft +          'man' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def texinfo +        def ft +          'texinfo' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def sitemaps +        def ft +          'sitemaps' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        self +      end +      def sqlite #check url +        def dir +          output_path.base.dir +        end +        def url +          output_path.base.url +        end +        def rel +          output_path.base.rel +        end +        def rcp +          output_path.base.rcp +        end +        self +      end +      #def cgi +      #end +      def css +        @d='_sisu/css' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          @d +          #output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.stub.rcp + '/' + @d +        end +        self +      end +      def images +        @d='_sisu/image' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          @d +          #output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.stub.rcp + '/' + @d +        end +        self +      end +      def images_external +        @d='_sisu/image_external' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.base.rcp + '/' + @d +        end +        self +      end +      #def css +      #  #"#{@env.path.output}/#{@env.path.style}" +      #end +      self +    end +  end +end +module SiSU_Create_File +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class CreateFile < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    #todo unify with FileOp +    def initialize(fns) +      begin +        super(fns) +        @env=SiSU_Env::InfoEnv.new(fns) +      rescue +        SiSU_Screen::Ansi.new('',$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def html_root +      #@env.path.output +    end +    def mkdir_pdf +      Dir.mkdir(@env.processing_path.tex) \ +        unless FileTest.directory?(@env.processing_path.tex) +    end +    def file_generic(output_file='') +      fn=@env.path.output + '/' \ +      + @fnb + '/' \ +      + output_file +      File.new(fn,'w+') +    end +    def file_error +      fn='/tmp/errorlog.sisu' +      File.new(fn,'w+') +    end +    def file_txt +      fn=@env.processing_path.ao + '/' \ +      + @fns + '.txt' +      File.new(fn,'w+') +    end +    def file_debug +      fn=@env.processing_path.ao + '/' \ +      + @fns + '.debug.txt' +      File.new(fn,'w+') +    end +    def metaverse +      def file_meta +        fn=@env.processing_path.ao + '/' \ +        + @fns + '.meta' +        File.new(fn,'w+') +      end +      def file_meta_idx_html +        fn=@env.processing_path.ao + '/' \ +        + @fns + '.idx.html' +        File.new(fn,'w+') +      end +      self +    end +    def file_note +      fn=Dir.pwd + '/' \ +      + @fns + '.fn' +      File.new(fn,'w+') +    end +    def meta +      @env.processing_path.ao + '/' \ +      + @fns + '.meta' +    end +    def file_semantic +      fn='./semantic.yaml' +      @@filename_semantic=File.new(fn,'w+') +    end +    def file_rss +      fn='./semantic.xml' +      @@filename_rss=File.new(fn,'w+') +    end +    def epub +      @pth=@env.processing_path.epub +      def xhtml_index +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/index.xhtml' +        File.new(fn,'w+') +      end +      def xhtml_cover_image +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/cover_image.xhtml' +        File.new(fn,'w+') +      end +      def xhtml_segtoc +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/toc.xhtml' +        File.new(fn,'w+') +      end +      def mimetype  #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype +        File.new("#{@pth}/mimetype",'w') +      end +      def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/' \ +        + Ep[:f_opf] +        File.new(fn,'w') +      end +      def toc_ncx  #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/' \ +        + Ep[:f_ncx] +        File.new(fn,'w') +      end +      def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml +        fn=@pth + '/META-INF/container.xml' +        File.new(fn,'w') +      end +      def xhtml_css #fixed epub xhtml css +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/css/xhtml.css' +        File.new(fn,'w') +      end +      self +    end +    def file_texinfo +      fn=@env.processing_path.texinfo + '/' \ +      + @fnb + '.texinfo' +      File.new(fn,'w+') +    end +  end +end +module SiSU_Filename_Lang +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class FilenameLanguageCodeInsert +    def initialize(opt,lng=nil) +      @opt=opt +      @lng=lng ||=opt.lng +    end +    def language_code_insert +      if @opt.dir_structure_by ==:language \ +      or ((@opt.dir_structure_by ==:filetype \ +      || @opt.dir_structure_by ==:filename) \ +      and (@opt.lingual ==:mono \ +      && @lng == @opt.act[:default_language][:code])) +        '' +      elsif (@opt.dir_structure_by ==:filetype \ +      || @opt.dir_structure_by ==:filename) \ +      and not @opt.lingual ==:mono +        '.' + @lng +      else +        '.' + @lng +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_filemap.rb b/lib/sisu/v5/se_filemap.rb new file mode 100644 index 00000000..99de4a0c --- /dev/null +++ b/lib/sisu/v5/se_filemap.rb @@ -0,0 +1,247 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_filemap.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_File_Map +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class FileMap < SiSU_Info_Env::InfoEnv                   # se_info_env.rb +    attr_accessor :local_sisu_source +    def initialize(opt='') #watch / REVIEW +      super() +      @opt=opt #,opt.fns,opt.cmd +      @env=(@opt.fns && !(@opt.fns.empty?) \ +      ? (SiSU_Env::InfoEnv.new(@opt.fns)) +      : (SiSU_Env::InfoEnv.new('dummy.sst'))) +      ft=[] +      if @opt.act[:ao][:set]==:on +        @md=SiSU_Param::Parameters.new(@opt).get +        if @md \ +        and defined? @md.fn \ +        and @md.fn        # used for by_language_code? +          if @md.opt.act[:html][:set]==:on                 #% --html, -h -H +            ft << @md.fn[:html] +          end +          if @md.opt.act[:concordance][:set]==:on          #% --concordance, -w +            ft << @md.fn[:concordance] +          end +          if @md.opt.act[:manifest][:set]==:on             #% --manifest, -y +            ft << @md.fn[:manifest] +          end +          if @md.opt.act[:txt][:set]==:on                  #% --txt, -t -a +            ft << @md.fn[:plain] +          end +          if @md.opt.act[:txt_textile][:set]==:on          #% --textile +            ft << @md.fn[:txt_textile] +          end +          if @md.opt.act[:txt_asciidoc][:set]==:on         #% --asciidoc +            ft << @md.fn[:txt_asciidoc] +          end +          if @md.opt.act[:txt_markdown][:set]==:on         #% --markdown +            ft << @md.fn[:txt_markdown] +          end +          if @md.opt.act[:txt_rst][:set]==:on              #% --rst, --rest +            ft << @md.fn[:txt_rst] +          end +          if @md.opt.act[:xhtml][:set]==:on                #% --xhtml, -b xhtml +            ft << @md.fn[:xhtml] +          end +          if @md.opt.act[:epub][:set]==:on                 #% --epub, -e +            ft << @md.fn[:epub] +          end +          if @md.opt.act[:manpage][:set]==:on              #% --manpage, -i +            ft << @md.fn[:manpage] +          end +          if @md.opt.act[:hash_digests][:set]==:on         #% --hash-digests, -N digest tree +            ft << @md.fn[:digest] +          end +          if @md.opt.act[:odt][:set]==:on                  #% --odt, -o opendocument +            ft << @md.fn[:odf] +          end +          if @md.opt.act[:pdf][:set]==:on                  #% --pdf-l --pdf, -p latex/ texpdf +            ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] +          end +          if @md.opt.act[:share_source][:set]==:on +            ft << @md.fns +          end +          if @md.opt.act[:sisupod][:set]==:on              #% --sisupod, -S make sisupod +            ft << @md.fn[:sisupod] +          end +          if @md.opt.act[:xml_sax][:set]==:on              #% --xml-sax, -x xml sax type +            ft << @md.fn[:sax] +          end +          if @md.opt.act[:xml_dom][:set]==:on              #% --xml-dom, -X xml dom type +            ft << @md.fn[:dom] +          end +          if @md.opt.act[:xml_docbook_book][:set]==:on     #% --xml-docbook-book +            ft << @md.fn[:xml_docbook_book] +          end +          if @md.opt.act[:xml_fictionbook][:set]==:on      #% --xml-fictionbook +            ft << @md.fn[:xml_fictionbook] +          end +          if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu +            ft << @md.fn[:xml_scaffold_structure_sisu] +          end +          if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse +            ft << @md.fn[:xml_scaffold_structure_collapse] +          end +          @fnb=@md.fnb +        else   # still needed where/when param is not parsed +          if @opt.act[:html][:set]==:on                    #% --html, -h -H +            ft << '.html' << '.html.??' +          end +          if @opt.act[:concordance][:set]==:on             #% --concordance, -w +            ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' +          end +          if @opt.act[:manifest][:set]==:on                #% --manifest, -y +            ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' +          end +          if @opt.act[:txt][:set]==:on                     #% --txt, -t -a +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_textile][:set]==:on             #% --textile +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_asciidoc][:set]==:on            #% --asciidoc +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_markdown][:set]==:on            #% --markdown +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_rst][:set]==:on                 #% --rst, --rest +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:xhtml][:set]==:on                   #% --xhtml, -b xhtml +            ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' +          end +          if @opt.act[:epub][:set]==:on                    #% --epub, -e +            ft  << @fnb << '.epub' +          end +          if @opt.act[:manpage][:set]==:on                 #% --manpage, -i +            ft << '.1' << '??.man.1' << 'man.??.1' +          end +          if @opt.act[:hash_digests][:set]==:on            #% --hash-digests, -N digest tree +            ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' +          end +          if @opt.act[:odt][:set]==:on                     #% --odt, -o opendocument +            ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' +          end +          if @opt.act[:pdf][:set]==:on                     #% --pdf-l --pdf, -p latex/ texpdf +            ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' +          end +          if @opt.act[:share_source][:set]==:on +            ft << '.sst' << '.ssi' << '.ssm' +          end +          if @opt.act[:sisupod][:set]==:on                 #% --sisupod, -S make sisupod +            ft << '.zip' +          end +          if @opt.act[:xml_sax][:set]==:on                 #% --xml-sax, -x xml sax type +            ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' +          end +          if @opt.act[:xml_dom][:set]==:on                 #% --xml-dom, -X xml dom type +            ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' +          end +          if @opt.act[:xml_docbook_book][:set]==:on        #% --xml-docbook-book +            ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml' +          end +          if @opt.act[:xml_fictionbook][:set]==:on         #% --xml-fictionbook +            ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml' +          end +          if @opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu +            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' +          end +          if @opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse +            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' +          end +        end +        ft=ft.uniq +        filetypes=ft.join(',') +        @filetypes=if filetypes !~/..+/ then ''   # -r called alone, copy all +        elsif @opt.cmd =~/u/            then ''   # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u +        elsif filetypes =~/\S+?,\S+/    then '*{' + filetypes + '}' # more than one relevant file type +        else                                 '*' + filetypes # one relevant file type +        end +        @source_path=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/#{@fnb}" +        : @env.path.output) +        @source_path_epub=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/epub" +        : @env.path.output_epub) +        @source_path_src=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/src" +        : @env.path.output_src) +        @source_path_pod=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/pod" +        : @env.path.output_pod) +        @source_path_harvest=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/manifest" +        : @env.path.output_harvest) +        @local_sisu_source=(@filetypes =~/\S/) \ +        ? "#{@source_path}/#{@filetypes}" +        : @source_path +      end +      if @opt.act[:rsync][:set]==:on +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_get_init.rb b/lib/sisu/v5/se_get_init.rb new file mode 100644 index 00000000..63173ba9 --- /dev/null +++ b/lib/sisu/v5/se_get_init.rb @@ -0,0 +1,235 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_get_init.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Get_Init +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_system'                        # se_info_system.rb +  @@noyaml=false +  class GetInit < SiSU_Info_Sys_Gen::InfoSystemGen         # se_info_system.rb +    @@noyaml=false +    @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil +    @@ad={ promo: nil, promo_list: nil, flag_promo: false } +    @@sdmd=nil +    attr_accessor :yaml +    def initialize +      super() +        @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory +          false +        else +          @@sdmd=$sisu_document_markup_directory +          true +        end +    end +    def tex +      @@tx ||=SiSU_Viz::TeX.new +    end +    def rc_path_options +      [ +        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", +        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", +        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", +        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", +        "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", +        "#{@@home}/.sisu", +        "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", +        "#{@@sisu_etc}", +      ] +    end +    def sisu_document_make +      def makefile_name +        S_CONF[:header_make] +      end +      def makefile +        rc_path_options.each do |v| +          if FileTest.exist?("#{v}/#{makefile_name}") +            @sisu_make_path=v +            break +          end +        end +        @sisu_make_file_path=@sisu_make_path \ +        ? "#{@sisu_make_path}/#{makefile_name}" +        : nil +      end +      def makefile_read +        if makefile +          sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8') +          @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m) +        end +        @sisu_doc_makefile +      end +      self +    end +    def sisu_yaml +      def rc +        if @markup_dir_changed_ +          rc_path_options.each do |v| +            if @@noyaml \ +            or FileTest.exist?("#{v}/noyaml") +              STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml +              @@noyaml=true +              break +            else +              f=S_CONF[:rc_yml] +              p_f="#{v}/#{f}" +              if FileTest.exist?(p_f) +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@sisurc_path=v +                @@rc=YAML::load(File::open(p_f)) +                break +              end +              unless @@rc +                f='sisurc.yaml' +                p_f="#{v}/#{f}" +                if FileTest.exist?(p_f) +                  begin +                    require 'yaml' +                  rescue LoadError +                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                      error('yaml NOT FOUND (LoadError)') +                  end +                  @@sisurc_path=v +                  @@rc=YAML::load(File::open(p_f)) +                  break +                end +              end +            end +          end +        end +        @@rc +      end +      def rc_path +        rc +        @@sisurc_path +      end +      self +    end +    def ads #WORK AREA +      tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' +      if @markup_dir_changed_ +        @ad_path=[ +          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", +          "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{@@home}/.sisu/skin/yml", +          "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", +          "#{@@sisu_etc}/skin/yml", +        ] +        @ad_path.each do |v| +          if @@noyaml \ +          or FileTest.exist?("#{v}/noyaml") +            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml +            @@noyaml=true +            break +          else +            if FileTest.exist?("#{v}/list.yml") +              unless @@ad[:promo_list] +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) +              end +              @@ad[:flag_promo]=true +              break +            end +            @@ad[:flag_promo]=false +          end +        end +        @ad_path.each do |v| +          if @@noyaml \ +          or FileTest.exist?("#{v}/noyaml") +            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml +            @@noyaml=true +            break +          else +            if FileTest.exist?("#{v}/promo.yml") +              unless @@ad[:promo] +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) +              end +              @@ad[:flag_promo]=true +              break +            end +            @@ad[:flag_promo]=false +          end +        end +      end +      @@ad +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_info_env.rb b/lib/sisu/v5/se_info_env.rb new file mode 100644 index 00000000..df3d0216 --- /dev/null +++ b/lib/sisu/v5/se_info_env.rb @@ -0,0 +1,2172 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_info_env.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +@@current_document=Dir.pwd #nil #'' +module SiSU_Info_Env +  require_relative 'se_envcall'                            # se_envcall.rb +  begin +    require 'singleton' +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton or fileutils NOT FOUND (LoadError)') +  end +  class InfoEnv < SiSU_Env_Call::EnvCall                   # se_envcall.rb +    begin +      require 'pathname' +      require 'fileutils' +        include FileUtils +    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,: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) +      super() #you may not want to re-execute this static info so frequently! +      @init=SiSU_Env::GetInit.new #SiSU_Get_Init::GetInit +      @fns,@md=fns,md +      @env=SiSU_Env::EnvCall.new(fns) if fns #SiSU_Env_Call::EnvCall +      fnb=if @md \ +      and defined? @md.fnb +        @md.fnb +      elsif defined? @env.fnb \ +      and @env.fnb +        @env.fnb +      elsif @fns.is_a?(String) \ +      and not @fns.empty? +        m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m +        @fns[m,1] if not @fns.empty? +      end +      if fnb; @@fb ||=fnb +      end +      @sys=SiSU_Info_Sys::InfoSystem.instance +      @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters +      @fixed_websev_root='' # @home +      @pwd=@@pwd=Dir.pwd +      @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' +      m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +      @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd +      pt=Pathname.new(Dir.pwd) +      stub=if output_dir_structure.by_language_code? +        r=Px[:lng_lst_rgx] +        stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/ +          lng=pt.split[-1].to_s +          lng_part='/' + lng +          base=pt.split[0].split[-1].to_s +        else +          lng_part='/' + language_default_set +          base=pt.split[-1].to_s +        end +        base + lng_part +      elsif output_dir_structure.by_filetype? +        pt.split[-1].to_s +      elsif  output_dir_structure.by_filename? +        '' +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn('set output type, by: language, filetype or filename') +      end +      @stub_set_manifest=stub + '/manifest' +    end +    def user +      @sys.user +    end +    def hostname +      @sys.hostname +    end +    def host +      @sys.host +    end +    def arch +      @sys.arch +    end +    def rbver +      @sys.rbver +    end +    def locale +      @sys.locale +    end +    def concord_max +      ((defined? @rc['processing']['concord_max']) \ +      && @rc['processing']['concord_max']) \ +      ? @rc['processing']['concord_max'] +      : (defaults[:concord_max]) +    end +    def language_default_set           #set directory (default) language +      ((defined? @rc['default']['language']) \ +      && @rc['default']['language'] =~/\S+/) \ +      ? @rc['default']['language'] +      : 'en' +    end +    def markup_emphasis +      if defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/bold/ +        'bold' +      elsif defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/italic/ +        'italics' +      elsif defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/underscore/ +        'underscore' +      else 'bold' +      end +    end +    def plaintext_wrap +      ((defined? @rc['default']['text_wrap']) \ +      && (@rc['default']['text_wrap']) \ +      && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ +      && (@rc['default']['text_wrap'].to_i > 19) \ +      && (@rc['default']['text_wrap'].to_i < 201)) \ +      ? @rc['default']['text_wrap'].to_i +      : 78 +    end +    def current_document +      @@current_document||=Dir.pwd +      @@current_document +    end +    def stub_pwd                       #200412 +      @stub_pwd +    end +    def base_markup_dir_stub +      @base_markup_dir_stub +    end +    def stub_md_harvest                #watch +      @stub_set_manifest +    end +    def stub_src +      @stub_src +    end +    def stub_pod +      @stub_pod +    end +    def sisupod_v4(opt) +      #processing_path.processing +      #  sisupod +      #    doc/ +      #      manifest.txt +      #      en/content.sst                [file content] +      #      fr/content.sst +      #      _sisu +      #        sisu_document_make +      #        image@ (ln -s ../../image) +      #        audio@ (ln -s ../../audio) +      #        video@ (ln -s ../../video) +      #    image/                          [all images for specific document gathered here] +      #    audio/ +      #    video/ +      spp="#{processing_path.processing}/#{Gt[:sisupod]}" +      sppc="#{spp}/doc/_sisu" +      lng_dirs=[] +      if FileTest.directory?(spp) \ +      or FileTest.file?(spp) +        FileUtils::rm_rf(spp) +      end +      paths=[] +      flv=SiSU_Env::EnvCall.new(opt.fns). +        document_language_versions_found +      flv[:f].each {|l| lng_dirs << l[:l] } +      lng_dirs.uniq.each do |lng| +        paths << "#{spp}/doc/#{lng}" +      end +      paths \ +      << "#{spp}/image" +     #<< "#{spp}/audio" \ +     #<< "#{spp}/video" \ +      paths.each do |x| +        unless FileTest.directory?(x) +          FileUtils::mkdir_p(x) +        end +      end +      if FileTest.directory?(sppc) +        pwd=Dir.pwd +        Dir.chdir(sppc) +        FileUtils::ln_s('../../image', 'image') +       #FileUtils::ln_s('../../audio', 'audio') +       #FileUtils::ln_s('../../video', 'video') +        Dir.chdir(pwd) +      end +    end +    def sisupod_v3(opt) +      #processing_path.processing +      #  sisupod +      #    doc/ +      #      manifest.txt +      #      en/content.sst                [file content] +      #      fr/content.sst +      #      _sisu +      #        skin/ +      #          doc                       [relevant skin if any other than default] +      #        image@ (ln -s ../../image) +      #        audio@ (ln -s ../../audio) +      #        video@ (ln -s ../../video) +      #    image/                          [all images for specific document gathered here] +      #    audio/ +      #    video/ +      spp="#{processing_path.processing}/#{Gt[:sisupod]}" +      sppc="#{spp}/doc/_sisu" +      lng_dirs=[] +      if FileTest.directory?(spp) \ +      or FileTest.file?(spp) +        FileUtils::rm_rf(spp) +      end +      paths=[] +      flv=SiSU_Env::EnvCall.new(opt.fns). +        document_language_versions_found +      flv[:f].each {|l| lng_dirs << l[:l] } +      lng_dirs.uniq.each do |lng| +        paths << "#{spp}/doc/#{lng}" +      end +      paths \ +      << "#{spp}/image" \ +      << "#{sppc}/skin/doc" \ +      << "#{sppc}/skin/dir" \ +      << "#{sppc}/skin/site" +     #<< "#{spp}/audio" \ +     #<< "#{spp}/video" \ +      paths.each do |x| +        unless FileTest.directory?(x) +          FileUtils::mkdir_p(x) +        end +      end +      if FileTest.directory?(sppc) +        pwd=Dir.pwd +        Dir.chdir(sppc) +        FileUtils::ln_s('../../image', 'image') +       #FileUtils::ln_s('../../audio', 'audio') +       #FileUtils::ln_s('../../video', 'video') +        Dir.chdir(pwd) +      end +    end +    def sisupod_v2 +      #processing_path.processing +      #  sisupod +      #    content.sst              [file content] +      #    filename.sst             [link to content.sst] +      #    _sisu +      #      skin/ +      #        doc                  [relevant skin if any other than default] +      #      image                  [all images for specific document gathered here] +      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      paths=[] +      paths=[ +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image" +      ] +      paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) } +    end +    def defaults                       #multiple default directories +      @default_dir ||=@sys.default_dir #DEFAULT_DIR +    end +    def html_seg_title_banner? +      ((defined? @rc['html']['seg_title_banner']) \ +      && @rc['html']['seg_title_banner']==true) \ +      ? @rc['html']['seg_title_banner'] +      : false +    end +    def html_quick_ref? +      ((defined? @rc['html']['quick_ref']) \ +      && @rc['html']['quick_ref']==true) \ +      ? @rc['html']['quick_ref'] +      : false +    end +    def html_minitoc? +      if defined? @rc['html']['minitoc'] \ +      and @rc['html']['minitoc'].is_a?(String) +        @rc['html']['minitoc'] +      else false +      end +    end +    def manifest_minitoc? +      if defined? @rc['manifest']['minitoc'] \ +      and @rc['manifest']['minitoc'].is_a?(String) +        @rc['manifest']['minitoc'] +      else false +      end +    end +    def build +      def omit_list +        @off_list ||=if defined? @rc['omit_list'] \ +        and @rc['omit_list'].is_a?(String) +          @rc['omit_list'] +        elsif defined? @rc['omit']['list'] \ +        and @rc['omit']['list'].is_a?(String) +          @rc['omit']['list'] +        else +          nil +        end +      end +      def listed?(test) #fix +        listed=if omit_list +          x=(omit_list.scan(/\b#{test}\b/)).join +          test==x \ +          ? true +          : false +        else +          false +        end +        listed +      end +      def ocn? +        if (defined? @rc['omit']['ocn'] \ +        and not @rc['omit']['ocn'].nil?) \ +        or listed?('ocn') +          :off +        else +          :na +        end +      end +      def toc? +        if (defined? @rc['omit']['toc'] \ +        and not @rc['omit']['toc'].nil?) \ +        or listed?('toc') +          :off +        else +          :na +        end +      end +      def manifest? +        if (defined? @rc['omit']['manifest'] \ +        and not @rc['omit']['manifest'].nil?) \ +        or listed?('manifest') +          :off +        else +          :na +        end +      end +      def links_to_manifest? +        if (defined? @rc['omit']['links_to_manifest'] \ +        and not @rc['omit']['links_to_manifest'].nil?) \ +        or (listed?('links_to_manifest') \ +        ||  listed?('manifest_links')) +          :off +        else +          :na +        end +      end +      def metadata? +        if (defined? @rc['omit']['metadata'] \ +        and not @rc['omit']['metadata'].nil?) \ +        or listed?('metadata') +          :off +        else +          :na +        end +      end +      def minitoc? +        if (defined? @rc['omit']['minitoc'] \ +        and not @rc['omit']['minitoc'].nil?) \ +        or (listed?('minitoc')) +          :off +        else +          :na +        end +      end +      def manifest_minitoc? +        if (defined? @rc['omit']['manifest_minitoc'] \ +        and not @rc['omit']['manifest_minitoc'].nil?) \ +        or listed?('manifest_minitoc') +          :off +        else +          :na +        end +      end +      def html_minitoc? +        if (defined? @rc['omit']['html_minitoc'] \ +        and not @rc['omit']['html_minitoc'].nil?) \ +        or (listed?('html_minitoc') \ +        || listed?('minitoc')) +          :off +        else +          :na +        end +      end +      def html_navigation? +        if (defined? @rc['omit']['html_navigation'] \ +        and not @rc['omit']['html_navigation'].nil?) \ +        or listed?('html_navigation') +          :off +        else +          :na +        end +      end +      def html_navigation_bar? +        if (defined? @rc['omit']['html_navigation_bar'] \ +        and not @rc['omit']['html_navigation_bar'].nil?) \ +        or listed?('html_navigation_bar') +          :off +        else +          :na +        end +      end +      def segsubtoc? +        if (defined? @rc['omit']['segsubtoc'] \ +        and not @rc['omit']['segsubtoc'].nil?) \ +        or listed?('segsubtoc') +          :off +        else +          :na +        end +      end +      def html_right_pane? +        if (defined? @rc['omit']['html_right_pane'] \ +        and not @rc['omit']['html_right_pane'].nil?) \ +        or listed?('html_right_pane') +          :off +        else +          :na +        end +      end +      def html_top_band? +        if (defined? @rc['omit']['html_top_band'] \ +        and not @rc['omit']['html_top_band'].nil?) \ +        or listed?('html_top_band') +          :off +        else +          :na +        end +      end +      def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line +        if (defined? @rc['omit']['search_form'] \ +        and not @rc['omit']['search_form'].nil?) \ +        or listed?('search_form') +          :off +        else +          :na +        end +      end +      def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line +        if (defined? @rc['omit']['html_search_form'] \ +        and not @rc['omit']['html_search_form'].nil?) \ +        or listed?('html_search_form') +          :off +        else +          :na +        end +      end +      self +    end +    def odt_ocn? +      ((defined? @rc['odt']['ocn']) \ +      && @rc['odt']['ocn']==false) \ +      ? @rc['odt']['ocn'] +      : true +    end +    def xml_docbook_ocn? +      ((defined? @rc['xml_docbook']['ocn']) \ +      && @rc['xml_docbook']['ocn']==false) \ +      ? @rc['xml_docbook']['ocn'] +      : true +    end +    def xml_fictionbook_ocn? +      ((defined? @rc['xml_fictionbook']['ocn']) \ +      && @rc['xml_fictionbook']['ocn']==false) \ +      ? @rc['xml_fictionbook']['ocn'] +      : true +    end +    def xml_scaffold_ocn? +      ((defined? @rc['xml_scaffold']['ocn']) \ +      && @rc['xml_scaffold']['ocn']==false) \ +      ? @rc['xml_scaffold']['ocn'] +      : true +    end +    def plaintext_ocn? +      ((defined? @rc['plaintext']['ocn']) \ +      && @rc['plaintext']['ocn']==false) \ +      ? @rc['plaintext']['ocn'] +      : true +    end +    def textile_ocn? +      ((defined? @rc['textile']['ocn']) \ +      && @rc['textile']['ocn']==true) \ +      ? @rc['textile']['ocn'] +      : false +    end +    def asciidoc_ocn? +      ((defined? @rc['asciidoc']['ocn']) \ +      && @rc['asciidoc']['ocn']==true) \ +      ? @rc['asciidoc']['ocn'] +      : false +    end +    def markdown_ocn? +      ((defined? @rc['markdown']['ocn']) \ +      && @rc['markdown']['ocn']==true) \ +      ? @rc['markdown']['ocn'] +      : false +    end +    def rst_ocn? +      ((defined? @rc['rst']['ocn']) \ +      && @rc['rst']['ocn']==true) \ +      ? @rc['rst']['ocn'] +      : false +    end +    def widget #needs (md) #move +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @ad=SiSU_Env::GetInit.new.ads +      @vz=SiSU_Viz::Defaults.new +      @flag={ +        ad: false, +        md: false, +        sk: false, +        rc: false +      } +      def promo? +        @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] +          @flag[:md]=true +          true +        elsif defined? @vz.widget_promo \ +        and not @vz.widget_promo.nil? \ +        and @vz.widget_promo.is_a?(Array) \ +        and @vz.widget_promo.length > 0 +          @flag[:sk]=true +          true +        elsif defined? @rc['html']['promo'] \ +        and not @rc['html']['promo'].nil? \ +        and @rc['html']['promo'].length > 0 +          @flag[:rc]=true +          true +        else false +        end +        @flag +      end +      def search? +        searches=['sisu'] +        flag=false +        if defined? @rc['search'] +          searches.each do |type| +            flag=if defined? @rc['search'][type] \ +            and defined? @rc['search'][type]['action'] \ +            and @rc['search'][type]['flag']==true \ +            and @rc['search'][type]['action'] =~/https?:\/\// +              flag=if promo?[:ad] +                false +              elsif defined? @vz.widget_search \ +              and @vz.widget_search==true +                true +              elsif defined? @rc['search'][type]['flag'] \ +              and @rc['search'][type]['flag']==true +                true +              else false +              end +            else false +            end +          end +        else false +        end +        flag +      end +      def search_fixed? +        searches=['sisu','hyperestraier'] +        flag=if defined? @rc['search'] +          searches.each do |type| +            if defined? @rc['search'][type] \ +            and defined? @rc['search'][type]['action'] \ +            and @rc['search'][type]['action'] =~/https?:\/\// \ +            and defined? @rc['search'][type]['db'] \ +            and @rc['search'][type]['db'] =~/\S+/ +              flag=if promo?[:ad] +                false +              elsif defined? @vz.widget_search \ +              and @vz.widget_search==true +                true +              elsif defined? @rc['search'][type]['flag'] \ +              and @rc['search'][type]['flag']==true +                true +              else false +              end +            else false +            end +          end +        else false +        end +      end +      def search_form(type='sisusearch',action=nil,db=nil,table=false) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form_sisu=if action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget.search? +          db=if rc['search']['sisu']['flag']==true \ +          and rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        elsif defined? rc['search']['sisu']['flag'] \ +        and defined? rc['search']['sisu']['action'] \ +        and rc['search']['sisu']['flag']==true \ +        and rc['search']['sisu']['action'] =~/https?:\/\// +          true +        else false +        end +        if table +          table_open='<td align="center" bgcolor="#ffffff">' +          table_close='</td>' +        else +          table_open='' +          table_close='<br />' +        end +        form=if create_form_sisu \ +        and type=~/sisusearch/ \ +        and defined? rc['search']['sisu'] \ +        and defined? rc['search']['sisu']['action'] +          <<WOK +<!-- SiSU Search --> +#{table_open} +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="ltd" value="1000" /> +<input type="hidden" name="off" value="0" /> +<input type="hidden" name="doc" value="#{@md.fnb}" /><br /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font></form> +#{table_close} +<!-- SiSU Search --> +WOK +        else '' +        end +        form +      end +      def search_form_static(action=nil,db=nil) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form=if rc['search']['sisu']['flag']==true \ +        and action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget.search_fixed? +          db=if rc['search']['sisu']['flag']==true \ +          and rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        else false +        end +        if create_form +          %{<td align="center" bgcolor="#ffffff"> +<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="ltd" value="1000" /> +<input type="hidden" name="off" value="0" /> +<input type="hidden" name="doc" value="#{@md.fnb}" /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> +</td> } +        else '' +        end +      end +      def search_action #check +        if search? +        else '' +        end +      end +      self +    end +    def widget_static +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @vz=SiSU_Viz::Defaults.new +      @flag={ ad: false, md: false, sk: false, rc: false } +      def search? +        flag=if defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\// \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ +          flag=if defined? @vz.widget_search \ +          and @vz.widget_search==true +            true +          elsif defined? @rc['search']['sisu']['flag'] \ +          and @rc['search']['sisu']['flag']==true +            true +          else +            false +          end +        else +          false +        end +      end +      def search_fixed? +        flag=if defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\// \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ +          flag=if defined? @vz.widget_search \ +          and @vz.widget_search==true +            true +          elsif defined? @rc['search']['sisu']['flag'] \ +          and @rc['search']['sisu']['flag']==true +            true +          else +            false +          end +        else +          false +        end +      end +      def search_form(action=nil,db=nil) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form=if defined? rc['search']['sisu']['flag'] \ +        and rc['search']['sisu']['flag']==true \ +        and action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget_static.search? \ +        and rc['search']['sisu']['flag']==true +          db=if rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        else false +        end +        if create_form \ +        and @fnb \ +        and @fnb=~/\S+/ +          %{<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="doc" value="#{@fnb}" /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> } +        elsif create_form +          %{<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> } +        else '' +        end +      end +      def search_action #check +        if search? +        else '' +        end +      end +      self +    end +    def source_file_path +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') +      unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" +      else "#{processing_path.composite_file}" +      end +    end +    def source_file_with_path +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') +      "#{source_file_path}/#{file}" +    end +    def texpdf_hyperlinks(cli) +      @cli=cli +      @hyplnks=if cli != :na +        cli +      elsif (defined? @rc['default']['pdf_hyperlinks']) \ +      && (@rc['default']['pdf_hyperlinks']=~/color/) +        :color +      elsif (defined? @rc['default']['pdf_hyperlinks']) \ +      && (@rc['default']['pdf_hyperlinks'] \ +      =~/(?:no-color|color-off|mono(?:chrome)?)/) +        :mono +      else :na +      end +      def landscape +        if @cli != :na +          @cli +        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ +        && (@rc['default']['pdf_hyperlinks_landscape']=~/color/) +          :color +        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ +        && (@rc['default']['pdf_hyperlinks_landscape'] \ +        =~/(?:no-color|color-off|mono(?:chrome)?)/) +          :mono +        elsif @hyplnks != :na +          @hyplnks +        else :na +        end +      end +      def portrait +        if @cli != :na +          @cli +        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ +        && (@rc['default']['pdf_hyperlinks_portrait']=~/color/) +          :color +        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ +        && (@rc['default']['pdf_hyperlinks_portrait'] \ +        =~/(?:no-color|color-off|mono(?:chrome)?)/) +          :mono +        elsif @hyplnks != :na +          @hyprlnks +        else :na +        end +      end +      self +    end +    def font +      def size(pt=nil) +        if pt && pt != :na +          pt +        elsif defined? @rc['default']['fontsize'] \ +        && @rc['default']['fontsize']=~/\d{1,2}/ +          @rc['default']['fontsize'] +        else :na +        end +      end +      def texpdf +        # you may wish to check selected font against available fonts: +        # fc-list :outline -f "%{family}\n" +        # fc-list :lang=ja +        def main +          (defined? @rc['default']['texpdf_fontface']) \ +          && (@rc['default']['texpdf_fontface']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface'] +          : 'Liberation Sans' +        end +        def sans                       # not used +          (defined? @rc['default']['texpdf_fontface_sans']) \ +          && (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_sans'] +          : 'Liberation Sans' +        end +        def serif                      # not used +          (defined? @rc['default']['texpdf_fontface_serif']) \ +          && (@rc['default']['texpdf_font_serif']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_serif'] +          : 'Liberation Serif' +        end +        def mono +          (defined? @rc['default']['texpdf_fontface_mono']) \ +          && (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_mono'] +          : 'Liberation Mono' +        end +        def cjk +          (defined? @rc['default']['texpdf_fontface_cjk']) \ +          && (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk'] +          : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' +        end +        def cjk_zh +          (defined? @rc['default']['texpdf_fontface_cjk_zh']) \ +          && (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_zh'] +          : 'IPAGothic' +        end +        def cjk_ja +          (defined? @rc['default']['texpdf_fontface_cjk_ja']) \ +          && (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_ja'] +          : 'IPAGothic' +        end +        def cjk_ko +          (defined? @rc['default']['texpdf_fontface_cjk_ko']) \ +          && (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_ko'] +          : 'IPAGothic' +        end +        def size(pt=nil) +          if pt && pt != :na +            pt +          elsif (defined? @rc['default']['texpdf_fontsize']) \ +          && (@rc['default']['texpdf_fontsize']=~/\d{1,2}/) +            @rc['default']['texpdf_fontsize'] +          elsif (defined? @rc['default']['fontsize']) \ +          && (@rc['default']['fontsize']=~/\d{1,2}/) +            @rc['default']['fontsize'] +          else +            :na +          end +        end +        self +      end +      self +    end +    def path_rel_links +      def html_scroll_2 +        if @env.output_dir_structure.by_language_code? +          '../../' +        elsif @env.output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_seg_2 +        if @env.output_dir_structure.by_language_code? +          '../../../' +        elsif @env.output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def html_scroll_1 +        if @env.output_dir_structure.by_language_code? +          '../' +        elsif @env.output_dir_structure.by_filetype? +          '../' +        else +          './' +        end +      end +      def html_seg_1 +        if @env.output_dir_structure.by_language_code? +          '../../' +        elsif @env.output_dir_structure.by_filetype? +          '../../' +        else +          './' +        end +      end +      self +    end +    def read_source_file_array(fns) +      (fns !~/\.ssm.sst$/) \ +      ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) +      : (IO.readlines( +           "#{processing_path.composite_file}/#{fns}", +           mode: 'r:utf-8', +           cr_newline: true +        )) +    end +    def read_source_file(fns) +      read_source_file_array(fns) +    end +    def read_source_file_string(fns) +      (fns !~/\.ssm.sst$/) \ +      ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) +      : (IO.read( +           "#{processing_path.composite_file}/#{fns}", +           mode: 'r:utf-8', +           cr_newline: true +        )) +    end +    def source_file_processing_array(fns) +      read_source_file_string(fns).split(/\s*\n\s*\n/m) +    end +    def path                           #dir +      def home +        @sys.home +      end +      def sisurc_path +        GetInit.new.sisu_yaml.rc_path +      end +      def pwd +        @sys.pwd +      end +      def stub_pwd +        @stub_pwd +      end +      def base_markup_dir_stub +        @base_markup_dir_stub +      end +      def stub_epub +        @stub_epub +      end +      def stub_src +        @stub_src +      end +      def stub_pod +        @stub_pod +      end +      def etc +        defaults[:sisu_etc]                                                      #live/dynamic +      end +      def arch +        @sys.dir_arch +      end +      def sitearch +        @sys.dir_sitearch +      end +      def bin +        @sys.dir_bin +      end +      def share                        #shared data repository source directory +        #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green). +        #  mark(defaults[:sisu_share]) +        defaults[:sisu_share] +      end +      def style +        if @md \ +        && ((@md.opt.opt_act[:dump][:bool] \ +        &&   @md.opt.opt_act[:dump][:inst]) \ +        ||  (@md.opt.opt_act[:redirect][:bool] \ +        &&   @md.opt.opt_act[:redirect][:inst])) +          'css' +        else +         defaults[:stylesheet_stub] +        end +      end +      def sample_data                  #sample data repository source directory +        defaults[:sample_data_path] +      end +      def rc +        @init.rc_path +      end +      def yamlrc +        GetInit.new.sisu_yaml.rc_path +      end +      def man #check use +        (defined? @rc['webserv']['man']) \ +        ? "#{webserv}/#{@rc['webserv']['man']}" +        : defaults[:webserv_man] +      end +      def webserv_path #testing, check need, remove +        webserv +      end +      def webserv               #separation required for webrick which cannot use path.output (different requirements as no file is passed) +        man_path=if @@man_path.nil? +          man_path=if defined? @rc['webserv']['path'] \ +          and @rc['webserv']['path'] =~/\S\S+/ +            pwd=Dir.pwd +            Dir.chdir(SiSU_Utils::Path.new.base_markup) +            man_path=@@man_path=File.expand_path(@rc['webserv']['path']) +            Dir.chdir(pwd) +            man_path +          else defaults[:webserv_path] +          end +        else @@man_path +        end +        man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1') +        unless FileTest.directory?(man_path) +          FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.") +        end +        @webserv_path=if defined? man_path \ +        and File.writable?("#{man_path}/.") +          man_path #web server path as configured in rc file +        elsif FileTest.directory?(defaults[:webserv_path]) \ +        and File.writable?("#{defaults[:webserv_path]}/.") #web server path default +          defaults[:webserv_path] +        else #create default directory under home and place output there +          unless FileTest.directory?(defaults[:output_local]) +            FileUtils::mkdir_p(defaults[:output_local]) +          end +          defaults[:output_local] +        end +      end +      def webserv_stub_ensure +        FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) +        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}/#{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] +      end +      def webserv_image         #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) +        images=if defined? @rc['webserv']['images'] +          @rc['webserv']['images'] +        else defaults[:images] +        end +        "#{path.webserv}/#{images}" +      end +      def output                #web/webserv output directory... subdirectory into which further subdirectories are made based on file names +        r=Px[:lng_lst_rgx] +        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ +        base_stub=@sys.pwd.gsub(u,'\1') +        if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/ +          "#{path.webserv}/#{Gt[:doc]}" +        else +          "#{path.webserv}/#{base_stub}" +        end +      end +      def feed +        (defined? @rc['webserv']['feed']) \ +        ? ("#{public_output}/#{@rc['webserv']['feed']}") +        : (defaults[:webserv_feed]) +      end +      def feed_home +        "#{public_output}/#{@rc['webserv']['feed_home']}" +      end +      def scripts                                                                #used previously only to include tla version info +        if defined? @rc['project']['path'] +          "#{home}/#{@rc['project']['path']}" +        end +      end +      def cgi +        (defined? @rc['webserv']['cgi']) \ +        ? "#{@rc['webserv']['cgi']}" +        : (defaults[:webserv_cgi]) +      end +      def php +        (defined? @rc['webserv']['php']) \ +        ? "#{public_output}/#{@rc['webserv']['php']}" +        : (defaults[:webserv_php]) +      end +      #% programs +      def output_tell +        url.webserv_map_pwd +      end +      def image_source                 #image repository source directory +        if defined? @rc['image']['path'] \ +        and defined? @rc['image']['public'] +          pth="#{@rc['image']['path']}" +          "#{pth}/#{@rc['image']['public']}" +        else +          "#{share}/image" +        end +      end +      def image_source_sisu_includes +        "#{share}/image" +      end +      def image_source_include         #image repository source directory +        if defined? @rc['image']['path'] \ +        and defined? @rc['image']['public'] \ +        and FileTest.directory?( +          "#{@rc['image']['path']}/#{@rc['image']['public']}" +        )==true +          "#{@rc['image']['path']}/#{@rc['image']['public']}" +        elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true +          "#{@@pwd}/#{defaults[:image_stub]}" +        elsif FileTest.directory?( +          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" +        )==true +          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" +        else +          "#{share}/image" +        end +      end +      def image_external +        "#{processing}/external_document/image" +      end +      def image_source_include_local +        if FileTest.directory?(defaults[:image_local]) +          defaults[:image_local] +        end +      end +      def image_source_include_remote +        if FileTest.directory?(image_external); image_external +        end +      end +      self +    end +    def processing_path +      def encoding +        pth="#{processing}/#{defaults[:processing_encoding]}" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def processing_base_tmp +        defaults[:processing_path_tmp_base] +      end +      def tmp_root_dir +        defaults[:processing_dir_tmp_root] +      end +      def root_dir +        proposed_path_base=if defined? @rc['processing']['path'] \ +        and not @rc['processing']['path'].nil? \ +        and not @rc['processing']['path'].empty? +          x=if @rc['processing']['path'] =~/^(?:~|home)$/ +            home #fix +          else @rc['processing']['path'] +          end +        else nil +        end +        proposed_dir=if defined? @rc['processing']['dir'] \ +        and not @rc['processing']['dir'].nil? \ +        and not @rc['processing']['dir'].empty? +          @rc['processing']['dir'] +        else defaults[:processing_dir] +        end +        v=SiSU_Env::InfoVersion.instance.get_version +        v_dev=(DEVELOPER[:maintenance]==:true) \ +        ? "_#{v[:version]}" +        : '' +        path=if proposed_path_base \ +        and FileTest.directory?(proposed_path_base) \ +        and File.writable?("#{proposed_path_base}/.") +          x=proposed_dir \ +          ? "#{proposed_path_base}/#{proposed_dir}" +          : "#{proposed_path_base}/#{defaults[:processing_dir]}" +        else defaults[:processing_dir_tmp_root] +        end +        path = path + v_dev +      end +      def usr_dir? +        case root_dir +        when /^\/home/ then false +        else                true +        end +      end +      def stub_dir +        (usr_dir?) \ +        ? ("#{root_dir}/#{user}/#{stub_pwd}") +        : ("#{root_dir}/#{stub_pwd}") # 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] +      end +      def processing_sisupod(opt=nil)  #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) +        @opt=opt +        def paths +          processing_path_usr="#{root_dir}/#{user}" +          processing_path_fnb=processing_path_usr \ +            + '/' + Gt[:pods] \ +            + '/' + @opt.fng +          processing_path_sisupod=processing_path_fnb \ +            + '/' + Gt[:sisupod] +          { +            fnb: processing_path_fnb, +            sisupod: processing_path_sisupod, +          } +        end +        def make +          unless FileTest.directory?(root_dir) +            FileUtils::mkdir_p(root_dir) +            File.chmod(0777,root_dir) +          end +          if usr_dir? +            processing_path_usr="#{root_dir}/#{user}" +            FileUtils::mkdir_p(processing_path_usr) \ +              unless FileTest.directory?(processing_path_usr) +            File.chmod(0700,processing_path_usr) +          end +          sisupod_processing_path=paths[:sisupod] +          FileUtils::mkdir_p(sisupod_processing_path) \ +            unless FileTest.directory?(sisupod_processing_path) +          sisupod_processing_path_lng=if defined? @opt.lng +            sisupod_processing_path \ +              + '/' + Gt[:doc] \ +              + '/' + @opt.lng +          else +            sisupod_processing_path \ +              + '/' + Gt[:doc] +          end +          unless FileTest.directory?(sisupod_processing_path_lng) +            #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" +            FileUtils::mkdir_p(sisupod_processing_path_lng) +            File.chmod(0700,sisupod_processing_path_lng) +          end +          sisupod_processing_path +        end +        self +      end +      def processing                   #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) +        unless FileTest.directory?(root_dir) +          FileUtils::mkdir_p(root_dir) +          File.chmod(0777,root_dir) +        end +        if usr_dir? +          processing_path_usr="#{root_dir}/#{user}" +          FileUtils::mkdir_p(processing_path_usr) \ +            unless FileTest.directory?(processing_path_usr) +          File.chmod(0700,processing_path_usr) +        end +        FileUtils::mkdir_p(stub_dir) \ +          unless FileTest.directory?(stub_dir) +        File.chmod(0700,stub_dir) +        path_processing=[ +          stub_dir, +          defaults[:processing_path], +          defaults[:processing_path_home] +        ] +        processing=nil +        path_processing.each do |v|                                              # +          processing=v +          unless FileTest.directory?(processing) +            FileUtils::mkdir_p(processing) +            File.chmod(0700,processing) +          end +          break +        end +        processing +      end +      def ao +        pth=if defined? @rc['processing']['dal'] \ +          and @rc['processing']['dal'].is_a?(String) +          "#{processing}/#{@rc['processing']['dal']}" +        else "#{processing}/#{defaults[:processing_ao]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def tune +        pth=if defined? @rc['processing']['tune'] \ +          and @rc['processing']['tune'].is_a?(String) +          "#{processing}/#{@rc['processing']['tune']}" +        else "#{processing}/#{defaults[:processing_tune]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def composite_file +        pth=processing_path.ao  #"#{processing}/composite" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def git +        pth=if defined? @rc['git']['dir'] \ +        and @rc['git']['dir'].is_a?(String) +          (@rc['git']['dir'] =~/^(?:~|home)$/) \ +          ? home + '/' + Gt[:git] +          : @rc['git']['dir'] + '/' + Gt[:git] +        else defaults[:processing_git] +        end +        unless FileTest.directory?(pth) +          FileUtils::mkdir_p(pth) +          File.chmod(0700,pth) +        end +        pth +      end +      def odf_pth +        pth="#{processing}/odf/#{@fns}" +        pth +      end +      def odf +        odt +      end +      def odt +        pth=odf_pth + '/odt' +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def odf +        pth="#{processing}/odf" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def odt_bld +        FileUtils::rm_rf(processing_path.odt) +        FileUtils::mkdir_p(processing_path.odt) \ +          unless FileTest.directory?(processing_path.odt) +        FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") \ +          unless FileTest.directory?("#{processing_path.odt}/Configurations2") +        FileUtils::mkdir_p("#{processing_path.odt}/META-INF") \ +          unless FileTest.directory?("#{processing_path.odt}/META-INF") +        FileUtils::mkdir_p("#{processing_path.odt}/Pictures") \ +          unless FileTest.directory?("#{processing_path.odt}/Pictures") +        FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") \ +          unless FileTest.directory?("#{processing_path.odt}/Thumbnails") +        processing_path.odt +      end +      def epub +        "#{processing}/epub/#{@fnb}" +      end +      def epub_bld #(md) +        FileUtils::rm_rf(processing_path.epub) \ +          if FileTest.directory?(processing_path.epub) +        FileUtils::mkdir_p(processing_path.epub) \ +          unless FileTest.directory?(processing_path.epub) +        FileUtils::mkdir_p("#{processing_path.epub}/META-INF") \ +          unless FileTest.directory?("#{processing_path.epub}/META-INF") +        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") \ +          unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image") +        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") \ +          unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css") +        processing_path.epub +      end +      def epub_cp_images(md) +        pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        src="#{path.share}/image" +        images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] +        images.each do |i| #move to avoid repeated tests +          if FileTest.file?("#{src}/#{i}") +            FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \ +              unless FileTest.file?("#{pth}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +          end +        end +        pth +      end +      def tex +        pth=if defined? @rc['processing']['latex'] \ +        and @rc['processing']['latex'].is_a?(String) +          "#{processing}/#{@rc['processing']['latex']}" +        else "#{processing}/#{defaults[:processing_latex]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def texi +        pth=if defined? @rc['processing']['texinfo'] \ +        and @rc['processing']['texinfo'].is_a?(String) +          "#{processing}/#{@rc['processing']['texinfo']}" +        else "#{processing}/#{defaults[:processing_texinfo]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def texinfo                      #texinfo webserv, check +        "#{processing}/#{defaults[:processing_texinfo]}" +      end +      def manpage +        "#{path.output}/man" +      end +      def lout +        pth=if defined? @rc['processing']['lout'] \ +        and @rc['processing']['lout'].is_a?(String) +          "#{processing}/#{@rc['processing']['lout']}" +        else "#{processing}/#{defaults[:processing_lout]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def sql +        pth="#{processing}/sql" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def sqlite +        pth=if defined? @rc['processing']['sqlite'] \ +        and @rc['processing']['sqlite'].is_a?(String) +          "#{processing}/#{@rc['processing']['sqlite']}" +        else "#{processing}/#{defaults[:processing_sqlite]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def postgresql +        pth=if defined? @rc['processing']['postgresql'] \ +        and @rc['processing']['postgresql'].is_a?(String) +          "#{processing}/#{@rc['processing']['postgresql']}" +        else "#{processing}/#{defaults[:processing_postgresql]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      self +    end +    def url +      def hostname +        "http://#{@sys.hostname}" +      end +      def dir_url +        "file://#{path.webserv}/#{stub_pwd}" +      end +      def localhost +        "http://localhost/#{stub_pwd}" +      end +      def local +        "http://#{hostname}/#{@stub_pwd}" +      end +      def root +        if defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/https?:\/\// +          "#{@rc['webserv']['url_root']}/#{@stub_pwd}" +        elsif defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/localhost/ +          "http://localhost/#{@stub_pwd}" +        else "file://#{path.output}" +        end +      end +      def remote +        root +      end +      def txt +        "#{root}/txt" +      end +      def html +        "#{root}/html" +      end +      def epub +        "#{root}/epub" +      end +      def odt +        "#{root}/odt" +      end +      def pdf +        "#{root}/pdf" +      end +      def src_txt +        "#{root}/src" +      end +      def src_pod +        "#{root}/pod" +      end +      def pot +        "#{root}/po4a/pot" +      end +      def po +        "#{root}/po4a/po" +      end +      def webserv_host_base(opt=nil) +        if defined? @rc['webserv']['host'] +          case  @rc['webserv']['host'] +          when /https?:\/\// then @rc['webserv']['host'] +          when /\S+/         then "http://#{@rc['webserv']['host']}" +          else                    defaults[:webserv_host_cgi] +          end +        else                      defaults[:webserv_host_cgi] +        end +      end +      def webserv_cgi(opt=nil)         #web url for local webserv (localhost, or hostname) +        http=if defined? @rc['webserv_cgi']['host'] \ +        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 +          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 +          end +        end +        http=http.strip +      end +      def webserv_base_cgi(opt=nil)    #web url for local webserv (localhost, or hostname) +        http=if opt.mod.inspect =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ +          m=$1 +          (m=~/http\/\/:/) ? m : %{http://#{m}} +        elsif defined? @rc['webserv_cgi']['host'] \ +        and @rc['webserv_cgi']['host'].is_a?(String) +          http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') +          if port.webserv_port_cgi(opt) +            http + @rc['webserv_cgi']['host'] + ':' \ +              + port.webserv_port_cgi(opt) +          else +            http + @rc['webserv_cgi']['host'] +          end +        else +          http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') +          if port.webserv_port_cgi(opt) +            http + webserv_host_base + ':' \ +              + port.webserv_port_cgi(opt) +          else "#{http}#{webserv_host_base}" +          end +        end +        http=http.strip +        #%q{http://#{ENV['HTTP_HOST']}} +      end +      def webrick #must have a port    #REMOVE +        if defined? @rc['webserv_cgi']['host'] \ +        and @rc['webserv_cgi']['host'].is_a?(String) +          http=if @rc['webserv_cgi']['host'] =~/http:\/\// +            'http://' +          elsif @rc['webserv_cgi']['host'] =~/https:\/\// +            'https://' +          else defaults +          end +          "#{http}#{@rc['webserv_cgi']['host']}" +        elsif webserv_host_base \ +        and webserv_host_base.is_a?(String) +          http + webserv_host_base +        else +          http + 'localhost' +        end +      end +      def webserv                      #web url for local webserv (localhost, or hostname) +        if defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/http/ +          # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere +          @rc['webserv']['url_root'] +        elsif path.webserv_dir \ +        and path.webserv =~ /#{path.webserv_dir}/ #revisit +          path.webserv + '/' \ +            + @base_markup_dir_stub. +              gsub(/#{path.webserv_dir}/, +                "#{url.hostname}/#{@stub_pwd}") +        elsif defined? @rc['webserv']['webrick_url'] \ +        and @rc['webserv']['webrick_url']==false +          'file://' + path.webserv +        elsif port.webserv_port_cgi =~/\S+/ +          url.hostname + ':' + port.webserv_port_cgi +        else +          url.hostname +        end +      end +      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}") +        elsif defined? @rc['webserv']['webrick_url'] \ +        and @rc['webserv']['webrick_url']==false +          "file://#{path.webserv}" +        else "#{url.webrick_base}" +        end +      end +      def webserv_files_from_db(opt=nil) #sort this out, messy +        if opt.mod.inspect =~/--webserv-output[=-]["']?(\S+)["']+/ +          m=$1 +          (m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}} +        else +          show_output_on=if defined? @rc['webserv_cgi']['show_output_on'] +            @rc['webserv_cgi']['show_output_on'] +          elsif  defined? @rc['webserv_cgi']['file_links'] +            @rc['webserv_cgi']['file_links'] +          else '' +          end +          m=case show_output_on +          when /webserv_cgi/ then url.webserv_base_cgi(opt) +          when /webserv/     then @rc['webserv']['url_root'] +          when /https?:\/\// then @rc['webserv_cgi']['file_links'] +          when /\S+/         then 'http://' + @rc['webserv_cgi']['file_links'] +          else                     webserv_base_cgi(opt) +          end +        end +        #%q{http://#{ENV['HTTP_HOST']}/cgi-bin} +      end +      def cgi_sample_search_form_name(opt=nil) +        if opt.mod.inspect \ +        =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ +          $1 +        elsif not opt.mod.inspect =~/--db[=-]["']?sqlite/ \ +        and defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ +          /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/. +            match(@rc['search']['sisu']['action'])[1] +        else +          (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ +          ? "#{Db[:name_prefix_db]}sqlite.cgi" \ +          :  "#{Db[:name_prefix_db]}pg.cgi" +        end +      end +      def sample_search_form_title(organised_by=:language) +        title=if defined? @rc['search']['sisu']['title'] \ +        and @rc['search']['sisu']['title'] =~/\S+/ +          @rc['search']['sisu']['title'] +        else %{SiSU (generated sample) search form} +        end +        title=title + " (content organised by #{organised_by})" +      end +      def output_tell                  #BROKEN Revisit 2011-02 +        output_type=if defined? @rc['show_output_on'] \ +        and @rc['show_output_on'] \ +        =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ +          @rc['show_output_on'] +        else 'filesystem' +        end +        case output_type +        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 /^localhost/                 then url.localhost +        when /^webrick/                   then url.webrick +        when /^path/                      then url.webserv_map_pwd +        else                                   url.webserv_map_pwd +        end +      end +      def images +        "#{Xx[:html_relative2]}/_sisu/image" +      end +      #def images +      #  '../_sisu/image' +      #end +      def images_local +        if FileTest.directory?(path.image_source_include) +          path.image_source_include +        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/ +            @@local_image=false +          end +          url.images +        end +      end +      def images_external +        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 +            @@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/ +            @@local_image=false +          end +          url.images_external +        end +      end +      def images_epub +        './image' +      end +      self +    end +    def port +      def webrick_port +        if @md \ +        and @md.opt.cmd.inspect=~/-F/ \ +        and @md.opt.mod.inspect=~/port=(\d+)/ +           $1 +        else +          if defined? @rc['webserv_cgi']['port'] +            if @rc['webserv_cgi']['port'].nil? \ +            and (defined? @md.opt.mod \ +            and not @md.opt.mod.nil? \ +            and @md.opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            elsif not @rc['webserv_cgi']['port'].nil? +              @rc['webserv_cgi']['port'] +            else defaults[:webserv_port_cgi] +            end +          else   defaults[:webserv_port_cgi] +          end +        end +      end +      def webserv_port_cgi(opt=nil) +        port=if opt \ +        and opt.cmd.inspect=~/-F/ \ +        and opt.mod.inspect=~/port=(\d+)/ +           $1 +        else +          port=if defined? @rc['webserv_cgi']['port'] +            if @rc['webserv_cgi']['port'].nil? \ +            and (defined? opt.mod \ +            and not opt.mod.nil? \ +            and opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            elsif not @rc['webserv_cgi']['port'].nil? +              @rc['webserv_cgi']['port'] +            else nil +            end +          else +            if (defined? opt.mod \ +            and not opt.mod.nil? \ +            and opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            else nil +            end +          end +        end +      end +      self +    end +    def digest_conf? +      if defined? @rc['default']['digest'] \ +      and @rc['default']['digest'] != nil +        case @rc['default']['digest'] +        when /^sha(?:5|512)?$/ then :sha512 +        when /^sha(?:2|256)?$/ then :sha256 +        when /^md5$/           then :md5 +        else                        :sha256 +        end +      else                          :sha256 +      end +    end +    def digest(opt=nil) +      @opt=opt +      def type +        if @opt +          case @opt.act[:hash_digest_algo] +          when :sha512 then :sha512 +          when :sha256 then :sha256 +          when :md5    then :md5 +          else              digest_conf? +          end +        else                digest_conf? +        end +      end +      def length +        case digest(@opt).type +        when :sha512 then 128 +        when :sha256 then  64 +        when :md5    then  32 +        else               64 +        end +      end +      def pattern +        "[0-9a-f]{#{digest(@opt).length}}" #/[0-9a-f]{#{digest.length}}/ +      end +      self +    end +    def program +      def text_editor +        if defined? @rc['program_select']['editor'] \ +        and @rc['program_select']['editor'] =~/\S\S+/ +          @rc['program_select']['editor'] +        elsif defined? @rc['program_select']['text_editor'] \ +        and @rc['program_select']['text_editor'] =~/\S\S+/ +          @rc['program_select']['text_editor'] +        else 'editor'                                                            #'gvim -c :R -c :S' +        end +      end +      def pdf_viewer +        ((defined? @rc['program_select']['pdf_viewer']) \ +        && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['pdf_viewer'] +        : 'pdf-viewer'                                                        #'evince' +      end +      def web_browser +        if defined? @rc['program_select']['www_browser'] \ +        and @rc['program_select']['www_browser'] =~/\S\S+/ +          @rc['program_select']['www_browser'] +        elsif defined? @rc['program_select']['web_browser'] \ +        and @rc['program_select']['web_browser'] =~/\S\S+/ +          @rc['program_select']['web_browser'] +        else 'x-www-browser'                                                      #'firefox' 'iceweasel' 'kazehakase' 'galeon' +        end +      end +      def www_browser +        web_browser +      end +      def console_web_browser +        if defined? @rc['program_select']['console_www_browser'] \ +        and @rc['program_select']['console_www_browser'] =~/\S\S+/ +          @rc['program_select']['console_www_browser'] +        elsif defined? @rc['program_select']['console_web_browser'] \ +        and @rc['program_select']['console_web_browser'] =~/\S\S+/ +          @rc['program_select']['console_web_browser'] +        else 'console-www-browser'                                             #'lynx' 'links' 'links2' 'elinks' 'w3m' +        end +      end +      def console_www_browser +        web_browser +      end +      def epub_viewer +        ((defined? @rc['program_select']['epub_viewer']) \ +        && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['epub_viewer'] +        : 'ebook-viewer'                                                    #'calibre' 'fbreader' +      end +      def xml_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def docbook_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def fictionbook_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def xml_editor +        xml_viewer +      end +      def odf_viewer +        ((defined? @rc['program_select']['odf_viewer']) \ +        && @rc['program_select']['odf_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['odf_viewer'] +        : 'lowriter'                                                           #'odf-viewer','oowriter' +      end +      def manpage_viewer +        'man' +      end +      def manpage_generator +        ((defined? @rc['program_select']['man']) \ +        && @rc['program_select']['man'] =~/\S\S+/) \ +        ? @rc['program_select']['man'] +        : 'nroff -man'                                                        #'nroff -man' #'groff -man -Tascii' +      end +      def texinfo +        ((defined? @rc['program_select']['info_viewer']) \ +        && @rc['program_select']['info_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['info_viewer'] +        : 'pinfo -f'                                                          #'pinfo -f' 'info' 'tkinfo' +      end +      def file_encoding +        is=(defined? @rc['program_set']['file_encoding']) \ +        ? @rc['program_set']['encoding'] : '' +        (is.nil? || is==true) ? 'encoding' : is +      end +      def wc #wordcount +        is=(defined? @rc['program_set']['wc']) \ +          ? @rc['program_set']['wc'] : '' +        (is.nil? || is==true) ? 'wc' : is +      end +      def tidy +        is=(defined? @rc['program_set']['tidy']) \ +          ? @rc['program_set']['tidy'] : nil +        (is.nil? || is==true) ? 'tidy' : is +      end +      def rmagick +        is=(defined? @rc['program_set']['rmagick']) \ +          ? @rc['program_set']['rmagick'] : nil +        (is.nil? || is==true) ? 'rmagick' : is +      end +      def rexml                        #should be part of ruby 1.8 but apparently not always +        is=(defined? @rc['program_set']['rexml']) ? \ +          @rc['program_set']['rexml'] : '' +        (is.nil? || is==true) ? 'rexml' : is +      end +      def pdflatex +        is=(defined? @rc['program_set']['pdflatex']) ? \ +          @rc['program_set']['pdflatex'] : '' +        (is.nil? || is==true) ? 'pdflatex' : is +      end +      def postgresql +        is=(defined? @rc['program_set']['postgresql']) ? \ +          @rc['program_set']['postgresql'] : '' +        (is.nil? || is==true) ? 'postgresql' : is +      end +      def sqlite +        is=(defined? @rc['program_set']['sqlite']) ? \ +          @rc['program_set']['sqlite'] : '' +        (is.nil? || is==true) ? 'sqlite' : is +      end +      self +    end +    def i18n +      def language                     # language settings +        m=/.+\/\S+?\~(\S+)/ +        pwd=Dir.pwd +        conf=(defined? @rc['default']['language']) \ +        ? @rc['default']['language'] : nil +        l=if pwd=~ m    then pwd[m,1]                                        #2 directory: by visible directory name +        elsif conf      then @rc['default']['language']                      #3 config: from sisurc.yaml +        else            defaults[:language]                                  #4 sisu: program default +        end                                                                  #1 document: param gets +        SiSU_Env::StandardiseLanguage.new(l) +      end +      #def multilingual +      #  x=(defined? @rc['output_structure']['multilingual'] \ +      #  && @rc['output_structure']['multilingual'] ==true) \ +      #  ? true : false +      #end +      #def bundle +      #  x=(defined? @rc['output_structure']['bundle'] \ +      #  && @rc['output_structure']['bundle'] ==true) \ +      #  ? true : false +      #end +      def lang_filename(l) +        @lang={} +        x=if output_dir_structure.by_language_code? +          (( defined? @rc['default']['language_file']) \ +          && @rc['default']['language_file'] != nil) \ +          ? @rc['default']['language_file'] +          : 1 +        else 0 +        end +        if (l != defaults[:language_code]) \ +        or (language.code != defaults[:language_code]) #watch +          if x==1    then @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' +          elsif x==2 then @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' +          elsif x==3 then @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" +          else            @lang[:pre],@lang[:mid],@lang[:post]='','','' +          end +        else              @lang[:pre],@lang[:mid],@lang[:post]='','','' +        end +        @lang +      end +      self +    end +    def file_encoding +      is='' +      if defined? @rc['program_set']['file_encoding'] +        is=@rc['program_set']['encoding'] +      end +      if is.nil? \ +      or is==true +        is='encoding' +      end +      is +    end +    def papersize                      # paper settings, default overidden in param if set within document +      (defined? @rc['default']['papersize']) \ +      ? @rc['default']['papersize'].downcase +      : (defaults[:papersize].downcase) +    end +    def odf_structure +      FileUtils::rm_rf(processing_path.processing_path.odf_pth) +      FileUtils::mkdir_p(processing_path.processing_path.odf_pth) +      system( +        "unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}" +      ) +    end +    def sisupod_gen(fns_pod) +      sisupod_gen_v3(fns_pod) +    end +    def sisupod_gen_v3(fns_pod) +      pwd=Dir.pwd +      sisupod_processing_path= +        processing_path.processing + '/' + Gt[:sisupod] +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      unless FileTest.directory?(sisupod_processing_path) +        FileUtils::mkdir_p(sisupod_processing_path) +      end +      f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}") +        "#{Dir.pwd}/#{fns_pod}" +      elsif FileTest.file?(fns_pod) +        fns_pod +      end +      if f_pod \ +      && FileTest.file?(f_pod) +        (SiSU_Env::SystemCall.new.program_found?('tree')) \ +        ? 'tree ' + processing_path.processing + '/' + Gt[:sisupod] +        : '' +        if FileTest.directory?(processing_path.processing) +          Dir.chdir(processing_path.processing) +          system(%{tar xJf #{f_pod}}) +          Dir.chdir(pwd) +        end +        #system(tree)                                                          #enable if (/[vVM]/) +      else +        SiSU_Screen::Ansi.new( +          '', +          '*WARN* file not found: ' + fns_pod +        ).warn unless @cmd=~/q/ +      end +      sisupod_processing_path +    end +    def sisupod_gen_v2(fns_pod) +      sisupod_processing_path= +        processing_path.processing + '/' + Gt[:sisupod] +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      unless FileTest.directory?(sisupod_processing_path) +        FileUtils::mkdir_p(sisupod_processing_path) +      end +      (FileTest.file?(fns_pod)) \ +      ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") +      : (SiSU_Screen::Ansi.new( +          '', +          "*WARN* file not found: #{fns_pod}" +        ).warn unless @cmd=~/q/) +      sisupod_processing_path +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_info_port.rb b/lib/sisu/v5/se_info_port.rb new file mode 100644 index 00000000..b2ead676 --- /dev/null +++ b/lib/sisu/v5/se_info_port.rb @@ -0,0 +1,76 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_info_port.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Port +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoPort < SiSU_Info_Env::InfoEnv                  # se_info_env.rb +    def initialize +      @env=SiSU_Env::InfoEnv.new +    end +    def webrick +      @env.port.webrick_port +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_info_system.rb b/lib/sisu/v5/se_info_system.rb new file mode 100644 index 00000000..7f0e7a00 --- /dev/null +++ b/lib/sisu/v5/se_info_system.rb @@ -0,0 +1,207 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_info_system.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Sys_Gen +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoSystemGen +    begin +      require 'rbconfig' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') +    end +    @@user,       @@home,     @@hostname,     @@pwd,     @@sisu_etc,                            @@host,                @@arch,                @@rbver,          @@dir_arch,               @@dir_sitearch,               @@dir_bin,               @@locale,                @@rc,@@sisurc_path,@@ad= +      ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil, nil,          {} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] +    out=Config::CONFIG['localstatedir'] +    etc=Config::CONFIG['sysconfdir'] + '/sisu' +    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}" +    if @@user +      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 +    processing_pth=tmp_processing_individual +    processing_dir=prcss_dir +    processing_git="#{Dir.pwd}/#{Gt[:grotto]}" +    #user=ENV['USER'] +    port_pgsql=if defined? ENV['PGPORT'] \ +    and not (ENV['PGPORT'].nil? \ +    || ENV['PGPORT'].empty?) \ +    and ENV['PGPORT']=~/^\d+$/ +      ENV['PGPORT'] +    else '5432' +    end +    IMAGES=:images +    SISU_ETC=:sisu_etc +    SISU_SHARE=:sisu_share +    SAMPLE_DATA_PATH=:sample_data_path +    IMAGE_STUB=:image_stub +    STYLESHEET_STUB=:stylesheet_stub +    IMAGE_LOCAL=:image_local +    WEBSERV_PATH=:webserv_path +    WEBSERV_MAN=:webserv_man +    WEBSERV_PHP=:webserv_php +    WEBSERV_CGI=:webserv_cgi +    WEBSERV_RSS=:webserv_rss +    WEBSERV_SQLITE=:webserv_sqlite +    OUTPUT_LOCAL=:output_local +    PROCESSING_DIR=:processing_dir +    PROCESSING_PATH=:processing_path +    PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root +    PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base +    PROCESSING_AO=:processing_ao +    PROCESSING_TUNE=:processing_tune +    PROCESSING_LATEX=:processing_latex +    PROCESSING_TEXINFO=:processing_texinfo +    PROCESSING_LOUT=:processing_lout +    PROCESSING_SQLITE=:processing_sqlite +    PROCESSING_POSTGRESQL=:processing_postgresql +    PROCESSING_ENCODING=:processing_encoding +    PROCESSING_GIT=:processing_git +    PAPERSIZE=:papersize +    #LANGUAGE=:language +    #LANGUAGE_CODE=:language_code +    MULTILINGUAL=:multilingual +    BUNDLE=:bundle +    CONCORD_MAX=:concord_max +    DIGEST=:digest +    WEBSERV_HOST_CGI=:webserv_host_cgi +    WEBSERV_PORT_CGI=:webserv_port_cgi +    POSTGRESQL_USER=:postgresql_user +    POSTGRESQL_PORT=:postgresql_port +    SQLITE_USER=:sqlite_user +    SQLITE_PATH=:sqlite_path +    SQLITE_PORT=:sqlite_port +    DEFAULT_DIR={ +      IMAGES =>                   '_sisu/image', +      SISU_ETC =>                 etc, +      SISU_SHARE =>               share, +      SAMPLE_DATA_PATH =>         data, +      IMAGE_STUB =>               '_sisu/image', +      STYLESHEET_STUB =>          '_sisu/css', +      IMAGE_LOCAL =>              @@pwd + '/_sisu/image', +      WEBSERV_PATH =>             out + '/www', +      #WEBSERV_DIR =>             www, # uncomment for urls... +      #WEBSERV_IMAGE =>            out + '/www/_sisu/image', +      WEBSERV_MAN =>              out + '/www/man', #alter +      WEBSERV_PHP =>              out + '/www/php', +      WEBSERV_CGI =>              '/usr/lib/cgi-bin', +      WEBSERV_RSS =>              out + '/www/feed', +      WEBSERV_SQLITE =>           out + '/www/sqlite', +      OUTPUT_LOCAL =>             @@home + '/sisu_www', +      PROCESSING_DIR =>           processing_dir, +      PROCESSING_PATH =>          processing_pth, +      PROCESSING_DIR_TMP_ROOT  => prcss_dir_tmp_root, +      PROCESSING_PATH_TMP_BASE => processing_pth, +      PROCESSING_AO =>            'ao', +      PROCESSING_TUNE =>          'tune', +      PROCESSING_LATEX =>         'tex', +      PROCESSING_TEXINFO =>       'texinfo', +      PROCESSING_SQLITE =>        'sqlite', +      PROCESSING_POSTGRESQL=>     'postgresql', +      PROCESSING_ENCODING =>      'encoding', +      PROCESSING_GIT =>           processing_git, +      #TEXINFO_STUB =>             'texinfo', +      PAPERSIZE =>                'A4', #A4, US_letter, book_b5, book_a5, US_legal +      #LANGUAGE =>                 'English', +      #LANGUAGE_CODE =>            'en', #change, unecessary duplication though currently used +      MULTILINGUAL =>             false, +      BUNDLE =>                   false, +      CONCORD_MAX =>              260000, +      DIGEST =>                   :sha256, +      WEBSERV_HOST_CGI =>         'http://localhost', +      WEBSERV_PORT_CGI =>         8081, #8111,8123,8081 +      POSTGRESQL_USER =>          @@user, #'ralph', # change user !!! +      POSTGRESQL_PORT =>          port_pgsql, +      #POSGRESQL_LINKS_PATH =>    '', +      SQLITE_USER =>              @@user, +      SQLITE_PATH =>              @@user, #?? +      SQLITE_PORT =>              '**', +    } +    @@default_dir=DEFAULT_DIR +    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +    @@pwd=@pwd=SiSU_Utils::Path.new.base_markup +    attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path +    def initialize +      @user,   @home, @hostname, @pwd, @sisu_etc, @host, @arch, @rbver, @dir_arch, @dir_sitearch, @dir_bin, @locale, @default_dir= +        @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir +      #note rbver is duplicated in InfoVersion +    end +  end +end +module SiSU_Info_Sys +  class InfoSystem < SiSU_Info_Sys_Gen::InfoSystemGen +    include Singleton +    def initialize +      super() +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_load.rb b/lib/sisu/v5/se_load.rb new file mode 100644 index 00000000..f235fa3f --- /dev/null +++ b/lib/sisu/v5/se_load.rb @@ -0,0 +1,114 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_load.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Load +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class Load +    def initialize(prog,mandatory=false) +      @prog,@mandatory=prog,mandatory +    end +    def prog +      load_prog=false +      $:.each do |reqpath| +        if FileTest.exist?("#{reqpath}/#{@prog}.rb") +          load_prog=true +          #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).ok("#{reqpath}/#{@prog}.rb loaded") +          break +        #else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{reqpath}/#{@prog}.rb not found") +        end +      end +      if load_prog \ +      and @prog=~/dbi/ +        begin +          require 'dbi' +        rescue LoadError +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error('dbi NOT FOUND (LoadError)') +        end +      end +      if load_prog +        begin +          require @prog +        rescue LoadError +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error("#{@prog} NOT FOUND (LoadError)") +        end +      else +        @mandatory \ +        ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) +        : '' #(SiSU_Screen::Ansi.new(@prog,"*WARN* #{@prog} load requested").warn) +      end +      load_prog +    end +    def prog? +      load_prog=false +      $:.each do |reqpath| +        if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true +          break +        end +      end +      load_prog +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_processing.rb b/lib/sisu/v5/se_processing.rb new file mode 100644 index 00000000..0a035ce8 --- /dev/null +++ b/lib/sisu/v5/se_processing.rb @@ -0,0 +1,527 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_processing.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Processing_Settings +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class ProcessingSettings +    def initialize(md) +      @md=md +    end +    def cnf_rc #sisurc.yml +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +    end +    def env_rc #env rc (including sisurc.yml) +      @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) +    end +    def doc_rc #document rc, make instructions +      (defined? @md.make) \ +      ? @md.make +      : nil +    end +    def cmd_rc_act #command-line rc +      @cmd_rc_act=@md.opt.opt_act +    end +    def build +      def ocn? +        if cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def plaintext_ocn? +        if cmd_rc_act[:txt_ocn][:set]==:on \ +        or cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:txt_ocn][:set]==:off \ +        or cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def odt_ocn? +        if cmd_rc_act[:odt_ocn][:set]==:on \ +        or cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:odt_ocn][:set]==:off \ +        or cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def html_strict? +        if cmd_rc_act[:html_strict][:set]==:on +          true +        elsif cmd_rc_act[:html_strict][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_strict? \ +        and doc_rc.html_strict? ==:on +          true +        else +          false +        end +      end +      def toc? +        if cmd_rc_act[:toc][:set]==:on +          true +        elsif cmd_rc_act[:toc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.toc? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.toc? ==:off +          false +        else +          true +        end +      end +      def manifest? +        if cmd_rc_act[:manifest][:set]==:on +          true +        elsif cmd_rc_act[:manifest][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.manifest? \ +        and doc_rc.manifest? ==:off +          false +        elsif env_rc.build.manifest? ==:off +          false +        else +          true +        end +      end +      def links_to_manifest? +        if cmd_rc_act[:links_to_manifest][:set]==:on +          true +        elsif cmd_rc_act[:links_to_manifest][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.links_to_manifest? \ +        and doc_rc.links_to_manifest? ==:off +          false +        elsif env_rc.build.links_to_manifest? ==:off +          false +        else +          true +        end +      end +      def metadata? +        if cmd_rc_act[:metadata][:set]==:on +          true +        elsif cmd_rc_act[:metadata][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.metadata? \ +        and doc_rc.metadata? ==:off +          false +        elsif env_rc.build.metadata? ==:off +          false +        else +          true +        end +      end +      def minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.minitoc? \ +        and doc_rc.minitoc? ==:off +          false +        elsif env_rc.build.minitoc? ==:off +          false +        else +          true +        end +      end +      def manifest_minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:manifest_minitoc][:set]==:on \ +        || cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ +        || cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.manifest_minitoc? \ +        and (doc_rc.manifest_minitoc? ==:off \ +        || doc_rc.minitoc? ==:off) +          false +        elsif env_rc.build.manifest_minitoc? ==:off \ +        || env_rc.build.minitoc? ==:off +          false +        elsif minitoc? == false +          false +        else +          true +        end +      end +      def html_minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:html_minitoc][:set]==:on \ +        || cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:html_minitoc][:set]==:off \ +        || cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_minitoc? \ +        and (doc_rc.html_minitoc? ==:off \ +        || doc_rc.minitoc? ==:off) +          false +        elsif env_rc.build.html_minitoc? ==:off \ +        || env_rc.build.minitoc? ==:off +          false +        elsif minitoc? == false +          false +        else +          true +        end +      end +      def html_top_band? +        if cmd_rc_act[:html_top_band][:set]==:on +          true +        elsif cmd_rc_act[:html_top_band][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_top_band? \ +        and doc_rc.html_top_band? ==:off +          false +        elsif env_rc.build.html_top_band? ==:off +          false +        else +          true +        end +      end +      def html_navigation? +        if cmd_rc_act[:html_navigation][:set]==:on +          true +        elsif cmd_rc_act[:html_navigation][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_navigation? \ +        and doc_rc.html_navigation? ==:off +          false +        elsif env_rc.build.html_navigation? ==:off +          false +        else +          true +        end +      end +      def html_navigation_bar? +        if cmd_rc_act[:html_navigation_bar][:set]==:on +          true +        elsif cmd_rc_act[:html_navigation_bar][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_navigation_bar? \ +        and doc_rc.html_navigation_bar? ==:off +          false +        elsif env_rc.build.html_navigation_bar? ==:off +          false +        else +          true +        end +      end +      def search_form? +        if cmd_rc_act[:search_form][:set]==:on +          true +        elsif cmd_rc_act[:search_form][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_search_form? \ +        and doc_rc.search_form? ==:off +          false +        elsif env_rc.build.search_form? ==:off +          false +        else +          true +        end +      end +      def html_search_form? +        if cmd_rc_act[:html_search_form][:set]==:on \ +        || cmd_rc_act[:search_form][:set]==:on +          true +        elsif cmd_rc_act[:html_search_form][:set]==:off \ +        || cmd_rc_act[:search_form][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_search_form? \ +        and (doc_rc.html_search_form? ==:off \ +        || doc_rc.search_form? ==:off) +          false +        elsif env_rc.build.html_search_form? ==:off \ +        || env_rc.build.search_form? ==:off +          false +        elsif search_form? == false +          false +        else +          true +        end +      end +      def html_right_pane? +        if cmd_rc_act[:html_right_pane][:set]==:on +          true +        elsif cmd_rc_act[:html_right_pane][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_right_pane? \ +        and doc_rc.html_right_pane? ==:off +          false +        elsif env_rc.build.html_right_pane? ==:off +          false +        else +          true +        end +      end +      def segsubtoc? +        if cmd_rc_act[:segsubtoc][:set]==:on +          true +        elsif cmd_rc_act[:segsubtoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.segsubtoc? \ +        and doc_rc.segsubtoc? ==:off +          false +        elsif env_rc.build.segsubtoc? ==:off +          false +        else +          true +        end +      end +      self +    end +    def ocn_html_identifier +      (build.html_strict?) \ +      ? Mx[:ocn_id_char] +      : '' +    end +    def output_dir_structure +      def by_language_code? +        if cmd_rc_act[:output_by][:set] == :language +          true +        elsif cmd_rc_act[:output_by][:set] == :filetype \ +        or cmd_rc_act[:output_by][:set] == :filename +          false +        elsif cmd_rc_act[:output_by][:set] == :language +          true +        else +          env_rc.output_dir_structure.by_language_code? +        end +      end +      def by_filetype? +        if cmd_rc_act[:output_by][:set] == :filetype +          true +        elsif cmd_rc_act[:output_by][:set] == :language \ +        or cmd_rc_act[:output_by][:set] == :filename +          false +        elsif cmd_rc_act[:output_by][:set] == :filetype +          true +        else +          env_rc.output_dir_structure.by_filetype? +        end +      end +      def by_filename? +        if cmd_rc_act[:output_by][:set] == :filename +          true +        elsif cmd_rc_act[:output_by][:set] == :language \ +        or cmd_rc_act[:output_by][:set] == :filetype +          false +        elsif cmd_rc_act[:output_by][:set] == :filename +          true +        else +          env_rc.output_dir_structure.by_filename? +        end +      end +      def multilingual? +        by_language_code? +      end +      def dump? +        ((cmd_rc_act[:dump][:bool] \ +        &&  cmd_rc_act[:dump][:inst]) \ +        || (env_rc.output_dir_structure.dump?)) \ +        ? true +        : false +      end +      def redirect? +        ((cmd_rc_act[:redirect][:bool] \ +        &&  cmd_rc_act[:redirect][:inst]) \ +        || (env_rc.output_dir_structure.redirect?)) \ +        ? true +        : false +      end +      def dump_or_redirect? +        ((dump?) || (redirect?)) \ +        ? true +        : false +      end +      def by? +        if dump? +          :dump +        elsif redirect? +          :redirect +        elsif by_language_code? +          :language +        elsif by_filetype? +          :filetype +        elsif by_filename? +          :filename +        else #recheck current default +          :language +        end +      end +      self +    end +  end +end +module SiSU_Info_Processing_Flag +  class InfoProcessingFlag +    attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 +    def initialize +      @rc=SiSU_Get_Init::GetInit.new.sisu_yaml.rc +    end +    def color                          #processing flag shortcuts +      (defined? @rc['flag']['color']) \ +      ? @rc['flag']['color'] +      : false +    end +    def cf_0                           #processing flag shortcuts +      if defined? @rc['flag']['default'] \ +      and @rc['flag']['default'].is_a?(String) +        @rc['flag']['default'] +      else #'-NQhewpotbxXdyYv' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest' +      end +    end +    def cf_1                           #processing flag shortcuts +      if defined? @rc['flag']['i'] \ +      and @rc['flag']['i'].is_a?(String) +        @rc['flag']['i'] +      else #'-Qhewpoty' +        '--digest --qrcode --text --html --epub --concordance --pdf --manifest' +      end +    end +    def cf_2                           #processing flag shortcuts +      if defined? @rc['flag']['ii'] \ +      and @rc['flag']['ii'].is_a?(String) +        @rc['flag']['ii'] +      else #'-NQhewpotbxXdy' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --manifest' +      end +    end +    def cf_3                           #processing flag shortcuts +      if defined? @rc['flag']['iii'] \ +      and @rc['flag']['iii'].is_a?(String) +        @rc['flag']['iii'] +      else #'-NQhewpotbxXdyY' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest' +      end +    end +    def cf_4                           #processing flag shortcuts +      if defined? @rc['flag']['iv'] \ +      and @rc['flag']['iv'].is_a?(String) +        @rc['flag']['iv'] +      else #'-NQhewpotbxXdDyY --update' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --postresql --update --manifest' +      end +    end +    def cf_5                           #processing flag shortcuts +      if defined? @rc['flag']['v'] \ +      and @rc['flag']['v'].is_a?(String) +        @rc['flag']['v'] +      else #'-NQhewpotbxXdyYsS' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --sisupod --source' +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_programs.rb b/lib/sisu/v5/se_programs.rb new file mode 100644 index 00000000..35d68cb6 --- /dev/null +++ b/lib/sisu/v5/se_programs.rb @@ -0,0 +1,384 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_programs.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Sys_Call +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class SystemCall +    @@locale_flag=false +    def initialize(input='',output='',opt_or_cmd='') +      @input,@output=input,output +      (opt_or_cmd.is_a?(SiSU_Commandline::Options)) \ +      ? (@cmd,@opt=opt_or_cmd.cmd,opt_or_cmd) +      : (@cmd,@opt=opt_or_cmd,nil) #cmd.is_a?(String) +      @prog=SiSU_Env::InfoProgram.new +      @sys=SiSU_Info_Sys::InfoSystem.instance +    end +    def program_found?(program) +      found=`which #{program}` #`whereis #{program}` +      (found =~/bin\/#{program}\b/) ? true : false +    end +    def locale                         #locales utf8 or other +      unless @@locale_flag +        @@locale_flag=true +      end +      @sys.locale +    end +    def file_encoding(filename,cmd='') #file encoding +      program='file' +      fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path +      if program_found?(program) +        encoding=%x{file -L #{fnsp}}.strip +        encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'') +        encoding=if encoding \ +        and not encoding.empty? +          encoding +        else 'UTF-8 assumed, encoding undetermined' +        end +        puts encoding if cmd =~/[VM]/ +        encoding +      else encoding='UTF-8 assumed, file encoding check program unavailable' +      end +    end +    def wc                             #word count +      program='wc' +      if program_found?(program) \ +      and locale !~/utf-?8/i +        true +      else +        program_ref="(not available)" unless program_found?(program) +        program_ref="(UTF-8)" if locale =~/utf-?8/i +        false +      end +    end +    def rcs                            #rcs for document markup data +      program='rcs' +      program_ref="\n\t\tdocument version information requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def cvs                            #cvs for document markup data +      program='cvs' +      program_ref="\n\t\tdocument version information requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def zip                            #zip +      program='zip' +      program_ref="\n\t\tused to in the making of number of file formats, odf, epub" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          mark("*WARN* #{program} is not installed #{program_ref}") +        false +      end +    end +    def openssl                        #openssl for digests +      program='openssl' +      program_ref="\n\t\tused to generate requested source document identification digest" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def md5(filename)                  #md5 dgst +      program='openssl' +      program_ref="\n\t\tmd5 digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def sha256(filename)               #sha dgst +      program='openssl' +      program_ref="\n\t\tsha digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def sha512(filename)               #sha dgst +      program='openssl' +      program_ref="\n\t\tsha digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -sha512 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def psql                           #psql +      program='psql' +      program_ref="\n\t\tpsql requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def create_pg_db(dbname_stub=nil)  #createdb +      unless dbname_stub +        @pwd ||=Dir.pwd +        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +        dbname_stub=@pwd[m,1] +      end +      program='createdb' +      db_name="#{Db[:name_prefix]}#{dbname_stub}" +      program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" +      (program_found?(program)) \ +      ? system("#{program} #{dbname_name}") +      : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") +    end +    def relaxng(cmd='')                #trang - convert between different schema languages for XML +      program='trang' +      program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" +      (program_found?(program)) \ +      ? system("#{program} #{@input} #{@output}") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) +    end +    def qrencode                       #qrcode - for generating QR code +      program='qrencode' +      program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" +      found=(program_found?(program)) ? true : false +      found \ +      ? (system(%{ +          echo "#{@input}" | #{program} -s 3 -o #{@output} +        })) +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) +      #found +    end +    def imagemagick                    #imagemagick is a image manipulation program +      program='identify' +      #program_ref="\n\t\tsee <http://www.imagemagick.org/>" +      found=(program_found?(program)) ? true : false +      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found +      found +    end +    def graphicksmagick                #graphicsmagick is a image manipulation program +      program='gm' +      #program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" +      found=(program_found?(program)) ? true : false +      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found +      found +    end +    def well_formed?                   #tidy - check for well formed xml xhtml etc. +      program=@prog.tidy +      program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" +      (program_found?(program)) \ +      ? system("#{@prog.tidy} -xml #{@input} > #{@output}") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") +    end +    def tex2pdf_engine +      progs=['xetex','xelatex','pdflatex','pdfetex','pdftex'] +      @pdfetex_flag=false +      @cmd ||='' +      @texpdf=nil +      progs.each do |program| +        if program_found?(program) +          @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/ +          @pdfetex_flag=true +          break +        end +      end +      if @pdfetex_flag==false +        @texpdf=progs.join(', ') +      end +      @texpdf +    end +    def latex2pdf(md,papersize='a4')   #convert from latex to pdf +      tell=if @cmd =~/[MV]/ +        '' +      elsif @cmd =~/[v]/ +        %q{2>&1 | grep -v ' WARNING '} +      else %q{2>&1 | grep -v '$'} +      end +      mode='batchmode' #mode='nonstopmode' +      texpdf=tex2pdf_engine +      if @pdfetex_flag +        texpdf_cmd=case texpdf +        when /xetex/ +          %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} +        when /xelatex/ +          %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} +        when /pdftex/ +          "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" +        when /pdflatex/ +          "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" +        end +        system(texpdf_cmd) +      else STDERR.puts "\t*WARN* none of the following programs are installed: #{@texpdf}" +      end +    end +    def makeinfo                       #texinfo +      program='makeinfo' +      options='' #'--force' #'' +      program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" +      (program_found?(program)) \ +      ? system("#{program} #{options} #{@input}\n") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") +    end +    def scp +      puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/ +      puts "scp disabled" +    end +    def rsync(action='',chdir=nil) +      program='rsync' +      if program_found?(program) +        vb=if @cmd =~/q/; 'q' +        elsif @cmd =~/v/; 'v' +        else              '' +        end +        cX=SiSU_Screen::Ansi.new(@cmd).cX +        msg=(@cmd =~/q/) ? '' : %{ && echo " #{cX.grey}OK: #{@input} -> #{@output}#{cX.off}"} +        amp=(@opt \ +        && @opt.files.length > 1) \ +        ? '' +        : ((@cmd =~/[vVM]/) ? '' : '&') +        rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" +        puts rsync_cmd if @cmd =~/[vVM]/ +        dir_change=dir_return=nil +        if not chdir.nil? \ +        && chdir != Dir.pwd +          dir_change=Dir.chdir(chdir) +          dir_return=Dir.pwd +        end +        dir_change if dir_change +        system(" +          #{rsync_cmd} #{msg} #{amp} +        ") +        dir_return if dir_return +      else STDERR.puts "\t*WARN* #{program} not found" +      end +    end +    def rm +      if @cmd =~/^-Z[mMvVq]*$/;      FileUtils::rm_rf(@input) +      elsif @cmd =~/V/;              FileUtils::rm(@input) +      elsif @cmd !~/q/;              FileUtils::rm(@input) +      elsif @cmd =~/q/;              FileUtils::rm(@input) +      else                           STDERR.puts "\t*WARN* operation ignored" +      end +    end +  end +end +module SiSU_Info_Program +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoProgram < SiSU_Info_Env::InfoEnv               # se_info_env.rb +    attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite +    def initialize +      prog=SiSU_Env::InfoEnv.new.program +      @editor,           @wc,    @tidy,    @rexml,    @pdflatex,    @postgresql,    @sqlite= +        prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite +    end +  end +end +module SiSU_Info_Set +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoSettings < SiSU_Info_Env::InfoEnv              # se_info_env.rb +    def permission?(prog)                                  # program defaults +      (defined? @rc['permission_set'][prog]) \ +      ? @rc['permission_set'][prog] +      : false +    end +    def program?(prog)                                     # program defaults +      (defined? @rc['program_set'][prog]) \ +      ? @rc['program_set'][prog] +      : false +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_remotes.rb b/lib/sisu/v5/se_remotes.rb new file mode 100644 index 00000000..83912d17 --- /dev/null +++ b/lib/sisu/v5/se_remotes.rb @@ -0,0 +1,559 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_remotes.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Remote_Host +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoRemoteHost +    def initialize +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +    end +    def remote_host #see InfoRemote remote_host_base_general +      r=[] +      r=if (defined? @rc['remote'] \ +      and @rc['remote'].is_a?(Array)) +        r_array=@rc['remote'] +        r_array.each_with_index do |renv,i| +          r[i]={} +          if defined? renv['user'] \ +          and defined? renv['host'] +          end +          r[i][:user]=renv['user'] +          r[i][:host]=renv['host'] +          r[i][:path]=if defined? renv['path'] +            renv['path'] +          else '' +          end +          r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" +        end +        r +      elsif (defined? @rc['remote'] \ +      and @rc['remote'].is_a?(Hash) \ +      and defined? @rc['remote']['user'] \ +      and defined? @rc['remote']['host']) +        r[0]={} +        r[0][:user]=@rc['remote']['user'] +        r[0][:host]=@rc['remote']['host'] +        r[0][:path]=if defined? @rc['remote']['path'] +          @rc['remote']['path'] +        else '' +        end +        r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}" +        r +      else +        r[0]={} +        r[0][:name]='.' +        r[0][:user]='' +        r[0][:host]='' +        r[0][:path]='' +        #puts "no remote host or user" +        r +      end +    end +    def rhost +      def r1 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) +        : nil +      end +      def r2 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) +        : nil +      end +      def r3 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) +        : nil +      end +      def r4 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) +        : nil +      end +      def r5 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) +        : nil +      end +      def r6 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \ +        ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) +         : nil +      end +      self +    end +  end +end +module SiSU_Info_Remote +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_filemap'                            # se_filemap.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class InfoRemote < SiSU_File_Map::FileMap                # se_filemap.rb +    @@flag_remote=false +    begin +      require 'socket' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('socket NOT FOUND (LoadError)') +    end +    def initialize(opt) +      super(opt) # +      @opt=opt +      @rc=GetInit.new.sisu_yaml.rc +    end +    def remote_host_base_general +      SiSU_Env::InfoRemoteHost.new.remote_host +    end +    def remote_host_base +      remote_host_base_general.each do |remote_conn| +        @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ +      end +      remote_host_base_general +    end +    def scp                            #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built +      def document +        self.remote_host_base.each do |remote_conn| +          local_gen=@source_path +          remote_gen=case @opt.cmd +          when /u/ +            remote_conn[:name] + '/' \ +              + @env.path.base_markup_dir_stub + '/.'             #creates remote directory tree, this is not the usual function of u +          when /[abhHNopwxXy]/ +            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 +          local_pod=@source_path_pod +          remote_epub= +            remote_conn[:name] + '/' + @env.path.stub_epub + '/.' +          remote_src= +            remote_conn[:name] + '/' + @env.path.stub_src + '/.' +          remote_pod= +            remote_conn[:name] + '/' + @env.path.stub_pod + '/.' +          src_txt=@opt.fnc +          src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') +          if (local_gen =~/\S/ \ +          and local_gen !~/\/\//) \ +          and (remote_gen =~/\S/ \ +          and remote_gen !~/\/\//) \ +          and @@flag_remote==true \ +          and @opt.cmd !~/U/ +            SiSU_Env::SystemCall.new(local_gen,remote_gen).scp +            if FileTest.file?("#{local_src}/#{src_txt}") +              SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp +            end +            if FileTest.file?("#{local_pod}/#{src_pod}") +              SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp +            end +            if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") +              SiSU_Env::SystemCall.new( +                "#{local_epub}/#{@opt.fnb}.epub", +                remote_epub,@opt.cmd +              ).scp +            end +          elsif  @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "#{local_gen} -> #{remote_gen}" +            if FileTest.file?("#{local_src}/#{src_doc}") +              puts "#{local_src}/#{src_doc}* -> #{remote_src}" +            end +            if FileTest.file?("#{local_pod}/#{src_doc}.txz") +              puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" +            end +          else +            puts 'suspect scp request, ignored' +            puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" +            puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          end +        end +      end +      def site_base                    #base site +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            puts "begin scp_base: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "begin scp_base: #{local} -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          end +        end +      end +      def site_base_all                #base site +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            puts "begin scp_base_all: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "scp_base_all: #{local} -> #{remote}" +            puts "#{local}/_sisu/image_sys/ -> #{remote}" +            puts "#{local}/_sisu/image/ -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      self +    end +    def rsync +      def document +        f=(@opt.act[:ao][:set]==:on) \ +        ? SiSU_Env::FileOp.new(@md) +        : nil +        if f +          self.remote_host_base.each do |remote_conn| +            local_gen=@source_path +            #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/ \ +            and local_gen !~/\/\//) \ +            and (remote_gen =~/\S/ \ +            and remote_gen !~/\/\//) \ +            and @@flag_remote==true \ +            and @opt.cmd !~/U/ +#             SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync +              #delete_extra_files='--delete' # '--delete-after' +              inp=[] +              if (@opt.act[:html][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.html_scroll.dir) +                inp \ +                  << f.output_path.html_seg.rel \ +                  << f.place_file.html_scroll.rel +              end +              if (@opt.act[:concordance][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.html_concordance.dir) +                inp << f.place_file.html_concordance.rel +              end +              if (@opt.act[:epub][:set]==:on \ +              || @opt.cmd =~/^-R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.epub.dir) +                inp << f.place_file.epub.rel +              end +              if (@opt.act[:odt][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.odt.dir) +                inp << f.place_file.odt.rel +              end +              if (@opt.act[:xhtml][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xhtml.dir) +                inp << f.place_file.xhtml.rel +              end +              if (@opt.act[:xml_sax][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_sax.dir) +                inp << f.place_file.xml_sax.rel +              end +              if (@opt.act[:xml_dom][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_dom.dir) +                inp << f.place_file.xml_dom.rel +              end +              if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir) +                inp << f.place_file.xml_scaffold_structure_sisu.rel +              end +              if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir) +                inp << f.place_file.xml_scaffold_structure_collapse.rel +              end +              if (@opt.act[:txt][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.txt.dir) +                inp << f.place_file.txt.rel +              end +              if (@opt.act[:manpage][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.manpage.dir) +                inp << f.place_file.manpage.rel +              end +              if (@opt.act[:texinfo][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.info.dir) +                inp << f.place_file.info.rel +              end +              if (@opt.act[:hash_digests][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.hash_digest.dir) +                inp << f.place_file.hash_digest.rel +              end +              if (@opt.act[:share_source][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.src.dir) +                inp << f.place_file.src.rel +              end +              if (@opt.act[:sisupod][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.sisupod.dir) +                inp << f.place_file.sisupod.rel +              end +              if (@opt.act[:pdf][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) +                inp <<=(@opt.dir_structure_by == :filename) \ +                ? (f.output_path.pdf.rel + '/*.pdf') +                : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf') +              end +              if (@opt.act[:sqlite_discrete][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.sqlite_discrete.dir) +                inp << f.place_file.sqlite_discrete.rel +              end +              if (@opt.act[:qrcode][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.qrcode_md.dir) +                inp \ +                  << f.place_file.qrcode_md.rel \ +                  << f.place_file.qrcode_title.rel +              end +              if (@opt.act[:manifest][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.manifest.dir) +                inp << f.place_file.manifest.rel +              end +              local_gen=if inp.length > 0 +                inp.join(' ') +              else '' +              end +              local_css,images,images_system='','','' +              images=images_skin=images_system=local_css='' +              if @opt.cmd =~/[hwbxX]/ \ +              && (defined? @md.ec[:image]) \ +              && (@md.ec[:image].length > 0) +                images= +                  f.place_file.images.rel + '/' \ +                    + @md.ec[:image].join(" #{f.output_path.images.rel}/") +              end +              if @opt.cmd =~/[yhwbxX]/ \ +              && (defined? @md.ec[:image]) \ +              && (@md.ec[:image].length > 0) +                local_css=f.output_path.css.rel +                images_system='_sisu/image_sys' +              end +              begin +                ##create file structure without copying files?: +                ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/. +                #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} +                #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +                local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css +                SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd). +                  rsync('--relative',f.output_path.base.dir) +              rescue +                p __LINE__.to_s + ':' + __FILE__ +                local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} +                SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +              end +            elsif @opt.cmd =~/U/ +              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +              puts "#{local_gen} -> #{remote_gen}" +              if FileTest.file?("#{local_src}/#{src_doc}") \ +              or FileTest.file?("#{local_src}/#{src_doc}.txz") +                puts "#{local_src}/#{src_doc}* -> #{remote_src}" +              end +            else +              puts 'suspect rsync request, ignored' +              puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" +              puts "permission not granted #{__FILE__} #{__LINE__}" \ +                if @opt.cmd =~/M/ +            end +          end +        end +      end +      def site_harvest +        self.remote_host_base.each do |remote_conn| +          local=@source_path_harvest +          l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" +          lng='en' +          if @env.output_dir_structure.by? == :language +            ldest=lng + '/manifest' +            files= +              ldest + '/authors.html' + ' ' \ +                + ldest + '/topics.html' +          elsif @env.output_dir_structure.by? == :filetype +            ldest="manifest" +            files= +              ldest + '/authors.' + lng + '.html' + ' ' \ +                + ldest + '/topics.' + lng + '.html' +          elsif @env.output_dir_structure.by? == :filename +            files= +              l_rel + '/authors.' + lng + '.html' + ' ' \ +                + l_rel + '/topics.' + lng + '.html' +          end +          remote="#{remote_conn[:name]}/#{@opt.base_stub}" +          if @opt.act[:harvest][:set] \ +          && @opt.act[:rsync][:set] +            (@env.output_dir_structure.by? == :filename) \ +            ? (SiSU_Env::SystemCall.new(files,remote).rsync) +            : (SiSU_Env::SystemCall.new(ldest,remote). +                rsync('--relative',l_rel)) +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "rsync_harvest: #{local} -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      def site_base                    #base site +        ldest='_sisu/*' +        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.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) +        end +      end +      def site_base_sync +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            delete_extra_files='--delete' # '--delete-after' +            puts "begin rsync_base_sync: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote). +              rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote). +              rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote). +              rsync(delete_extra_files) +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "rsync_base_sync: #{local} -> #{remote}" +            puts "#{local}/_sisu/image_sys/ -> #{remote}" +            puts "#{local}/_sisu/image/ -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      self +    end +    def rsync_sitemaps                 #sitemap directory +      self.remote_host_base.each do |remote_conn| +        local= +          @source_path + '/sitemapindex.xml' +        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) +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "rsync_sitemaps: #{local} -> #{remote}" +        else +          puts "permission not granted #{__FILE__} #{__LINE__}" \ +            if @opt.cmd =~/M/ +        end +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_standardise_lang.rb b/lib/sisu/v5/se_standardise_lang.rb new file mode 100644 index 00000000..62b3a318 --- /dev/null +++ b/lib/sisu/v5/se_standardise_lang.rb @@ -0,0 +1,182 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_standardise_lang.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +@@lang_info=nil +module SiSU_Standardise_Lang +  class StandardiseLanguage +    require_relative 'i18n'                  # i18n.rb +    def initialize(l='') +      @language=(l.nil? || l.empty?) \ +      ? SiSU_Env::InfoEnv.new.language_default_set +      : l +      @r=%{(?:#{Px[:lng_lst_rgx]})} +      @lang_info=SiSU_i18n::Languages.new +    end +    def lang_lst                       # from i18n +      @@lang_info ||=@lang_info.language.list +    end +    def lang(l='')                     # from i18n +      if l =~/^#{@r}$/ +        @lang_info.language.list[l] +      elsif @language =~/^#{@r}$/ +        @lang_info.language.list[@language] +      else nil +      end +    end +    def language +      lng={} +      case @language +      when /^am$|Amharic/i                    then d,c,l=false,lang_lst['am'][:c],    lang_lst['am'][:n] +      when /^bg$|Bulgarian/i                  then d,c,l=false,lang_lst['bg'][:c],    lang_lst['bg'][:n] +      when /^bn$|Bengali/i                    then d,c,l=false,lang_lst['bn'][:c],    lang_lst['bn'][:n] +      when /^br$|Breton/i                     then d,c,l=false,lang_lst['br'][:c],    lang_lst['br'][:n] +      when /^ca$|Catalan/i                    then d,c,l=false,lang_lst['ca'][:c],    lang_lst['ca'][:n] +      when /^cs$|Czech/i                      then d,c,l=false,lang_lst['cs'][:c],    lang_lst['cs'][:n] +      when /^cy$|Welsh/i                      then d,c,l=false,lang_lst['cy'][:c],    lang_lst['cy'][:n] +      when /^da$|Danish|Dansk/i               then d,c,l=false,lang_lst['da'][:c],    lang_lst['da'][:n] +      when /^de$|German/i                     then d,c,l=false,lang_lst['de'][:c],    lang_lst['de'][:n] +      when /^el$|Greek/i                      then d,c,l=false,lang_lst['el'][:c],    lang_lst['el'][:n] +      when /^en$|English/i                    then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] +      when /^eo$|Esperanto/i                  then d,c,l=false,lang_lst['eo'][:c],    lang_lst['eo'][:n] +      when /^es$|Spanish|Espanol/i            then d,c,l=false,lang_lst['es'][:c],    lang_lst['es'][:n] +      when /^et$|Estonian/i                   then d,c,l=false,lang_lst['et'][:c],    lang_lst['et'][:n] +      when /^eu$|Basque/i                     then d,c,l=false,lang_lst['eu'][:c],    lang_lst['eu'][:n] +      when /^fi$|Finnish|Finsk|Suomi/i        then d,c,l=false,lang_lst['fi'][:c],    lang_lst['fi'][:n] +      when /^fr$|French|Francais/i            then d,c,l=false,lang_lst['fr'][:c],    lang_lst['fr'][:n] +      when /^ga$|Irish/i                      then d,c,l=false,lang_lst['ga'][:c],    lang_lst['ga'][:n] +      when /^gl$|Galician/i                   then d,c,l=false,lang_lst['gl'][:c],    lang_lst['gl'][:n] +      when /^he$|Hebrew/i                     then d,c,l=false,lang_lst['he'][:c],    lang_lst['he'][:n] +      when /^hi$|Hindi/i                      then d,c,l=false,lang_lst['hi'][:c],    lang_lst['hi'][:n] +      when /^hr$|Croatian/i                   then d,c,l=false,lang_lst['hr'][:c],    lang_lst['hr'][:n] +      when /^hy$|Armenian/i                   then d,c,l=false,lang_lst['hy'][:c],    lang_lst['hy'][:n] +      when /^ia$|Interlingua/i                then d,c,l=false,lang_lst['ia'][:c],    lang_lst['ia'][:n] +      when /^is$|Icelandic/i                  then d,c,l=false,lang_lst['is'][:c],    lang_lst['is'][:n] +      when /^it$|Italian/i                    then d,c,l=false,lang_lst['it'][:c],    lang_lst['it'][:n] +      when /^la$|Latin/i                      then d,c,l=false,lang_lst['la'][:c],    lang_lst['la'][:n] +      when /^lo$|Lao/i                        then d,c,l=false,lang_lst['lo'][:c],    lang_lst['lo'][:n] +      when /^lt$|Lithuanian/i                 then d,c,l=false,lang_lst['lt'][:c],    lang_lst['lt'][:n] +      when /^lv$|Latvian/i                    then d,c,l=false,lang_lst['lv'][:c],    lang_lst['lv'][:n] +      when /^ml$|Malayalam/i                  then d,c,l=false,lang_lst['ml'][:c],    lang_lst['ml'][:n] +      when /^mr$|Marathi/i                    then d,c,l=false,lang_lst['mr'][:c],    lang_lst['mr'][:n] +      when /^nl$|Dutch/i                      then d,c,l=false,lang_lst['nl'][:c],    lang_lst['nl'][:n] +      when /^no$|Norwegian|Norsk/i            then d,c,l=false,lang_lst['no'][:c],    lang_lst['no'][:n] +      when /^nn$|Norwegian Nynorsk/i          then d,c,l=false,lang_lst['nn'][:c],    lang_lst['nn'][:n] +      when /^oc$|Occitan/i                    then d,c,l=false,lang_lst['oc'][:c],    lang_lst['oc'][:n] +      when /^pl$|Polish/i                     then d,c,l=false,lang_lst['pl'][:c],    lang_lst['pl'][:n] +      when /^pt$|Portuguese/i                 then d,c,l=false,lang_lst['pt'][:c],    lang_lst['pt'][:n] +      when /^pt_BR$|Portuguese Brazil/i       then d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] +      when /^ro$|Romanian/i                   then d,c,l=false,lang_lst['ro'][:c],    lang_lst['ro'][:n] +      when /^ru$|Russian/i                    then d,c,l=false,lang_lst['ru'][:c],    lang_lst['ru'][:n] +      when /^sa$|Sanskrit/i                   then d,c,l=false,lang_lst['sa'][:c],    lang_lst['sa'][:n] +      when /^se$|Sami/i                       then d,c,l=false,lang_lst['se'][:c],    lang_lst['se'][:n] +      when /^sk$|Slovak/i                     then d,c,l=false,lang_lst['sk'][:c],    lang_lst['sk'][:n] +      when /^sl$|Slovenian/i                  then d,c,l=false,lang_lst['sl'][:c],    lang_lst['sl'][:n] +      when /^sq$|Albanian/i                   then d,c,l=false,lang_lst['sq'][:c],    lang_lst['sq'][:n] +      when /^sr$|Serbian/i                    then d,c,l=false,lang_lst['sr'][:c],    lang_lst['sr'][:n] +      when /^sv$|Swedish|Svensk/i             then d,c,l=false,lang_lst['sv'][:c],    lang_lst['sv'][:n] +      when /^ta$|Tamil/i                      then d,c,l=false,lang_lst['ta'][:c],    lang_lst['ta'][:n] +      when /^te$|Telugu/i                     then d,c,l=false,lang_lst['te'][:c],    lang_lst['te'][:n] +      when /^th$|Thai/i                       then d,c,l=false,lang_lst['th'][:c],    lang_lst['th'][:n] +      when /^tk$|Turkmen/i                    then d,c,l=false,lang_lst['tk'][:c],    lang_lst['tk'][:n] +      when /^tr$|Turkish/i                    then d,c,l=false,lang_lst['tr'][:c],    lang_lst['tr'][:n] +      when /^uk$|Ukranian/i                   then d,c,l=false,lang_lst['uk'][:c],    lang_lst['uk'][:n] +      when /^ur$|Urdu/i                       then d,c,l=false,lang_lst['ur'][:c],    lang_lst['ur'][:n] +      when /^us|American$|/i                  then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] +      when /^vi$|Vietnamese/i                 then d,c,l=false,lang_lst['vi'][:c],    lang_lst['vi'][:n] +      else                                     d,c,l=true, lang_lst['en'][:c],    lang_lst['en'][:n] #default +      end +      lng[:d],lng[:c],lng[:n]=d,c,l +      lng +    end +    def name +      language[:n].downcase +    end +    def title +      language[:n] +    end +    def code +      language[:c] +    end +    def tex_name +      language[:xlp] +    end +    def file_to_language(file)         # used, fix and remove +      m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ +      @language=if file =~m ; file[m,1] +      else '' +      end +      language +    end +    def codes +      # Language List po4a +      #   <http://www.debian.org/international/l10n/po/> +      #   Px[:lng_lst] see constants.rb +      # see polyglossia for subset +      #   <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf> +      # also note ISO_639-2 +      #   <http://en.wikipedia.org/wiki/ISO_639-2> +      #   <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes> +      Px[:lng_lst] # constants.rb +    end +  end +end +__END__ diff --git a/lib/sisu/v5/se_version.rb b/lib/sisu/v5/se_version.rb new file mode 100644 index 00000000..8f21c3f0 --- /dev/null +++ b/lib/sisu/v5/se_version.rb @@ -0,0 +1,158 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/se_version.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Version +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class InfoVersion < SiSU_Info_Env::InfoEnv               # se_info_env.rb +    include Singleton +    begin +      require 'rbconfig' +      require 'yaml' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('rbconfig or yaml NOT FOUND (LoadError)') +    end +    @@lib_path=nil +    def get_version +      @version={} +      @pwd=ENV['PWD'] +      lib_path= +        @@lib_path \ +        ? @@lib_path +        : `echo $RUBYLIB`.split(':') +      @@lib_path ||=lib_path +      if File.exist?(SiSU_is[:version_info_path]) +        @version=YAML::load(File::open(SiSU_is[:version_info_path])) +      end +      @version[:install_method]=if SiSU_is[:run_from]==:gem_install +        spec = Gem::Specification.find_by_name("sisu") +        gem_root = spec.gem_dir +        (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ +        ? ' (ruby gem install)' : '' +      else '' +      end +      @version +    end +    def rbversion +      %x{ruby -v}.strip +    end +  end +end +module SiSU_Info_About +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class InfoAbout +    def initialize(color='') +      @color=color +    end +    def sisu_version +      version=SiSU_Env::InfoVersion.instance.get_version +      rb_ver=SiSU_Env::InfoVersion.instance.rbversion +      if version[:version] +        opt_cmd=if defined? @color.cmd \ +        and @color.cmd =~/[ck]/ +          @color.cmd +        else '-v' +        end +        SiSU_Screen::Ansi.new( +          opt_cmd, +          version[:project], +          version[:version], +          version[:date_stamp], +          version[:date], +          version[:install_method], +          rb_ver +        ).version +      else puts 'SiSU (version information not available)' +      end +    end +    def sisu_about +      puts <<-WOK +     sisu: documents; markup, structuring, publishing in multiple standard formats, & search +     most (not all) useful commands (are made in a directory containing a sisu markup file &) take the form: +       sisu [action(s)] [filename(s)] +     where filename refers to a valid sisu marked up file, e.g.: +       cd /usr/share/doc/sisu/markup-samples/sisu_manual +       sisu --html --verbose sisu_commands.sst +       sisu --txt --html --epub --odt --pdf --sqlite --manpage --texinfo --concordance --qrcode --verbose sisu.ssm +       cd - +     See output produced, or see man pages: man sisu +     <http://www.sisudoc.org/> <http://www.jus.uio.no/sisu/> +        WOK +    end +  end +end +__END__ diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index c22b865f..b76d2d60 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -92,7 +92,11 @@ module SiSU_Sitemaps            @sitemap_idx_fn='sitemapindex.xml'            @env=SiSU_Env::InfoEnv.new            output_idx(sitemap_index) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'sitemap index:', +            "#{@env.path.output}/#{@sitemap_idx_fn}" +          ).result unless @opt.act[:quiet][:set]==:on          end        rescue          SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do @@ -104,7 +108,10 @@ module SiSU_Sitemaps      def make_file(path,filename)        (File.writable?("#{path}/.")) \        ? (File.new("#{path}/#{filename}",'w+')) -      : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn) +      : (SiSU_Screen::Ansi.new( +           '', +           "is the file or directory writable?, could not create #{filename}" +         ).warn)      end      def output_map(sitemap)        path=@md.file.output_path.sitemaps.dir diff --git a/lib/sisu/v5/src_kdissert_share.rb b/lib/sisu/v5/src_kdissert_share.rb index 8ccb9708..abf2f2d1 100644 --- a/lib/sisu/v5/src_kdissert_share.rb +++ b/lib/sisu/v5/src_kdissert_share.rb @@ -76,8 +76,16 @@ module SiSU_KdiSource        @output_path="#{@env.path.output}/#{@opt.fnb}"      end      def read -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.act[:quiet][:set]==:on -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Share Kdissert Source Document!', +        @opt.fnb +      ).green_hi_blue unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "Copy kdissert file to output directory", +        "#{@opt.fnb} -> #{@output_path}" +      ).warn unless @opt.act[:quiet][:set]==:on        FileUtils::mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)        FileUtils::mkdir_p(@output_path) unless FileTest.directory?(@output_path)        if FileTest.directory?(@output_path) @@ -86,7 +94,11 @@ module SiSU_KdiSource            FileUtils::cp(@opt.fnb,@output_path)          end        else -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "Output directory does not exist", +          "#{@opt.fnb} -> #{@output_path}" +        ).warn unless @opt.act[:quiet][:set]==:on          exit        end      end diff --git a/lib/sisu/v5/src_share.rb b/lib/sisu/v5/src_share.rb index 1fff050e..f78b922f 100644 --- a/lib/sisu/v5/src_share.rb +++ b/lib/sisu/v5/src_share.rb @@ -103,7 +103,10 @@ module SiSU_Markup          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab +          SiSU_Screen::Ansi.new( +            '', +            "#{@opt.fno} not available" +          ).blue_tab          end        end      end diff --git a/lib/sisu/v5/src_sisupod_make.rb b/lib/sisu/v5/src_sisupod_make.rb index 4e9c83ba..5dd8f038 100644 --- a/lib/sisu/v5/src_sisupod_make.rb +++ b/lib/sisu/v5/src_sisupod_make.rb @@ -76,15 +76,15 @@ module SiSU_Doc          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          ? SiSU_Screen::Ansi.new( -          @opt.act[:color_state][:set], -          'Assemble source for sisu document', -          "#{@opt.fns} -> file://#{pthinfo}"). -          cyan_hi_blue +            @opt.act[:color_state][:set], +            'Assemble source for sisu document', +            "#{@opt.fns} -> file://#{pthinfo}" +          ).cyan_hi_blue          : SiSU_Screen::Ansi.new( -          @opt.act[:color_state][:set], -          'Assemble source for sisu document', -          pthinfo). -          cyan_title_hi +            @opt.act[:color_state][:set], +            'Assemble source for sisu document', +            pthinfo +          ).cyan_title_hi        end      end      def sisupod_tar_xz diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index b157ce16..ac4c63d5 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -125,7 +125,10 @@ module SiSU_ConvertFootnotes    protected      def create_ao        ao_array=[] -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'convert footnotes').green_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'convert footnotes' +      ).green_title_hi unless @opt.act[:quiet][:set]==:on        file_array=IO.readlines(@opt.fns,'')        file_array.each do |l|          if l =~/\r\n/ then l.gsub!(/\r\n/,"\n") @@ -138,12 +141,23 @@ module SiSU_ConvertFootnotes        or @md.opt.mod.inspect =~/=footnotes-force/          meta=nil          ao=SiSU_ConvertFootnotes::Make.new(@md,file_array).song -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.fns}.fn").output if @md.opt.act[:verbose][:set]==:on -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          @opt.fns, +          "#{@md.fns}.fn" +        ).output if @md.opt.act[:verbose][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "#{@md.fns}.fn -> #{@md.fns}.fn" +        ).txt_red unless @md.opt.act[:quiet][:set]==:on          ao.each {|s| ao_array << "#{s.strip}\n\n" unless s.strip.empty?}          ao_array        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          '*WARN* no footnote conversion done, problem with source file', +          'to override use --convert=footnote-force (this is not advised)' +        ).warn unless @md.opt.act[:quiet][:set]==:on          ''        end      end diff --git a/lib/sisu/v5/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb index c969ac31..7ae4b446 100644 --- a/lib/sisu/v5/sst_from_xml.rb +++ b/lib/sisu/v5/sst_from_xml.rb @@ -76,7 +76,11 @@ module SiSU_sstFromXML        @ver=SiSU_Env::InfoVersion.instance.get_version      end      def tell(filename,type) -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "XML #{type} to SiSU sst", +        "#{filename} --> #{filename}.sst" +      ).green_hi_blue      end      def read        xml_to_sisu diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index 2059e796..acb3ac40 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -89,10 +89,19 @@ module SiSU_SimpleXML_ModelSax        begin          @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run          @env=@particulars.env -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'invert', +          'XML SAX', +          "#{@md.fns} -> #{@md.fn[:sxs]}" +        ).colorize unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{Dir.pwd}/#{@md.fn[:sxs]}" +          ).flow          end          unless @@fns==@opt.fns            @@fns=@opt.fns @@ -445,8 +454,18 @@ WOK          if @prog.tidy !=false #note values can be other than true            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'','','check document structure') +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              'invert', +              'Using XML Tidy', +              'check document structure' +            ).colorize unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              '', +              '', +              'check document structure' +            )              tell.grey_open unless @md.opt.act[:quiet][:set]==:on              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy =SiSU_Env::SystemCall.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile) diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 8d73e832..0d67733f 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -61,7169 +61,98 @@  =end  @@cX=nil -@@current_document=Dir.pwd #nil #'' -@@lang_info=nil  module SiSU_Env -  require_relative 'constants'                             # constants.rb -  require_relative 'utils'                                 # utils.rb +  require_relative 'constants'                         # constants.rb +  require_relative 'utils'                             # utils.rb +  require_relative 'se_date'                           # se_date.rb +  require_relative 'se_info_system'                    # se_info_system.rb +  require_relative 'se_load'                           # se_load.rb +  require_relative 'se_get_init'                       # se_get_init.rb +  require_relative 'se_envcall'                        # se_envcall.rb +  require_relative 'se_programs'                       # se_programs.rb +  require_relative 'se_standardise_lang'               # se_standardise_lang.rb +  require_relative 'se_info_env'                       # se_info_env.rb +  require_relative 'se_processing'                     # se_processing.rb +  require_relative 'se_filemap'                        # se_filemap.rb +  require_relative 'se_file_op'                        # se_file_op.rb +  require_relative 'se_cleanoutput'                    # se_cleanoutput.rb +  require_relative 'se_remotes'                        # se_remotes.rb +  require_relative 'se_version'                        # se_version.rb +  require_relative 'se_db'                             # se_db.rb +  require_relative 'se_css'                            # se_css.rb +  require_relative 'se_clear'                          # se_clear.rb +  require_relative 'se_createsite'                     # se_createsite.rb +  require_relative 'se_info_port'                      # se_info_port.rb    begin      require 'singleton'      require 'fileutils'        include FileUtils::Verbose    rescue LoadError -    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton or fileutils NOT FOUND (LoadError)') +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton or fileutils NOT FOUND (LoadError)')    end    @@noyaml=false -  class InfoDate -    begin -      require 'date' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('date NOT FOUND (LoadError)') -    end -    attr_accessor :dt,:t -    def initialize -      @dt,@t=Date.today.to_s,Time.now -    end -    def week -      w=@t.strftime('%W') -      "#{@t.year}w#{w}" -    end -    def month -      "#{@t.year}#{@t.month}" -    end -    def year -      @t.year -    end -    def weekonly -      @t.strftime('%W') -    end -    def monthonly -      @t.month -    end -    def year_static -      YEAR -    end +  class InfoDate < SiSU_Info_Date::InfoDate                # se_date.rb    end -  class InfoSystemGen -    begin -      require 'rbconfig' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') -    end -    @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] -    out=Config::CONFIG['localstatedir'] -    etc=Config::CONFIG['sysconfdir'] + '/sisu' -    share=Config::CONFIG['datadir'] + '/sisu' -    data=Config::CONFIG['datadir'] + '/doc/sisu' -    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -    @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}/#{@base_markup_dir_stub}" -    if @@user -      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 -    processing_pth=tmp_processing_individual -    processing_dir=prcss_dir -    processing_git="#{Dir.pwd}/#{Gt[:grotto]}" -    #user=ENV['USER'] -    port_pgsql=if defined? ENV['PGPORT'] \ -    and not (ENV['PGPORT'].nil? \ -    || ENV['PGPORT'].empty?) \ -    and ENV['PGPORT']=~/^\d+$/ -      ENV['PGPORT'] -    else '5432' -    end -    IMAGES=:images -    SISU_ETC=:sisu_etc -    SISU_SHARE=:sisu_share -    SAMPLE_DATA_PATH=:sample_data_path -    IMAGE_STUB=:image_stub -    STYLESHEET_STUB=:stylesheet_stub -    IMAGE_LOCAL=:image_local -    WEBSERV_PATH=:webserv_path -    WEBSERV_MAN=:webserv_man -    WEBSERV_PHP=:webserv_php -    WEBSERV_CGI=:webserv_cgi -    WEBSERV_RSS=:webserv_rss -    WEBSERV_SQLITE=:webserv_sqlite -    OUTPUT_LOCAL=:output_local -    PROCESSING_DIR=:processing_dir -    PROCESSING_PATH=:processing_path -    PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root -    PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base -    PROCESSING_AO=:processing_ao -    PROCESSING_TUNE=:processing_tune -    PROCESSING_LATEX=:processing_latex -    PROCESSING_TEXINFO=:processing_texinfo -    PROCESSING_LOUT=:processing_lout -    PROCESSING_SQLITE=:processing_sqlite -    PROCESSING_POSTGRESQL=:processing_postgresql -    PROCESSING_ENCODING=:processing_encoding -    PROCESSING_GIT=:processing_git -    PAPERSIZE=:papersize -    #LANGUAGE=:language -    #LANGUAGE_CODE=:language_code -    MULTILINGUAL=:multilingual -    BUNDLE=:bundle -    CONCORD_MAX=:concord_max -    DIGEST=:digest -    WEBSERV_HOST_CGI=:webserv_host_cgi -    WEBSERV_PORT_CGI=:webserv_port_cgi -    POSTGRESQL_USER=:postgresql_user -    POSTGRESQL_PORT=:postgresql_port -    SQLITE_USER=:sqlite_user -    SQLITE_PATH=:sqlite_path -    SQLITE_PORT=:sqlite_port -    DEFAULT_DIR={ -      IMAGES =>                   '_sisu/image', -      SISU_ETC =>                 etc, -      SISU_SHARE =>               share, -      SAMPLE_DATA_PATH =>         data, -      IMAGE_STUB =>               '_sisu/image', -      STYLESHEET_STUB =>          '_sisu/css', -      IMAGE_LOCAL =>              @@pwd + '/_sisu/image', -      WEBSERV_PATH =>             out + '/www', -      #WEBSERV_DIR =>             www, # uncomment for urls... -      #WEBSERV_IMAGE =>            out + '/www/_sisu/image', -      WEBSERV_MAN =>              out + '/www/man', #alter -      WEBSERV_PHP =>              out + '/www/php', -      WEBSERV_CGI =>              '/usr/lib/cgi-bin', -      WEBSERV_RSS =>              out + '/www/feed', -      WEBSERV_SQLITE =>           out + '/www/sqlite', -      OUTPUT_LOCAL =>             @@home + '/sisu_www', -      PROCESSING_DIR =>           processing_dir, -      PROCESSING_PATH =>          processing_pth, -      PROCESSING_DIR_TMP_ROOT  => prcss_dir_tmp_root, -      PROCESSING_PATH_TMP_BASE => processing_pth, -      PROCESSING_AO =>            'ao', -      PROCESSING_TUNE =>          'tune', -      PROCESSING_LATEX =>         'tex', -      PROCESSING_TEXINFO =>       'texinfo', -      PROCESSING_SQLITE =>        'sqlite', -      PROCESSING_POSTGRESQL=>     'postgresql', -      PROCESSING_ENCODING =>      'encoding', -      PROCESSING_GIT =>           processing_git, -      #TEXINFO_STUB =>             'texinfo', -      PAPERSIZE =>                'A4', #A4, US_letter, book_b5, book_a5, US_legal -      #LANGUAGE =>                 'English', -      #LANGUAGE_CODE =>            'en', #change, unecessary duplication though currently used -      MULTILINGUAL =>             false, -      BUNDLE =>                   false, -      CONCORD_MAX =>              260000, -      DIGEST =>                   :sha256, -      WEBSERV_HOST_CGI =>         'http://localhost', -      WEBSERV_PORT_CGI =>         8081, #8111,8123,8081 -      POSTGRESQL_USER =>          @@user, #'ralph', # change user !!! -      POSTGRESQL_PORT =>          port_pgsql, -      #POSGRESQL_LINKS_PATH =>    '', -      SQLITE_USER =>              @@user, -      SQLITE_PATH =>              @@user, #?? -      SQLITE_PORT =>              '**', -    } -    @@default_dir=DEFAULT_DIR -    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -    @@pwd=@pwd=SiSU_Utils::Path.new.base_markup -    attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path -    def initialize -      @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir=\ -      @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir -      #note rbver is duplicated in InfoVersion -    end +  class InfoSystemGen < SiSU_Info_Sys_Gen::InfoSystemGen   # se_info_system.rb    end -  class InfoSystem < InfoSystemGen -    include Singleton -    def initialize -      super() -    end +  class InfoSystem < SiSU_Info_Sys::InfoSystem             # se_info_system.rb    end -  class Load -    def initialize(prog,mandatory=false) -      @prog,@mandatory=prog,mandatory -    end -    def prog -      load_prog=false -      $:.each do |reqpath| -        if FileTest.exist?("#{reqpath}/#{@prog}.rb") -          load_prog=true -          #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).ok("#{reqpath}/#{@prog}.rb loaded") -          break -        #else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{reqpath}/#{@prog}.rb not found") -        end -      end -      if load_prog \ -      and @prog=~/dbi/ -        begin -          require 'dbi' -        rescue LoadError -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('dbi NOT FOUND (LoadError)') -        end -      end -      if load_prog -        begin -          require @prog -        rescue LoadError -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("#{@prog} NOT FOUND (LoadError)") -        end -      else -        @mandatory \ -        ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) -        : '' #(SiSU_Screen::Ansi.new(@prog,"*WARN* #{@prog} load requested").warn) -      end -      load_prog -    end -    def prog? -      load_prog=false -      $:.each do |reqpath| -        if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true -          break -        end -      end -      load_prog -    end +  class Load < SiSU_Load::Load                             # se_load.rb    end -  class GetInit < InfoSystemGen -    @@noyaml=false -    @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil -    @@ad={ promo: nil, promo_list: nil, flag_promo: false } -    @@sdmd=nil -    attr_accessor :yaml -    def initialize -      super() -        @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory -          false -        else -          @@sdmd=$sisu_document_markup_directory -          true -        end -    end -    def tex -      @@tx ||=SiSU_Viz::TeX.new -    end -    def rc_path_options -      [ -        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", -        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", -        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", -        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", -        "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", -        "#{@@home}/.sisu", -        "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", -        "#{@@sisu_etc}", -      ] -    end -    def sisu_document_make -      def makefile_name -        S_CONF[:header_make] -      end -      def makefile -        rc_path_options.each do |v| -          if FileTest.exist?("#{v}/#{makefile_name}") -            @sisu_make_path=v -            break -          end -        end -        @sisu_make_file_path=@sisu_make_path \ -        ? "#{@sisu_make_path}/#{makefile_name}" -        : nil -      end -      def makefile_read -        if makefile -          sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8') -          @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m) -        end -        @sisu_doc_makefile -      end -      self -    end -    def sisu_yaml -      def rc -        if @markup_dir_changed_ -          rc_path_options.each do |v| -            if @@noyaml \ -            or FileTest.exist?("#{v}/noyaml") -              STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml -              @@noyaml=true -              break -            else -              f=S_CONF[:rc_yml] -              p_f="#{v}/#{f}" -              if FileTest.exist?(p_f) -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@sisurc_path=v -                @@rc=YAML::load(File::open(p_f)) -                break -              end -              unless @@rc -                f='sisurc.yaml' -                p_f="#{v}/#{f}" -                if FileTest.exist?(p_f) -                  begin -                    require 'yaml' -                  rescue LoadError -                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                  end -                  @@sisurc_path=v -                  @@rc=YAML::load(File::open(p_f)) -                  break -                end -              end -            end -          end -        end -        @@rc -      end -      def rc_path -        rc -        @@sisurc_path -      end -      self -    end -    def ads #WORK AREA -      tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' -      if @markup_dir_changed_ -        @ad_path=[ -          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", -          "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{@@home}/.sisu/skin/yml", -          "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", -          "#{@@sisu_etc}/skin/yml", -        ] -        @ad_path.each do |v| -          if @@noyaml \ -          or FileTest.exist?("#{v}/noyaml") -            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml -            @@noyaml=true -            break -          else -            if FileTest.exist?("#{v}/list.yml") -              unless @@ad[:promo_list] -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) -              end -              @@ad[:flag_promo]=true -              break -            end -            @@ad[:flag_promo]=false -          end -        end -        @ad_path.each do |v| -          if @@noyaml \ -          or FileTest.exist?("#{v}/noyaml") -            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml -            @@noyaml=true -            break -          else -            if FileTest.exist?("#{v}/promo.yml") -              unless @@ad[:promo] -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) -              end -              @@ad[:flag_promo]=true -              break -            end -            @@ad[:flag_promo]=false -          end -        end -      end -      @@ad -    end +  class GetInit < SiSU_Get_Init::GetInit                   # se_get_init.rb    end -  class EnvCall -    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil -    @@ad={} -    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad -    def initialize(fns='') -      @fns=fns -      @sys=InfoSystem.instance -      get_init=SiSU_Env::GetInit.new -      @rc=get_init.sisu_yaml.rc -      @ad=get_init.ads -      if @fns \ -      and @fns != '' \ -      and @fns !=@@fns -        @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil -      end -      if @fns \ -      and @fns != '' #watch -        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ -        @@fnn ||=@fns[m,1] -        @@fnb ||=@fns[m,2] -        @@fnt ||=@fns[m,3] -        @@flv ||=document_language_versions_found[:f] -        unless @@fns =~/\S+?\.txz/ -          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' -          elsif @@fnb; @@fnb + '.sst.txz' -          else '' # e.g. termsheet -          end -        end -      end -      @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz -    end -    def default_language? -      if @rc \ -      && defined? @rc['language_default'] -        if (@rc['language_default'].is_a?(String)) \ -        && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/) -          @rc['language_default'] -        else 'en' -        end -      else 'en' -      end -    end -    def mono_multi_lingual? -      if @rc \ -      && defined? @rc['lingual'] -        if (@rc['lingual'].is_a?(String)) \ -        && (@rc['lingual'] =~/mono(?:lingual)?/) -          :mono -        elsif  (@rc['lingual'].is_a?(String)) \ -        && (@rc['lingual'] =~/multi(?:lingual)?/) -          :multi -        else :multi -        end -      else :multi -      end -    end -    def output_dir_structure -      def by? -        output_structure=:filename #set default output structure -        if @rc \ -        && defined? @rc['output_dir_structure_by'] -          output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ -          or ((defined? @rc['output_structure']['dump']) \ -          && @rc['output_structure']['dump'] ==true) -            :dump -          elsif (@rc['output_dir_structure_by'] =~/redirect/) \ -          or ((defined? @rc['output_structure']['redirect']) \ -          && @rc['output_structure']['redirect'] ==true) -            :redirect -          elsif (@rc['output_dir_structure_by'] =~/language/) \ -          or ((defined? @rc['output_structure']['by_language']) \ -          && @rc['output_structure']['by_language'] ==true) -            :language -          elsif (@rc['output_dir_structure_by'] =~/filetype/) \ -          or ((defined? @rc['output_structure']['by_filetype']) \ -          && @rc['output_structure']['by_filetype'] ==true) -            :filetype -          elsif (@rc['output_dir_structure_by'] =~/filename/) \ -          or ((defined? @rc['output_structure']['by_filename']) \ -          && @rc['output_structure']['by_filename'] ==true) -            :filename -          else #set default -            :language -          end -        else #set default -          :language -        end -      end -      def dump? -        ((by?) ==:dump) \ -        ? true -        : false -      end -      def redirect? -        ((by?) ==:redirect) \ -        ? true -        : false -      end -      def by_language_code? -        ((by?) ==:language) \ -        ? true -        : false -      end -      def by_filetype? -        ((by?) ==:filetype) \ -        ? true -        : false -      end -      def by_filename? -        ((by?) ==:filename) \ -        ? true -        : false -      end -      def multilingual? -        by_language_code? -      end -      self -    end -    def document_language_versions_found #REVISIT -      @fn={} -      filename=(@fns =~/\.ssm\.sst$/) \ -      ? @fns.gsub(/\.ssm\.sst$/,'.ssm') -      : @fns -      if filename.is_a?(String) \ -      and not filename.empty? -        if output_dir_structure.by_language_code? -          m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/ -          @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3] -        else m=/(.+?)\.(sst|ssm)$/ -          @fn[:b]=@fn[:m]=filename[m,1] -          @fn[:t]=filename[m,2] -        end -      end -      lng_base=SiSU_Env::InfoEnv.new.language_default_set -      lang=SiSU_Env::StandardiseLanguage.new -      langs=lang.codes -      x=[] -      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") -        n=@fn[:m].gsub(/^.+?\//,'') -        n =n + '.' + @fn[:t] -        x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } -      end -      langs.each do |l| -        lng=SiSU_Env::StandardiseLanguage.new(l) -        if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -          x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } -        elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") -          x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } -        end -        if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -          if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } -          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } -          end -        end -        if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -          if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } -          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } -          end -        end -      end -      @fn[:f]=x -      @fn -    end -    def published_manifests?(output_base) -      @fn={} -      @m=[] -      unless (@fns.nil? \ -      or @fns.empty?) -        if output_dir_structure.by_language_code? -          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ -          @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] -        else m=/(.+?)\.((?:-|ssm\.)?sst$)/ -          @fn[:b]=@fn[:m]=@fns[m,1] -          @fn[:t]=@fns[m,2] -        end -      end -      lang=SiSU_Env::StandardiseLanguage.new -      langs=lang.codes -      x=[] -      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" -      end -      dir=SiSU_Env::InfoEnv.new(@fns) -      @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language -      langs.each do |l| -        lng=SiSU_Env::StandardiseLanguage.new(l) -        fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" -        fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" -        if FileTest.file?(fns_c) -          fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_c) #reconsider file_to_language -          lng=fn_set_lang[:n] -          fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) -          @m << { m: fn[:manifest], l: lng } -        elsif FileTest.file?(fns_l) -          fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_l) #reconsider file_to_language -          @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) -          fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) -          @m << { m: fn[:manifest], l: lng } -        end -      end -      @m=@m.uniq -    end -    def filename(code,name,suffix) -      "#{name}#{suffix}" -    end -    def lang(code) -      { -        html:            filename(code,'','.html'), -        book_index:      filename(code,'book_index','.html'), -        concordance:     filename(code,'concordance','.html'), -        sax:             filename(code,'sax','.xml'), -        dom:             filename(code,'dom','.xml'), -        docbook:         filename(code,'docbook','.xml'), -        xhtml:           filename(code,'scroll','.xhtml'), -        pdf_l:           filename(code,'','.pdf'), -        pdf_p:           filename(code,'','.pdf'), -        pdf_l_a4:        filename(code,"a4",'.pdf'), -        pdf_p_a4:        filename(code,"a4",'.pdf'), -        pdf_l_a5:        filename(code,"a5",'.pdf'), -        pdf_p_a5:        filename(code,"a5",'.pdf'), -        pdf_l_b5:        filename(code,"b5",'.pdf'), -        pdf_p_b5:        filename(code,"b5",'.pdf'), -        pdf_l_letter:    filename(code,"letter",'.pdf'), -        pdf_p_letter:    filename(code,"letter",'.pdf'), -        pdf_l_legal:     filename(code,"legal",'.pdf'), -        pdf_p_legal:     filename(code,"legal",'.pdf'), -        toc:             filename(code,'toc','.html'), -        doc:             filename(code,fnb,'.html'), -        index:           filename(code,'index','.html'), -        po:              filename(code,@fns,'.po'), -        pot:             filename(code,@fns,'.pot'), -        odf:             filename(code,'','.odt'), -        epub:            filename(code,'','.epub'), -        plain:           filename(code,'','.txt'), -        qrcode:          filename(code,'','.jpg'), -        manpage:         filename(code,'','.1'),          #fix, section number -        wiki:            filename(code,'wiki','.txt'), -        digest:          filename(code,'digest','.txt'), -        metadata:        filename(code,'metadata','.html'), #chk -        manifest:        filename(code,'manifest','.html'), -        oai_pmh:         filename(code,'oai_pmh','.xml'), -        sitemap:         filename(code,'sitemap','.xml'), -        sitemap_touch:   filename(code,"sitemap_#{fnb}",'.xml'), -        sxs:             filename(code,fnb,'.sxs.xml'), -        sxd:             filename(code,fnb,'.sxd.xml'), -        sxn:             filename(code,fnb,'.sxn.xml'), -        sisupod:         filename(nil,@fnz,''), -        book_idx_html:   filename(code,'book_index','.html'), -        book_idx_epub:   filename(code,'book_index','.xhtml'), -        epub_concord:    filename(code,'concordance','.xhtml'), -      } -    end +  class EnvCall < SiSU_Env_Call::EnvCall                   # se_envcall.rb    end -  class SystemCall -    @@locale_flag=false -    def initialize(input='',output='',opt_or_cmd='') -      @input,@output=input,output -      (opt_or_cmd.is_a?(SiSU_Commandline::Options)) \ -      ? (@cmd,@opt=opt_or_cmd.cmd,opt_or_cmd) -      : (@cmd,@opt=opt_or_cmd,nil) #cmd.is_a?(String) -      @prog=SiSU_Env::InfoProgram.new -      @sys=InfoSystem.instance -    end -    def program_found?(program) -      found=`which #{program}` #`whereis #{program}` -      (found =~/bin\/#{program}\b/) ? true : false -    end -    def locale                                                                 #locales utf8 or other -      unless @@locale_flag -        @@locale_flag=true -      end -      @sys.locale -    end -    def file_encoding(filename,cmd='')                                         #file encoding -      program='file' -      fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path -      if program_found?(program) -        encoding=%x{file -L #{fnsp}}.strip -        encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'') -        encoding=if encoding \ -        and not encoding.empty? -          encoding -        else 'UTF-8 assumed, encoding undetermined' -        end -        puts encoding if cmd =~/[VM]/ -        encoding -      else encoding='UTF-8 assumed, file encoding check program unavailable' -      end -    end -    def wc                                                                     #word count -      program='wc' -      if program_found?(program) \ -      and locale !~/utf-?8/i -        true -      else -        program_ref="(not available)" unless program_found?(program) -        program_ref="(UTF-8)" if locale =~/utf-?8/i -        false -      end -    end -    def rcs                                                                    #rcs for document markup data -      program='rcs' -      program_ref="\n\t\tdocument version information requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def cvs                                                                    #cvs for document markup data -      program='cvs' -      program_ref="\n\t\tdocument version information requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def zip                                                                    #zip -      program='zip' -      program_ref="\n\t\tused to in the making of number of file formats, odf, epub" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("*WARN* #{program} is not installed #{program_ref}") -        false -      end -    end -    def openssl                                                                #openssl for digests -      program='openssl' -      program_ref="\n\t\tused to generate requested source document identification digest" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def md5(filename)                                                          #md5 dgst -      program='openssl' -      program_ref="\n\t\tmd5 digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def sha256(filename)                                                       #sha dgst -      program='openssl' -      program_ref="\n\t\tsha digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def sha512(filename)                                                       #sha dgst -      program='openssl' -      program_ref="\n\t\tsha digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -sha512 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def psql                                                                   #psql -      program='psql' -      program_ref="\n\t\tpsql requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def create_pg_db(dbname_stub=nil)                                          #createdb -      unless dbname_stub -        @pwd ||=Dir.pwd -        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -        dbname_stub=@pwd[m,1] -      end -      program='createdb' -      db_name="#{Db[:name_prefix]}#{dbname_stub}" -      program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" -      (program_found?(program)) \ -      ? system("#{program} #{dbname_name}") -      : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") -    end -    def relaxng(cmd='')                                                        #trang - convert between different schema languages for XML -      program='trang' -      program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" -      (program_found?(program)) \ -      ? system("#{program} #{@input} #{@output}") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) -    end -    def qrencode                                                               #qrcode - for generating QR code -      program='qrencode' -      program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" -      found=(program_found?(program)) ? true : false -      found \ -      ? (system(%{ -          echo "#{@input}" | #{program} -s 3 -o #{@output} -        })) -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) -      #found -    end -    def imagemagick                                                            #imagemagick is a image manipulation program -      program='identify' -      #program_ref="\n\t\tsee <http://www.imagemagick.org/>" -      found=(program_found?(program)) ? true : false -      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found -      found -    end -    def graphicksmagick                                                        #graphicsmagick is a image manipulation program -      program='gm' -      #program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" -      found=(program_found?(program)) ? true : false -      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found -      found -    end -    def well_formed?                                                           #tidy - check for well formed xml xhtml etc. -      program=@prog.tidy -      program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" -      (program_found?(program)) \ -      ? system("#{@prog.tidy} -xml #{@input} > #{@output}") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") -    end -    def tex2pdf_engine -      progs=['xetex','xelatex','pdflatex','pdfetex','pdftex'] -      @pdfetex_flag=false -      @cmd ||='' -      @texpdf=nil -      progs.each do |program| -        if program_found?(program) -          @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/ -          @pdfetex_flag=true -          break -        end -      end -      if @pdfetex_flag==false -        @texpdf=progs.join(', ') -      end -      @texpdf -    end -    def latex2pdf(md,papersize='a4')                                           #convert from latex to pdf -      tell=if @cmd =~/[MV]/ -        '' -      elsif @cmd =~/[v]/ -        %q{2>&1 | grep -v ' WARNING '} -      else %q{2>&1 | grep -v '$'} -      end -      mode='batchmode' #mode='nonstopmode' -      texpdf=tex2pdf_engine -      if @pdfetex_flag -        texpdf_cmd=case texpdf -        when /xetex/ -          %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} -        when /xelatex/ -          %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} -        when /pdftex/ -          "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" -        when /pdflatex/ -          "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" -        end -        system(texpdf_cmd) -      else STDERR.puts "\t*WARN* none of the following programs are installed: #{@texpdf}" -      end -    end -    def makeinfo                                                               #texinfo -      program='makeinfo' -      options='' #'--force' #'' -      program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" -      (program_found?(program)) \ -      ? system("#{program} #{options} #{@input}\n") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") -    end -    def scp -      puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/ -      puts "scp disabled" -    end -    def rsync(action='',chdir=nil) -      program='rsync' -      if program_found?(program) -        vb=if @cmd =~/q/; 'q' -        elsif @cmd =~/v/; 'v' -        else              '' -        end -        cX=SiSU_Screen::Ansi.new(@cmd).cX -        msg=(@cmd =~/q/) ? '' : %{ && echo " #{cX.grey}OK: #{@input} -> #{@output}#{cX.off}"} -        amp=(@opt \ -        && @opt.files.length > 1) \ -        ? '' -        : ((@cmd =~/[vVM]/) ? '' : '&') -        rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" -        puts rsync_cmd if @cmd =~/[vVM]/ -        dir_change,dir_return='','' -        if not chdir.nil? \ -        && chdir != Dir.pwd -          dir_change=Dir.chdir(chdir) -          dir_return=Dir.pwd -        end -        dir_change #check -        system(" -          #{rsync_cmd} #{msg} #{amp} -        ") -        dir_return -      else STDERR.puts "\t*WARN* #{program} not found" -      end -    end -    def rm -      if @cmd =~/^-Z[mMvVq]*$/;      FileUtils::rm_rf(@input) -      elsif @cmd =~/V/;              FileUtils::rm(@input) -      elsif @cmd !~/q/;              FileUtils::rm(@input) -      elsif @cmd =~/q/;              FileUtils::rm(@input) -      else                           STDERR.puts "\t*WARN* operation ignored" -      end -    end +  class SystemCall < SiSU_Sys_Call::SystemCall             # se_programs.rb    end -  class StandardiseLanguage -    require_relative 'i18n'                  # i18n.rb -    def initialize(l='') -      @language=(l.nil? || l.empty?) \ -      ? SiSU_Env::InfoEnv.new.language_default_set -      : l -      @r=%{(?:#{Px[:lng_lst_rgx]})} -      @lang_info=SiSU_i18n::Languages.new -    end -    def lang_lst                              # from i18n -      @@lang_info ||=@lang_info.language.list -    end -    def lang(l='')                              # from i18n -      if l =~/^#{@r}$/ -        @lang_info.language.list[l] -      elsif @language =~/^#{@r}$/ -        @lang_info.language.list[@language] -      else nil -      end -    end -    def language -      lng={} -      case @language -      when /^am$|Amharic/i                    then d,c,l=false,lang_lst['am'][:c],    lang_lst['am'][:n] -      when /^bg$|Bulgarian/i                  then d,c,l=false,lang_lst['bg'][:c],    lang_lst['bg'][:n] -      when /^bn$|Bengali/i                    then d,c,l=false,lang_lst['bn'][:c],    lang_lst['bn'][:n] -      when /^br$|Breton/i                     then d,c,l=false,lang_lst['br'][:c],    lang_lst['br'][:n] -      when /^ca$|Catalan/i                    then d,c,l=false,lang_lst['ca'][:c],    lang_lst['ca'][:n] -      when /^cs$|Czech/i                      then d,c,l=false,lang_lst['cs'][:c],    lang_lst['cs'][:n] -      when /^cy$|Welsh/i                      then d,c,l=false,lang_lst['cy'][:c],    lang_lst['cy'][:n] -      when /^da$|Danish|Dansk/i               then d,c,l=false,lang_lst['da'][:c],    lang_lst['da'][:n] -      when /^de$|German/i                     then d,c,l=false,lang_lst['de'][:c],    lang_lst['de'][:n] -      when /^el$|Greek/i                      then d,c,l=false,lang_lst['el'][:c],    lang_lst['el'][:n] -      when /^en$|English/i                    then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] -      when /^eo$|Esperanto/i                  then d,c,l=false,lang_lst['eo'][:c],    lang_lst['eo'][:n] -      when /^es$|Spanish|Espanol/i            then d,c,l=false,lang_lst['es'][:c],    lang_lst['es'][:n] -      when /^et$|Estonian/i                   then d,c,l=false,lang_lst['et'][:c],    lang_lst['et'][:n] -      when /^eu$|Basque/i                     then d,c,l=false,lang_lst['eu'][:c],    lang_lst['eu'][:n] -      when /^fi$|Finnish|Finsk|Suomi/i        then d,c,l=false,lang_lst['fi'][:c],    lang_lst['fi'][:n] -      when /^fr$|French|Francais/i            then d,c,l=false,lang_lst['fr'][:c],    lang_lst['fr'][:n] -      when /^ga$|Irish/i                      then d,c,l=false,lang_lst['ga'][:c],    lang_lst['ga'][:n] -      when /^gl$|Galician/i                   then d,c,l=false,lang_lst['gl'][:c],    lang_lst['gl'][:n] -      when /^he$|Hebrew/i                     then d,c,l=false,lang_lst['he'][:c],    lang_lst['he'][:n] -      when /^hi$|Hindi/i                      then d,c,l=false,lang_lst['hi'][:c],    lang_lst['hi'][:n] -      when /^hr$|Croatian/i                   then d,c,l=false,lang_lst['hr'][:c],    lang_lst['hr'][:n] -      when /^hy$|Armenian/i                   then d,c,l=false,lang_lst['hy'][:c],    lang_lst['hy'][:n] -      when /^ia$|Interlingua/i                then d,c,l=false,lang_lst['ia'][:c],    lang_lst['ia'][:n] -      when /^is$|Icelandic/i                  then d,c,l=false,lang_lst['is'][:c],    lang_lst['is'][:n] -      when /^it$|Italian/i                    then d,c,l=false,lang_lst['it'][:c],    lang_lst['it'][:n] -      when /^la$|Latin/i                      then d,c,l=false,lang_lst['la'][:c],    lang_lst['la'][:n] -      when /^lo$|Lao/i                        then d,c,l=false,lang_lst['lo'][:c],    lang_lst['lo'][:n] -      when /^lt$|Lithuanian/i                 then d,c,l=false,lang_lst['lt'][:c],    lang_lst['lt'][:n] -      when /^lv$|Latvian/i                    then d,c,l=false,lang_lst['lv'][:c],    lang_lst['lv'][:n] -      when /^ml$|Malayalam/i                  then d,c,l=false,lang_lst['ml'][:c],    lang_lst['ml'][:n] -      when /^mr$|Marathi/i                    then d,c,l=false,lang_lst['mr'][:c],    lang_lst['mr'][:n] -      when /^nl$|Dutch/i                      then d,c,l=false,lang_lst['nl'][:c],    lang_lst['nl'][:n] -      when /^no$|Norwegian|Norsk/i            then d,c,l=false,lang_lst['no'][:c],    lang_lst['no'][:n] -      when /^nn$|Norwegian Nynorsk/i          then d,c,l=false,lang_lst['nn'][:c],    lang_lst['nn'][:n] -      when /^oc$|Occitan/i                    then d,c,l=false,lang_lst['oc'][:c],    lang_lst['oc'][:n] -      when /^pl$|Polish/i                     then d,c,l=false,lang_lst['pl'][:c],    lang_lst['pl'][:n] -      when /^pt$|Portuguese/i                 then d,c,l=false,lang_lst['pt'][:c],    lang_lst['pt'][:n] -      when /^pt_BR$|Portuguese Brazil/i       then d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] -      when /^ro$|Romanian/i                   then d,c,l=false,lang_lst['ro'][:c],    lang_lst['ro'][:n] -      when /^ru$|Russian/i                    then d,c,l=false,lang_lst['ru'][:c],    lang_lst['ru'][:n] -      when /^sa$|Sanskrit/i                   then d,c,l=false,lang_lst['sa'][:c],    lang_lst['sa'][:n] -      when /^se$|Sami/i                       then d,c,l=false,lang_lst['se'][:c],    lang_lst['se'][:n] -      when /^sk$|Slovak/i                     then d,c,l=false,lang_lst['sk'][:c],    lang_lst['sk'][:n] -      when /^sl$|Slovenian/i                  then d,c,l=false,lang_lst['sl'][:c],    lang_lst['sl'][:n] -      when /^sq$|Albanian/i                   then d,c,l=false,lang_lst['sq'][:c],    lang_lst['sq'][:n] -      when /^sr$|Serbian/i                    then d,c,l=false,lang_lst['sr'][:c],    lang_lst['sr'][:n] -      when /^sv$|Swedish|Svensk/i             then d,c,l=false,lang_lst['sv'][:c],    lang_lst['sv'][:n] -      when /^ta$|Tamil/i                      then d,c,l=false,lang_lst['ta'][:c],    lang_lst['ta'][:n] -      when /^te$|Telugu/i                     then d,c,l=false,lang_lst['te'][:c],    lang_lst['te'][:n] -      when /^th$|Thai/i                       then d,c,l=false,lang_lst['th'][:c],    lang_lst['th'][:n] -      when /^tk$|Turkmen/i                    then d,c,l=false,lang_lst['tk'][:c],    lang_lst['tk'][:n] -      when /^tr$|Turkish/i                    then d,c,l=false,lang_lst['tr'][:c],    lang_lst['tr'][:n] -      when /^uk$|Ukranian/i                   then d,c,l=false,lang_lst['uk'][:c],    lang_lst['uk'][:n] -      when /^ur$|Urdu/i                       then d,c,l=false,lang_lst['ur'][:c],    lang_lst['ur'][:n] -      when /^us|American$|/i                  then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] -      when /^vi$|Vietnamese/i                 then d,c,l=false,lang_lst['vi'][:c],    lang_lst['vi'][:n] -      else                                     d,c,l=true, lang_lst['en'][:c],    lang_lst['en'][:n] #default -      end -      lng[:d],lng[:c],lng[:n]=d,c,l -      lng -    end -    def name -      language[:n].downcase -    end -    def title -      language[:n] -    end -    def code -      language[:c] -    end -    def tex_name -      language[:xlp] -    end -    def file_to_language(file) # used, fix and remove -      m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ -      @language=if file =~m ; file[m,1] -      else '' -      end -      language -    end -    def codes -      # Language List po4a -      #   <http://www.debian.org/international/l10n/po/> -      #   Px[:lng_lst] see constants.rb -      # see polyglossia for subset -      #   <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf> -      # also note ISO_639-2 -      #   <http://en.wikipedia.org/wiki/ISO_639-2> -      #   <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes> -      Px[:lng_lst] # constants.rb -    end +  class StandardiseLanguage < SiSU_Standardise_Lang::StandardiseLanguage # se_standardise_lang.rb    end -  class InfoEnv < EnvCall -    begin -      require 'pathname' -      require 'fileutils' -        include FileUtils -    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,: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) -      super() #you may not want to re-execute this static info so frequently! -      @init=SiSU_Env::GetInit.new -      @fns,@md=fns,md -      @env=SiSU_Env::EnvCall.new(fns) if fns -      fnb=if @md \ -      and defined? @md.fnb -        @md.fnb -      elsif defined? @env.fnb \ -      and @env.fnb -        @env.fnb -      elsif @fns.is_a?(String) \ -      and not @fns.empty? -        m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m -        @fns[m,1] if not @fns.empty? -      end -      if fnb; @@fb ||=fnb -      end -      @sys=InfoSystem.instance -      @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters -      @fixed_websev_root='' # @home -      @pwd=@@pwd=Dir.pwd -      @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] -        stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/ -          lng=pt.split[-1].to_s -          lng_part='/' + lng -          base=pt.split[0].split[-1].to_s -        else -          lng_part='/' + language_default_set -          base=pt.split[-1].to_s -        end -        base + lng_part -      elsif output_dir_structure.by_filetype? -        pt.split[-1].to_s -      elsif  output_dir_structure.by_filename? -        '' -      else -        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn('set output type, by: language, filetype or filename') -      end -      @stub_set_manifest=stub + '/manifest' -    end -    def user -      @sys.user -    end -    def hostname -      @sys.hostname -    end -    def host -      @sys.host -    end -    def arch -      @sys.arch -    end -    def rbver -      @sys.rbver -    end -    def locale -      @sys.locale -    end -    def concord_max -      ((defined? @rc['processing']['concord_max']) \ -      && @rc['processing']['concord_max']) \ -      ? @rc['processing']['concord_max'] -      : (defaults[:concord_max]) -    end -    def language_default_set #set directory (default) language -      ((defined? @rc['default']['language']) \ -      && @rc['default']['language'] =~/\S+/) \ -      ? @rc['default']['language'] -      : 'en' -    end -    def markup_emphasis -      if defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/bold/ -        'bold' -      elsif defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/italic/ -        'italics' -      elsif defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/underscore/ -        'underscore' -      else 'bold' -      end -    end -    def plaintext_wrap -      ((defined? @rc['default']['text_wrap']) \ -      && (@rc['default']['text_wrap']) \ -      && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ -      && (@rc['default']['text_wrap'].to_i > 19) \ -      && (@rc['default']['text_wrap'].to_i < 201)) \ -      ? @rc['default']['text_wrap'].to_i -      : 78 -    end -    def current_document -      @@current_document||=Dir.pwd -      @@current_document -    end -    def base_markup_dir_stub                                                               #200412 -      @base_markup_dir_stub -    end -    def stub_md_harvest                                                        #watch -      @stub_set_manifest -    end -    def stub_src -      @stub_src -    end -    def stub_pod -      @stub_pod -    end -    def sisupod_v4(opt) -      #processing_path.processing -      #  sisupod -      #    doc/ -      #      manifest.txt -      #      en/content.sst                [file content] -      #      fr/content.sst -      #      _sisu -      #        sisu_document_make -      #        image@ (ln -s ../../image) -      #        audio@ (ln -s ../../audio) -      #        video@ (ln -s ../../video) -      #    image/                          [all images for specific document gathered here] -      #    audio/ -      #    video/ -      spp="#{processing_path.processing}/#{Gt[:sisupod]}" -      sppc="#{spp}/doc/_sisu" -      lng_dirs=[] -      if FileTest.directory?(spp) \ -      or FileTest.file?(spp) -        FileUtils::rm_rf(spp) -      end -      paths=[] -      flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found -      flv[:f].each {|l| lng_dirs << l[:l] } -      lng_dirs.uniq.each do |lng| -        paths << "#{spp}/doc/#{lng}" -      end -      paths \ -      << "#{spp}/image" -     #<< "#{spp}/audio" \ -     #<< "#{spp}/video" \ -      paths.each do |x| -        unless FileTest.directory?(x) -          FileUtils::mkdir_p(x) -        end -      end -      if FileTest.directory?(sppc) -        pwd=Dir.pwd -        Dir.chdir(sppc) -        FileUtils::ln_s('../../image', 'image') -       #FileUtils::ln_s('../../audio', 'audio') -       #FileUtils::ln_s('../../video', 'video') -        Dir.chdir(pwd) -      end -    end -    def sisupod_v3(opt) -      #processing_path.processing -      #  sisupod -      #    doc/ -      #      manifest.txt -      #      en/content.sst                [file content] -      #      fr/content.sst -      #      _sisu -      #        skin/ -      #          doc                       [relevant skin if any other than default] -      #        image@ (ln -s ../../image) -      #        audio@ (ln -s ../../audio) -      #        video@ (ln -s ../../video) -      #    image/                          [all images for specific document gathered here] -      #    audio/ -      #    video/ -      spp="#{processing_path.processing}/#{Gt[:sisupod]}" -      sppc="#{spp}/doc/_sisu" -      lng_dirs=[] -      if FileTest.directory?(spp) \ -      or FileTest.file?(spp) -        FileUtils::rm_rf(spp) -      end -      paths=[] -      flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found -      flv[:f].each {|l| lng_dirs << l[:l] } -      lng_dirs.uniq.each do |lng| -        paths << "#{spp}/doc/#{lng}" -      end -      paths \ -      << "#{spp}/image" \ -      << "#{sppc}/skin/doc" \ -      << "#{sppc}/skin/dir" \ -      << "#{sppc}/skin/site" -     #<< "#{spp}/audio" \ -     #<< "#{spp}/video" \ -      paths.each do |x| -        unless FileTest.directory?(x) -          FileUtils::mkdir_p(x) -        end -      end -      if FileTest.directory?(sppc) -        pwd=Dir.pwd -        Dir.chdir(sppc) -        FileUtils::ln_s('../../image', 'image') -       #FileUtils::ln_s('../../audio', 'audio') -       #FileUtils::ln_s('../../video', 'video') -        Dir.chdir(pwd) -      end -    end -    def sisupod_v2 -      #processing_path.processing -      #  sisupod -      #    content.sst              [file content] -      #    filename.sst             [link to content.sst] -      #    _sisu -      #      skin/ -      #        doc                  [relevant skin if any other than default] -      #      image                  [all images for specific document gathered here] -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      paths=[] -      paths=[ -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image" -      ] -      paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) } -    end -    def defaults #multiple default directories -      @default_dir ||=@sys.default_dir #DEFAULT_DIR -    end -    def html_seg_title_banner? -      ((defined? @rc['html']['seg_title_banner']) \ -      && @rc['html']['seg_title_banner']==true) \ -      ? @rc['html']['seg_title_banner'] -      : false -    end -    def html_quick_ref? -      ((defined? @rc['html']['quick_ref']) \ -      && @rc['html']['quick_ref']==true) \ -      ? @rc['html']['quick_ref'] -      : false -    end -    def html_minitoc? -      if defined? @rc['html']['minitoc'] \ -      and @rc['html']['minitoc'].is_a?(String) -        @rc['html']['minitoc'] -      else false -      end -    end -    def manifest_minitoc? -      if defined? @rc['manifest']['minitoc'] \ -      and @rc['manifest']['minitoc'].is_a?(String) -        @rc['manifest']['minitoc'] -      else false -      end -    end -    def build -      def omit_list -        @off_list ||=if defined? @rc['omit_list'] \ -        and @rc['omit_list'].is_a?(String) -          @rc['omit_list'] -        elsif defined? @rc['omit']['list'] \ -        and @rc['omit']['list'].is_a?(String) -          @rc['omit']['list'] -        else -          nil -        end -      end -      def listed?(test) #fix -        listed=if omit_list -          x=(omit_list.scan(/\b#{test}\b/)).join -          test==x \ -          ? true -          : false -        else -          false -        end -        listed -      end -      def ocn? -        if (defined? @rc['omit']['ocn'] \ -        and not @rc['omit']['ocn'].nil?) \ -        or listed?('ocn') -          :off -        else -          :na -        end -      end -      def toc? -        if (defined? @rc['omit']['toc'] \ -        and not @rc['omit']['toc'].nil?) \ -        or listed?('toc') -          :off -        else -          :na -        end -      end -      def manifest? -        if (defined? @rc['omit']['manifest'] \ -        and not @rc['omit']['manifest'].nil?) \ -        or listed?('manifest') -          :off -        else -          :na -        end -      end -      def links_to_manifest? -        if (defined? @rc['omit']['links_to_manifest'] \ -        and not @rc['omit']['links_to_manifest'].nil?) \ -        or (listed?('links_to_manifest') \ -        ||  listed?('manifest_links')) -          :off -        else -          :na -        end -      end -      def metadata? -        if (defined? @rc['omit']['metadata'] \ -        and not @rc['omit']['metadata'].nil?) \ -        or listed?('metadata') -          :off -        else -          :na -        end -      end -      def minitoc? -        if (defined? @rc['omit']['minitoc'] \ -        and not @rc['omit']['minitoc'].nil?) \ -        or (listed?('minitoc')) -          :off -        else -          :na -        end -      end -      def manifest_minitoc? -        if (defined? @rc['omit']['manifest_minitoc'] \ -        and not @rc['omit']['manifest_minitoc'].nil?) \ -        or listed?('manifest_minitoc') -          :off -        else -          :na -        end -      end -      def html_minitoc? -        if (defined? @rc['omit']['html_minitoc'] \ -        and not @rc['omit']['html_minitoc'].nil?) \ -        or (listed?('html_minitoc') \ -        || listed?('minitoc')) -          :off -        else -          :na -        end -      end -      def html_navigation? -        if (defined? @rc['omit']['html_navigation'] \ -        and not @rc['omit']['html_navigation'].nil?) \ -        or listed?('html_navigation') -          :off -        else -          :na -        end -      end -      def html_navigation_bar? -        if (defined? @rc['omit']['html_navigation_bar'] \ -        and not @rc['omit']['html_navigation_bar'].nil?) \ -        or listed?('html_navigation_bar') -          :off -        else -          :na -        end -      end -      def segsubtoc? -        if (defined? @rc['omit']['segsubtoc'] \ -        and not @rc['omit']['segsubtoc'].nil?) \ -        or listed?('segsubtoc') -          :off -        else -          :na -        end -      end -      def html_right_pane? -        if (defined? @rc['omit']['html_right_pane'] \ -        and not @rc['omit']['html_right_pane'].nil?) \ -        or listed?('html_right_pane') -          :off -        else -          :na -        end -      end -      def html_top_band? -        if (defined? @rc['omit']['html_top_band'] \ -        and not @rc['omit']['html_top_band'].nil?) \ -        or listed?('html_top_band') -          :off -        else -          :na -        end -      end -      def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line -        if (defined? @rc['omit']['search_form'] \ -        and not @rc['omit']['search_form'].nil?) \ -        or listed?('search_form') -          :off -        else -          :na -        end -      end -      def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line -        if (defined? @rc['omit']['html_search_form'] \ -        and not @rc['omit']['html_search_form'].nil?) \ -        or listed?('html_search_form') -          :off -        else -          :na -        end -      end -      self -    end -    def odt_ocn? -      ((defined? @rc['odt']['ocn']) \ -      && @rc['odt']['ocn']==false) \ -      ? @rc['odt']['ocn'] -      : true -    end -    def xml_docbook_ocn? -      ((defined? @rc['xml_docbook']['ocn']) \ -      && @rc['xml_docbook']['ocn']==false) \ -      ? @rc['xml_docbook']['ocn'] -      : true -    end -    def xml_fictionbook_ocn? -      ((defined? @rc['xml_fictionbook']['ocn']) \ -      && @rc['xml_fictionbook']['ocn']==false) \ -      ? @rc['xml_fictionbook']['ocn'] -      : true -    end -    def xml_scaffold_ocn? -      ((defined? @rc['xml_scaffold']['ocn']) \ -      && @rc['xml_scaffold']['ocn']==false) \ -      ? @rc['xml_scaffold']['ocn'] -      : true -    end -    def plaintext_ocn? -      ((defined? @rc['plaintext']['ocn']) \ -      && @rc['plaintext']['ocn']==false) \ -      ? @rc['plaintext']['ocn'] -      : true -    end -    def textile_ocn? -      ((defined? @rc['textile']['ocn']) \ -      && @rc['textile']['ocn']==true) \ -      ? @rc['textile']['ocn'] -      : false -    end -    def asciidoc_ocn? -      ((defined? @rc['asciidoc']['ocn']) \ -      && @rc['asciidoc']['ocn']==true) \ -      ? @rc['asciidoc']['ocn'] -      : false -    end -    def markdown_ocn? -      ((defined? @rc['markdown']['ocn']) \ -      && @rc['markdown']['ocn']==true) \ -      ? @rc['markdown']['ocn'] -      : false -    end -    def rst_ocn? -      ((defined? @rc['rst']['ocn']) \ -      && @rc['rst']['ocn']==true) \ -      ? @rc['rst']['ocn'] -      : false -    end -    def widget #needs (md) #move -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -      @ad=SiSU_Env::GetInit.new.ads -      @vz=SiSU_Viz::Defaults.new -      @flag={ ad: false, md: false, sk: false, rc: false } -      def promo? -        @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] -          @flag[:md]=true -          true -        elsif defined? @vz.widget_promo \ -        and not @vz.widget_promo.nil? \ -        and @vz.widget_promo.is_a?(Array) \ -        and @vz.widget_promo.length > 0 -          @flag[:sk]=true -          true -        elsif defined? @rc['html']['promo'] \ -        and not @rc['html']['promo'].nil? \ -        and @rc['html']['promo'].length > 0 -          @flag[:rc]=true -          true -        else false -        end -        @flag -      end -      def search? -        searches=['sisu'] -        flag=false -        if defined? @rc['search'] -          searches.each do |type| -            flag=if defined? @rc['search'][type] \ -            and defined? @rc['search'][type]['action'] \ -            and @rc['search'][type]['flag']==true \ -            and @rc['search'][type]['action'] =~/https?:\/\// -              flag=if promo?[:ad] -                false -              elsif defined? @vz.widget_search \ -              and @vz.widget_search==true -                true -              elsif defined? @rc['search'][type]['flag'] \ -              and @rc['search'][type]['flag']==true -                true -              else false -              end -            else false -            end -          end -        else false -        end -        flag -      end -      def search_fixed? -        searches=['sisu','hyperestraier'] -        flag=if defined? @rc['search'] -          searches.each do |type| -            if defined? @rc['search'][type] \ -            and defined? @rc['search'][type]['action'] \ -            and @rc['search'][type]['action'] =~/https?:\/\// \ -            and defined? @rc['search'][type]['db'] \ -            and @rc['search'][type]['db'] =~/\S+/ -              flag=if promo?[:ad] -                false -              elsif defined? @vz.widget_search \ -              and @vz.widget_search==true -                true -              elsif defined? @rc['search'][type]['flag'] \ -              and @rc['search'][type]['flag']==true -                true -              else false -              end -            else false -            end -          end -        else false -        end -      end -      def search_form(type='sisusearch',action=nil,db=nil,table=false) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form_sisu=if action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget.search? -          db=if rc['search']['sisu']['flag']==true \ -          and rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        elsif defined? rc['search']['sisu']['flag'] \ -        and defined? rc['search']['sisu']['action'] \ -        and rc['search']['sisu']['flag']==true \ -        and rc['search']['sisu']['action'] =~/https?:\/\// -          true -        else false -        end -        if table -          table_open='<td align="center" bgcolor="#ffffff">' -          table_close='</td>' -        else -          table_open='' -          table_close='<br />' -        end -        form=if create_form_sisu \ -        and type=~/sisusearch/ \ -        and defined? rc['search']['sisu'] \ -        and defined? rc['search']['sisu']['action'] -          <<WOK -<!-- SiSU Search --> -#{table_open} -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="ltd" value="1000" /> -<input type="hidden" name="off" value="0" /> -<input type="hidden" name="doc" value="#{@md.fnb}" /><br /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font></form> -#{table_close} -<!-- SiSU Search --> -WOK -        else '' -        end -        form -      end -      def search_form_static(action=nil,db=nil) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form=if rc['search']['sisu']['flag']==true \ -        and action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget.search_fixed? -          db=if rc['search']['sisu']['flag']==true \ -          and rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        else false -        end -        if create_form -          %{<td align="center" bgcolor="#ffffff"> -<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="ltd" value="1000" /> -<input type="hidden" name="off" value="0" /> -<input type="hidden" name="doc" value="#{@md.fnb}" /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> -</td> } -        else '' -        end -      end -      def search_action #check -        if search? -        else '' -        end -      end -      self -    end -    def widget_static -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -      @vz=SiSU_Viz::Defaults.new -      @flag={ ad: false, md: false, sk: false, rc: false } -      def search? -        flag=if defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\// \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ -          flag=if defined? @vz.widget_search \ -          and @vz.widget_search==true -            true -          elsif defined? @rc['search']['sisu']['flag'] \ -          and @rc['search']['sisu']['flag']==true -            true -          else -            false -          end -        else -          false -        end -      end -      def search_fixed? -        flag=if defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\// \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ -          flag=if defined? @vz.widget_search \ -          and @vz.widget_search==true -            true -          elsif defined? @rc['search']['sisu']['flag'] \ -          and @rc['search']['sisu']['flag']==true -            true -          else -            false -          end -        else -          false -        end -      end -      def search_form(action=nil,db=nil) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form=if defined? rc['search']['sisu']['flag'] \ -        and rc['search']['sisu']['flag']==true \ -        and action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget_static.search? \ -        and rc['search']['sisu']['flag']==true -          db=if rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        else false -        end -        if create_form \ -        and @fnb \ -        and @fnb=~/\S+/ -          %{<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="doc" value="#{@fnb}" /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> } -        elsif create_form -          %{<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> } -        else '' -        end -      end -      def search_action #check -        if search? -        else '' -        end -      end -      self -    end -    def source_file_path -      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') -      unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" -      else "#{processing_path.composite_file}" -      end -    end -    def source_file_with_path -      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') -      "#{source_file_path}/#{file}" -    end -    def texpdf_hyperlinks(cli) -      @cli=cli -      @hyplnks=if cli != :na -        cli -      elsif (defined? @rc['default']['pdf_hyperlinks']) \ -      && (@rc['default']['pdf_hyperlinks']=~/color/) -        :color -      elsif (defined? @rc['default']['pdf_hyperlinks']) \ -      && (@rc['default']['pdf_hyperlinks']=~/(?:no-color|color-off|mono(?:chrome)?)/) -        :mono -      else :na -      end -      def landscape -        if @cli != :na -          @cli -        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ -        && (@rc['default']['pdf_hyperlinks_landscape']=~/color/) -          :color -        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ -        && (@rc['default']['pdf_hyperlinks_landscape']=~/(?:no-color|color-off|mono(?:chrome)?)/) -          :mono -        elsif @hyplnks != :na -          @hyplnks -        else :na -        end -      end -      def portrait -        if @cli != :na -          @cli -        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ -        && (@rc['default']['pdf_hyperlinks_portrait']=~/color/) -          :color -        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ -        && (@rc['default']['pdf_hyperlinks_portrait']=~/(?:no-color|color-off|mono(?:chrome)?)/) -          :mono -        elsif @hyplnks != :na -          @hyprlnks -        else :na -        end -      end -      self -    end -    def font -      def size(pt=nil) -        if pt && pt != :na -          pt -        elsif defined? @rc['default']['fontsize'] \ -        && @rc['default']['fontsize']=~/\d{1,2}/ -          @rc['default']['fontsize'] -        else :na -        end -      end -      def texpdf -        # you may wish to check selected font against available fonts: -        # fc-list :outline -f "%{family}\n" -        # fc-list :lang=ja -        def main -          (defined? @rc['default']['texpdf_fontface']) \ -          && (@rc['default']['texpdf_fontface']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface'] -          : 'Liberation Sans' -        end -        def sans                                                               # not used -          (defined? @rc['default']['texpdf_fontface_sans']) \ -          && (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_sans'] -          : 'Liberation Sans' -        end -        def serif                                                              # not used -          (defined? @rc['default']['texpdf_fontface_serif']) \ -          && (@rc['default']['texpdf_font_serif']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_serif'] -          : 'Liberation Serif' -        end -        def mono -          (defined? @rc['default']['texpdf_fontface_mono']) \ -          && (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_mono'] -          : 'Liberation Mono' -        end -        def cjk -          (defined? @rc['default']['texpdf_fontface_cjk']) \ -          && (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk'] -          : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' -        end -        def cjk_zh -          (defined? @rc['default']['texpdf_fontface_cjk_zh']) \ -          && (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_zh'] -          : 'IPAGothic' -        end -        def cjk_ja -          (defined? @rc['default']['texpdf_fontface_cjk_ja']) \ -          && (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_ja'] -          : 'IPAGothic' -        end -        def cjk_ko -          (defined? @rc['default']['texpdf_fontface_cjk_ko']) \ -          && (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_ko'] -          : 'IPAGothic' -        end -        def size(pt=nil) -          if pt && pt != :na -            pt -          elsif (defined? @rc['default']['texpdf_fontsize']) \ -          && (@rc['default']['texpdf_fontsize']=~/\d{1,2}/) -            @rc['default']['texpdf_fontsize'] -          elsif (defined? @rc['default']['fontsize']) \ -          && (@rc['default']['fontsize']=~/\d{1,2}/) -            @rc['default']['fontsize'] -          else -            :na -          end -        end -        self -      end -      self -    end -    def path_rel_links -      def html_scroll_2 -        if @env.output_dir_structure.by_language_code? -          '../../' -        elsif @env.output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_seg_2 -        if @env.output_dir_structure.by_language_code? -          '../../../' -        elsif @env.output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def html_scroll_1 -        if @env.output_dir_structure.by_language_code? -          '../' -        elsif @env.output_dir_structure.by_filetype? -          '../' -        else -          './' -        end -      end -      def html_seg_1 -        if @env.output_dir_structure.by_language_code? -          '../../' -        elsif @env.output_dir_structure.by_filetype? -          '../../' -        else -          './' -        end -      end -      self -    end -    def read_source_file_array(fns) -      (fns !~/\.ssm.sst$/) \ -      ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) -      : (IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) -    end -    def read_source_file(fns) -      read_source_file_array(fns) -    end -    def read_source_file_string(fns) -      (fns !~/\.ssm.sst$/) \ -      ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) -      : (IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) -    end -    def source_file_processing_array(fns) -      read_source_file_string(fns).split(/\s*\n\s*\n/m) -    end -    def path                                                                     #dir -      def home -        @sys.home -      end -      def sisurc_path -        GetInit.new.sisu_yaml.rc_path -      end -      def pwd -        @sys.pwd -      end -      def base_markup_dir_stub -        @base_markup_dir_stub -      end -      def stub_epub -        @stub_epub -      end -      def stub_src -        @stub_src -      end -      def stub_pod -        @stub_pod -      end -      def etc -        defaults[:sisu_etc]                                                      #live/dynamic -      end -      def arch -        @sys.dir_arch -      end -      def sitearch -        @sys.dir_sitearch -      end -      def bin -        @sys.dir_bin -      end -      def share                                                                #shared data repository source directory -        defaults[:sisu_share] #; p __LINE__.to_s + ':' + __FILE__ + ' ' + defaults[:sisu_share] -      end -      def style -        if @md \ -        && ((@md.opt.opt_act[:dump][:bool] \ -        &&   @md.opt.opt_act[:dump][:inst]) \ -        ||  (@md.opt.opt_act[:redirect][:bool] \ -        &&   @md.opt.opt_act[:redirect][:inst])) -          'css' -        else -         defaults[:stylesheet_stub] -        end -      end -      def sample_data                                                          #sample data repository source directory -        defaults[:sample_data_path] -      end -      def rc -        @init.rc_path -      end -      def yamlrc -        GetInit.new.sisu_yaml.rc_path -      end -      def man #check use -        (defined? @rc['webserv']['man']) \ -        ? "#{webserv}/#{@rc['webserv']['man']}" -        : defaults[:webserv_man] -      end -      def webserv_path #testing, check need, remove -        webserv -      end -      def webserv                                                              #separation required for webrick which cannot use path.output (different requirements as no file is passed) -        man_path=if @@man_path.nil? -          man_path=if defined? @rc['webserv']['path'] \ -          and @rc['webserv']['path'] =~/\S\S+/ -            pwd=Dir.pwd -            Dir.chdir(SiSU_Utils::Path.new.base_markup) -            man_path=@@man_path=File.expand_path(@rc['webserv']['path']) -            Dir.chdir(pwd) -            man_path -          else defaults[:webserv_path] -          end -        else @@man_path -        end -        man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1') -        unless FileTest.directory?(man_path) -          FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.") -        end -        @webserv_path=if defined? man_path \ -        and File.writable?("#{man_path}/.") -          man_path #web server path as configured in rc file -        elsif FileTest.directory?(defaults[:webserv_path]) \ -        and File.writable?("#{defaults[:webserv_path]}/.") #web server path default -          defaults[:webserv_path] -        else #create default directory under home and place output there -          unless FileTest.directory?(defaults[:output_local]) -            FileUtils::mkdir_p(defaults[:output_local]) -          end -          defaults[:output_local] -        end -      end -      def webserv_stub_ensure -        FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) -        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}/#{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] -      end -      def webserv_image                                                        #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) -        images=if defined? @rc['webserv']['images'] -          @rc['webserv']['images'] -        else defaults[:images] -        end -        "#{path.webserv}/#{images}" -      end -      def output                                                               #web/webserv output directory... subdirectory into which further subdirectories are made based on file names -        r=Px[:lng_lst_rgx] -        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -        base_stub=@sys.pwd.gsub(u,'\1') -        if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/ -          "#{path.webserv}/#{Gt[:doc]}" -        else -          "#{path.webserv}/#{base_stub}" -        end -      end -      def feed -        (defined? @rc['webserv']['feed']) \ -        ? ("#{public_output}/#{@rc['webserv']['feed']}") -        : (defaults[:webserv_feed]) -      end -      def feed_home -        "#{public_output}/#{@rc['webserv']['feed_home']}" -      end -      def scripts                                                                #used previously only to include tla version info -        if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}" -        end -      end -      def cgi -        (defined? @rc['webserv']['cgi']) \ -        ? "#{@rc['webserv']['cgi']}" -        : (defaults[:webserv_cgi]) -      end -      def php -        (defined? @rc['webserv']['php']) \ -        ? "#{public_output}/#{@rc['webserv']['php']}" -        : (defaults[:webserv_php]) -      end -                                                                                 # programs -      def output_tell -        url.webserv_map_pwd -      end -      def image_source                                                           #image repository source directory -        if defined? @rc['image']['path'] \ -        and defined? @rc['image']['public'] -          pth="#{@rc['image']['path']}" -          "#{pth}/#{@rc['image']['public']}" -        else -          "#{share}/image" -        end -      end -      def image_source_sisu_includes -        "#{share}/image" -      end -      def image_source_include                                                       #image repository source directory -        if defined? @rc['image']['path'] \ -        and defined? @rc['image']['public'] \ -        and FileTest.directory?("#{@rc['image']['path']}/#{@rc['image']['public']}")==true -          "#{@rc['image']['path']}/#{@rc['image']['public']}" -        elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true -          "#{@@pwd}/#{defaults[:image_stub]}" -        elsif FileTest.directory?("#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}")==true -          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" -        else -          "#{share}/image" -        end -      end -      def image_external -        "#{processing}/external_document/image" -      end -      def image_source_include_local -        if FileTest.directory?(defaults[:image_local]); defaults[:image_local] -        end -      end -      def image_source_include_remote -        if FileTest.directory?(image_external); image_external -        end -      end -      self -    end -    def processing_path -      def encoding -        pth="#{processing}/#{defaults[:processing_encoding]}" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def processing_base_tmp -        defaults[:processing_path_tmp_base] -      end -      def tmp_root_dir -        defaults[:processing_dir_tmp_root] -      end -      def root_dir -        proposed_path_base=if defined? @rc['processing']['path'] \ -        and not @rc['processing']['path'].nil? \ -        and not @rc['processing']['path'].empty? -          x=if @rc['processing']['path'] =~/^(?:~|home)$/ -            home #fix -          else @rc['processing']['path'] -          end -        else nil -        end -        proposed_dir=if defined? @rc['processing']['dir'] \ -        and not @rc['processing']['dir'].nil? \ -        and not @rc['processing']['dir'].empty? -          @rc['processing']['dir'] -        else defaults[:processing_dir] -        end -        v=SiSU_Env::InfoVersion.instance.get_version -        v_dev=(DEVELOPER[:maintenance]==:true) \ -        ? "_#{v[:version]}" -        : '' -        path=if proposed_path_base \ -        and FileTest.directory?(proposed_path_base) \ -        and File.writable?("#{proposed_path_base}/.") -          x=proposed_dir \ -          ? "#{proposed_path_base}/#{proposed_dir}" -          : "#{proposed_path_base}/#{defaults[:processing_dir]}" -        else defaults[:processing_dir_tmp_root] -        end -        path = path + v_dev -      end -      def usr_dir? -        case root_dir -        when /^\/home/ then false -        else                true -        end -      end -      def stub_dir -        (usr_dir?) \ -        ? ("#{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}/#{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 -        def paths -          processing_path_usr="#{root_dir}/#{user}" -          processing_path_fnb=processing_path_usr + '/' + Gt[:pods] + '/' + @opt.fng -          processing_path_sisupod=processing_path_fnb + '/' + Gt[:sisupod] -          { fnb: processing_path_fnb, sisupod: processing_path_sisupod } -        end -        def make -          unless FileTest.directory?(root_dir) -            FileUtils::mkdir_p(root_dir) -            File.chmod(0777,root_dir) -          end -          if usr_dir? -            processing_path_usr="#{root_dir}/#{user}" -            FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) -            File.chmod(0700,processing_path_usr) -          end -          sisupod_processing_path=paths[:sisupod] -          FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path) -          sisupod_processing_path_lng=if defined? @opt.lng -            sisupod_processing_path + '/' + Gt[:doc] + '/' + @opt.lng -          else -            sisupod_processing_path + '/' + Gt[:doc] -          end -          unless FileTest.directory?(sisupod_processing_path_lng) -            #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" -            FileUtils::mkdir_p(sisupod_processing_path_lng) -            File.chmod(0700,sisupod_processing_path_lng) -          end -          sisupod_processing_path -        end -        self -      end -      def processing                                                             #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) -        unless FileTest.directory?(root_dir) -          FileUtils::mkdir_p(root_dir) -          File.chmod(0777,root_dir) -        end -        if usr_dir? -          processing_path_usr="#{root_dir}/#{user}" -          FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) -          File.chmod(0700,processing_path_usr) -        end -        FileUtils::mkdir_p(stub_dir) unless FileTest.directory?(stub_dir) -        File.chmod(0700,stub_dir) -        path_processing=[stub_dir,defaults[:processing_path],defaults[:processing_path_home]] -        processing=nil -        path_processing.each do |v|                                              # -          processing=v -          unless FileTest.directory?(processing) -            FileUtils::mkdir_p(processing) -            File.chmod(0700,processing) -          end -          break -        end -        processing -      end -      def ao -        pth=if defined? @rc['processing']['dal'] \ -          and @rc['processing']['dal'].is_a?(String) -          "#{processing}/#{@rc['processing']['dal']}" -        else "#{processing}/#{defaults[:processing_ao]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def tune -        pth=if defined? @rc['processing']['tune'] \ -          and @rc['processing']['tune'].is_a?(String) -          "#{processing}/#{@rc['processing']['tune']}" -        else "#{processing}/#{defaults[:processing_tune]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def composite_file -        pth=processing_path.ao  #"#{processing}/composite" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def git -        pth=if defined? @rc['git']['dir'] \ -        and @rc['git']['dir'].is_a?(String) -          (@rc['git']['dir'] =~/^(?:~|home)$/) \ -          ? home + '/' + Gt[:git] -          : @rc['git']['dir'] + '/' + Gt[:git] -        else defaults[:processing_git] -        end -        unless FileTest.directory?(pth) -          FileUtils::mkdir_p(pth) -          File.chmod(0700,pth) -        end -        pth -      end -      def odf_pth -        pth="#{processing}/odf/#{@fns}" -        pth -      end -      def odf -        odt -      end -      def odt -        pth=odf_pth + '/odt' -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def odf -        pth="#{processing}/odf" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def odt_bld -        FileUtils::rm_rf(processing_path.odt) -        FileUtils::mkdir_p(processing_path.odt) unless FileTest.directory?(processing_path.odt) -        FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") unless FileTest.directory?("#{processing_path.odt}/Configurations2") -        FileUtils::mkdir_p("#{processing_path.odt}/META-INF") unless FileTest.directory?("#{processing_path.odt}/META-INF") -        FileUtils::mkdir_p("#{processing_path.odt}/Pictures") unless FileTest.directory?("#{processing_path.odt}/Pictures") -        FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") unless FileTest.directory?("#{processing_path.odt}/Thumbnails") -        processing_path.odt -      end -      def epub -        "#{processing}/epub/#{@fnb}" -      end -      def epub_bld #(md) -        FileUtils::rm_rf(processing_path.epub) if FileTest.directory?(processing_path.epub) -        FileUtils::mkdir_p(processing_path.epub) unless FileTest.directory?(processing_path.epub) -        FileUtils::mkdir_p("#{processing_path.epub}/META-INF") unless FileTest.directory?("#{processing_path.epub}/META-INF") -        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image") -        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css") -        processing_path.epub -      end -      def epub_cp_images(md) -        pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        src="#{path.share}/image" -        images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] -        images.each do |i| #move to avoid repeated tests -          if FileTest.file?("#{src}/#{i}") -            FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} -          end -        end -        pth -      end -      def tex -        pth=if defined? @rc['processing']['latex'] \ -        and @rc['processing']['latex'].is_a?(String) -          "#{processing}/#{@rc['processing']['latex']}" -        else "#{processing}/#{defaults[:processing_latex]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def texi -        pth=if defined? @rc['processing']['texinfo'] \ -        and @rc['processing']['texinfo'].is_a?(String) -          "#{processing}/#{@rc['processing']['texinfo']}" -        else "#{processing}/#{defaults[:processing_texinfo]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def texinfo                                                                #texinfo webserv, check -        "#{processing}/#{defaults[:processing_texinfo]}" -      end -      def manpage -        "#{path.output}/man" -      end -      def lout -        pth=if defined? @rc['processing']['lout'] \ -        and @rc['processing']['lout'].is_a?(String) -          "#{processing}/#{@rc['processing']['lout']}" -        else "#{processing}/#{defaults[:processing_lout]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def sql -        pth="#{processing}/sql" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def sqlite -        pth=if defined? @rc['processing']['sqlite'] \ -        and @rc['processing']['sqlite'].is_a?(String) -          "#{processing}/#{@rc['processing']['sqlite']}" -        else "#{processing}/#{defaults[:processing_sqlite]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def postgresql -        pth=if defined? @rc['processing']['postgresql'] \ -        and @rc['processing']['postgresql'].is_a?(String) -          "#{processing}/#{@rc['processing']['postgresql']}" -        else "#{processing}/#{defaults[:processing_postgresql]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      self -    end -    def url -      def hostname -        "http://#{@sys.hostname}" -      end -      def dir_url -        "file://#{path.webserv}/#{base_markup_dir_stub}" -      end -      def localhost -        "http://localhost/#{base_markup_dir_stub}" -      end -      def local -        "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']}/#{@base_markup_dir_stub}" -        elsif defined? @rc['webserv']['url_root'] \ -        and @rc['webserv']['url_root'] =~/localhost/ -          "http://localhost/#{@base_markup_dir_stub}" -        else "file://#{path.output}" -        end -      end -      def remote -        root -      end -      def txt -        "#{root}/txt" -      end -      def html -        "#{root}/html" -      end -      def epub -        "#{root}/epub" -      end -      def odt -        "#{root}/odt" -      end -      def pdf -        "#{root}/pdf" -      end -      def src_txt -        "#{root}/src" -      end -      def src_pod -        "#{root}/pod" -      end -      def pot -        "#{root}/po4a/pot" -      end -      def po -        "#{root}/po4a/po" -      end -      def webserv_host_base(opt=nil) -        if defined? @rc['webserv']['host'] -          case  @rc['webserv']['host'] -          when /https?:\/\// then @rc['webserv']['host'] -          when /\S+/         then "http://#{@rc['webserv']['host']}" -          else                    defaults[:webserv_host_cgi] -          end -        else                      defaults[:webserv_host_cgi] -        end -      end -      def webserv_cgi(opt=nil)                                                          #web url for local webserv (localhost, or hostname) -        http=if defined? @rc['webserv_cgi']['host'] \ -        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}/#{@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)}/#{@base_markup_dir_stub}" -          else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" -          end -        end -        http=http.strip -      end -      def webserv_base_cgi(opt=nil)                                                     #web url for local webserv (localhost, or hostname) -        http=if opt.mod.inspect =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ -          m=$1 -          (m=~/http\/\/:/) ? m : %{http://#{m}} -        elsif defined? @rc['webserv_cgi']['host'] \ -        and @rc['webserv_cgi']['host'].is_a?(String) -          http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') -          if port.webserv_port_cgi(opt) -            "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi(opt)}" -          else "#{http}#{@rc['webserv_cgi']['host']}" -          end -        else -          http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') -          if port.webserv_port_cgi(opt) -            "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}" -          else "#{http}#{webserv_host_base}" -          end -        end -        http=http.strip -        #%q{http://#{ENV['HTTP_HOST']}} -      end -      def webrick #must have a port #REMOVE -        if defined? @rc['webserv_cgi']['host'] \ -        and @rc['webserv_cgi']['host'].is_a?(String) -          http=if @rc['webserv_cgi']['host'] =~/http:\/\// -            'http://' -          elsif @rc['webserv_cgi']['host'] =~/https:\/\// -            'https://' -          else defaults -          end -          "#{http}#{@rc['webserv_cgi']['host']}" -        elsif webserv_host_base \ -        and webserv_host_base.is_a?(String) -          "#{http}#{webserv_host_base}" -        else "#{http}localhost" end -      end -      def webserv                                                              #web url for local webserv (localhost, or hostname) -        if defined? @rc['webserv']['url_root'] \ -        and @rc['webserv']['url_root'] =~/http/ -          # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere -          @rc['webserv']['url_root'] -        elsif path.webserv_dir \ -        and path.webserv =~ /#{path.webserv_dir}/ #revisit -          "#{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}" -        elsif port.webserv_port_cgi =~/\S+/ -          "#{url.hostname}:#{port.webserv_port_cgi}" -        else -          url.hostname -        end -      end -      def webserv_base                                                         #web url for local webserv (localhost, or hostname) -        if path.webserv_dir \ -        and path.webserv =~ /#{path.webserv_dir}/ #revisit -          "#{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}" -        else "#{url.webrick_base}" -        end -      end -      def webserv_files_from_db(opt=nil) #sort this out, messy -        if opt.mod.inspect =~/--webserv-output[=-]["']?(\S+)["']+/ -          m=$1 -          (m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}} -        else -          show_output_on=if defined? @rc['webserv_cgi']['show_output_on'] -            @rc['webserv_cgi']['show_output_on'] -          elsif  defined? @rc['webserv_cgi']['file_links'] -            @rc['webserv_cgi']['file_links'] -          else '' -          end -          m=case show_output_on -          when /webserv_cgi/ then url.webserv_base_cgi(opt) -          when /webserv/     then @rc['webserv']['url_root'] -          when /https?:\/\// then @rc['webserv_cgi']['file_links'] -          when /\S+/         then "http://#{@rc['webserv_cgi']['file_links']}" -          else                     webserv_base_cgi(opt) -          end -        end -        #%q{http://#{ENV['HTTP_HOST']}/cgi-bin} -      end -      def cgi_sample_search_form_name(opt=nil) -        if opt.mod.inspect =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ -          $1 -        elsif not opt.mod.inspect =~/--db[=-]["']?sqlite/ \ -        and defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ -          /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] -        else -          (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ -          ? "#{Db[:name_prefix_db]}sqlite.cgi" \ -          :  "#{Db[:name_prefix_db]}pg.cgi" -        end -      end -      def sample_search_form_title(organised_by=:language) -        title=if defined? @rc['search']['sisu']['title'] \ -        and @rc['search']['sisu']['title'] =~/\S+/ -          @rc['search']['sisu']['title'] -        else %{SiSU (generated sample) search form} -        end -        title=title + " (content organised by #{organised_by})" -      end -      def output_tell                                      #BROKEN Revisit 2011-02 -        output_type=if defined? @rc['show_output_on'] \ -        and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ -          @rc['show_output_on'] -        else 'filesystem' -        end -        case output_type -        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 + '/' + 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 -        else                                   url.webserv_map_pwd -        end -      end -      def images -        "#{Xx[:html_relative2]}/_sisu/image" -      end -      #def images -      #  '../_sisu/image' -      #end -      def images_local -        if FileTest.directory?(path.image_source_include) -          path.image_source_include -        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/ -            @@local_image=false -          end -          url.images -        end -      end -      def images_external -        if FileTest.directory?(image_external) -          if @@image_flag -            images=Dir.glob("#{image_external}/*.{png,jpg,gif}") -            pth="#{path.webserv}/#{@base_markup_dir_stub}" -            FileUtils::mkdir_p("#{pth}/_sisu/image_external") \ -              unless FileTest.directory?("#{pth}/_sisu/image_external") -            images.each { |i| File.install(i,"#{pth}/#{i}") } \ -              unless images.length > 0 -            @@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/ -            @@local_image=false -          end -          url.images_external -        end -      end -      def images_epub -        './image' -      end -      self -    end -    def port -      def webrick_port -        if @md \ -        and @md.opt.cmd.inspect=~/-F/ \ -        and @md.opt.mod.inspect=~/port=(\d+)/ -           $1 -        else -          if defined? @rc['webserv_cgi']['port'] -            if @rc['webserv_cgi']['port'].nil? \ -            and (defined? @md.opt.mod \ -            and not @md.opt.mod.nil? \ -            and @md.opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            elsif not @rc['webserv_cgi']['port'].nil? -              @rc['webserv_cgi']['port'] -            else defaults[:webserv_port_cgi] -            end -          else   defaults[:webserv_port_cgi] -          end -        end -      end -      def webserv_port_cgi(opt=nil) -        port=if opt \ -        and opt.cmd.inspect=~/-F/ \ -        and opt.mod.inspect=~/port=(\d+)/ -           $1 -        else -          port=if defined? @rc['webserv_cgi']['port'] -            if @rc['webserv_cgi']['port'].nil? \ -            and (defined? opt.mod \ -            and not opt.mod.nil? \ -            and opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            elsif not @rc['webserv_cgi']['port'].nil? -              @rc['webserv_cgi']['port'] -            else nil -            end -          else -            if (defined? opt.mod \ -            and not opt.mod.nil? \ -            and opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            else nil -            end -          end -        end -      end -      self -    end -    def digest_conf? -      if defined? @rc['default']['digest'] \ -      and @rc['default']['digest'] != nil -        case @rc['default']['digest'] -        when /^sha(?:5|512)?$/ then :sha512 -        when /^sha(?:2|256)?$/ then :sha256 -        when /^md5$/           then :md5 -        else                        :sha256 -        end -      else                          :sha256 -      end -    end -    def digest(opt=nil) -      @opt=opt -      def type -        if @opt -          case @opt.act[:hash_digest_algo] -          when :sha512 then :sha512 -          when :sha256 then :sha256 -          when :md5    then :md5 -          else digest_conf? -          end -        else digest_conf? -        end -      end -      def length -        case digest(@opt).type -        when :sha512 then 128 -        when :sha256 then  64 -        when :md5    then  32 -        else               64 -        end -      end -      def pattern -        "[0-9a-f]{#{digest(@opt).length}}" #/[0-9a-f]{#{digest.length}}/ -      end -      self -    end -    def program -      def text_editor -        if defined? @rc['program_select']['editor'] \ -        and @rc['program_select']['editor'] =~/\S\S+/ -          @rc['program_select']['editor'] -        elsif defined? @rc['program_select']['text_editor'] \ -        and @rc['program_select']['text_editor'] =~/\S\S+/ -          @rc['program_select']['text_editor'] -        else 'editor'                                                            #'gvim -c :R -c :S' -        end -      end -      def pdf_viewer -        ((defined? @rc['program_select']['pdf_viewer']) \ -        && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['pdf_viewer'] -        : 'pdf-viewer'                                                        #'evince' -      end -      def web_browser -        if defined? @rc['program_select']['www_browser'] \ -        and @rc['program_select']['www_browser'] =~/\S\S+/ -          @rc['program_select']['www_browser'] -        elsif defined? @rc['program_select']['web_browser'] \ -        and @rc['program_select']['web_browser'] =~/\S\S+/ -          @rc['program_select']['web_browser'] -        else 'x-www-browser'                                                      #'firefox' 'iceweasel' 'kazehakase' 'galeon' -        end -      end -      def www_browser -        web_browser -      end -      def console_web_browser -        if defined? @rc['program_select']['console_www_browser'] \ -        and @rc['program_select']['console_www_browser'] =~/\S\S+/ -          @rc['program_select']['console_www_browser'] -        elsif defined? @rc['program_select']['console_web_browser'] \ -        and @rc['program_select']['console_web_browser'] =~/\S\S+/ -          @rc['program_select']['console_web_browser'] -        else 'console-www-browser'                                             #'lynx' 'links' 'links2' 'elinks' 'w3m' -        end -      end -      def console_www_browser -        web_browser -      end -      def epub_viewer -        ((defined? @rc['program_select']['epub_viewer']) \ -        && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['epub_viewer'] -        : 'ebook-viewer'                                                    #'calibre' 'fbreader' -      end -      def xml_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def docbook_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def fictionbook_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def xml_editor -        xml_viewer -      end -      def odf_viewer -        ((defined? @rc['program_select']['odf_viewer']) \ -        && @rc['program_select']['odf_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['odf_viewer'] -        : 'lowriter'                                                           #'odf-viewer','oowriter' -      end -      def manpage_viewer -        'man' -      end -      def manpage_generator -        ((defined? @rc['program_select']['man']) \ -        && @rc['program_select']['man'] =~/\S\S+/) \ -        ? @rc['program_select']['man'] -        : 'nroff -man'                                                        #'nroff -man' #'groff -man -Tascii' -      end -      def texinfo -        ((defined? @rc['program_select']['info_viewer']) \ -        && @rc['program_select']['info_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['info_viewer'] -        : 'pinfo -f'                                                          #'pinfo -f' 'info' 'tkinfo' -      end -      def file_encoding -        is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : '' -        (is.nil? || is==true) ? 'encoding' : is -      end -      def wc #wordcount -        is=(defined? @rc['program_set']['wc']) ? @rc['program_set']['wc'] : '' -        (is.nil? || is==true) ? 'wc' : is -      end -      def tidy -        is=(defined? @rc['program_set']['tidy']) ? @rc['program_set']['tidy'] : nil -        (is.nil? || is==true) ? 'tidy' : is -      end -      def rmagick -        is=(defined? @rc['program_set']['rmagick']) ? @rc['program_set']['rmagick'] : nil -        (is.nil? || is==true) ? 'rmagick' : is -      end -      def rexml                                                                  #should be part of ruby 1.8 but apparently not always -        is=(defined? @rc['program_set']['rexml']) ? @rc['program_set']['rexml'] : '' -        (is.nil? || is==true) ? 'rexml' : is -      end -      def pdflatex -        is=(defined? @rc['program_set']['pdflatex']) ? @rc['program_set']['pdflatex'] : '' -        (is.nil? || is==true) ? 'pdflatex' : is -      end -      def postgresql -        is=(defined? @rc['program_set']['postgresql']) ? @rc['program_set']['postgresql'] : '' -        (is.nil? || is==true) ? 'postgresql' : is -      end -      def sqlite -        is=(defined? @rc['program_set']['sqlite']) ? @rc['program_set']['sqlite'] : '' -        (is.nil? || is==true) ? 'sqlite' : is -      end -      self -    end -    def i18n -      def language                                                             # language settings -        m=/.+\/\S+?\~(\S+)/ -        pwd=Dir.pwd -        conf=(defined? @rc['default']['language']) ? @rc['default']['language'] : nil -        l=if pwd=~ m;                             pwd[m,1]                    #2 directory: by visible directory name -        elsif conf; @rc['default']['language']                                  #3 config: from sisurc.yaml -        else                                      defaults[:language]          #4 sisu: program default -        end                                                                     #1 document: param gets -        SiSU_Env::StandardiseLanguage.new(l) -      end -      #def multilingual -      #  x=(defined? @rc['output_structure']['multilingual'] \ -      #  && @rc['output_structure']['multilingual'] ==true) \ -      #  ? true : false -      #end -      #def bundle -      #  x=(defined? @rc['output_structure']['bundle'] \ -      #  && @rc['output_structure']['bundle'] ==true) \ -      #  ? true : false -      #end -      def lang_filename(l) -        @lang={} -        x=if output_dir_structure.by_language_code? -          (( defined? @rc['default']['language_file']) \ -          && @rc['default']['language_file'] != nil) \ -          ? @rc['default']['language_file'] -          : 1 -        else 0 -        end -        if (l != defaults[:language_code]) \ -        or (language.code != defaults[:language_code]) #watch -          if x==1;    @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' -          elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' -          elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" -          else        @lang[:pre],@lang[:mid],@lang[:post]='','','' -          end -        else          @lang[:pre],@lang[:mid],@lang[:post]='','','' -        end -        @lang -      end -      self -    end -    def file_encoding -      is='' -      if defined? @rc['program_set']['file_encoding'];  is=@rc['program_set']['encoding'] -      end -      if is.nil? \ -      or is==true -        is='encoding' -      end -      is -    end -    def papersize                                                              # paper settings, default overidden in param if set within document -      (defined? @rc['default']['papersize']) \ -      ? @rc['default']['papersize'].downcase -      : (defaults[:papersize].downcase) -    end -    def odf_structure -      FileUtils::rm_rf(processing_path.processing_path.odf_pth) -      FileUtils::mkdir_p(processing_path.processing_path.odf_pth) -      system("unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d      #{processing_path.odf_pth}") -    end -    def sisupod_gen(fns_pod) -      sisupod_gen_v3(fns_pod) -    end -    def sisupod_gen_v3(fns_pod) -      pwd=Dir.pwd -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      unless FileTest.directory?(sisupod_processing_path) -        FileUtils::mkdir_p(sisupod_processing_path) -      end -      f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}") -        "#{Dir.pwd}/#{fns_pod}" -      elsif FileTest.file?(fns_pod) -        fns_pod -      end -      if f_pod \ -      && FileTest.file?(f_pod) -        (SiSU_Env::SystemCall.new.program_found?('tree')) \ -        ? "tree #{processing_path.processing}/#{Gt[:sisupod]}" -        : '' -        if FileTest.directory?(processing_path.processing) -          Dir.chdir(processing_path.processing) -          system(%{tar xJf #{f_pod}}) -          Dir.chdir(pwd) -        end -        #system(tree)                                                          #enable if (/[vVM]/) -      else -        SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/ -      end -      sisupod_processing_path -    end -    def sisupod_gen_v2(fns_pod) -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      unless FileTest.directory?(sisupod_processing_path) -        FileUtils::mkdir_p(sisupod_processing_path) -      end -      (FileTest.file?(fns_pod)) \ -      ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") -      : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/) -      sisupod_processing_path -    end +  class InfoEnv < SiSU_Info_Env::InfoEnv                   # se_info_env.rb    end -  class InfoProcessingFlag -    attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 -    def initialize -      @rc=GetInit.new.sisu_yaml.rc -    end -    def color                                                                  #processing flag shortcuts -      (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false -    end -    def cf_0                                                                   #processing flag shortcuts -      if defined? @rc['flag']['default'] \ -      and @rc['flag']['default'].is_a?(String) -        @rc['flag']['default'] -      else                               '-NQhewpotbxXdyYv' -      end -    end -    def cf_1                                                                   #processing flag shortcuts -      if defined? @rc['flag']['i'] \ -      and @rc['flag']['i'].is_a?(String) -        @rc['flag']['i'] -      else                               '-Qhewpoty' -      end -    end -    def cf_2                                                                   #processing flag shortcuts -      if defined? @rc['flag']['ii'] \ -      and @rc['flag']['ii'].is_a?(String) -        @rc['flag']['ii'] -      else                               '-NQhewpotbxXdy' -      end -    end -    def cf_3                                                                   #processing flag shortcuts -      if defined? @rc['flag']['iii'] \ -      and @rc['flag']['iii'].is_a?(String) -        @rc['flag']['iii'] -      else                               '-NQhewpotbxXdyY' -      end -    end -    def cf_4                                                                   #processing flag shortcuts -      if defined? @rc['flag']['iv'] \ -      and @rc['flag']['iv'].is_a?(String) -        @rc['flag']['iv'] -      else                               '-NQhewpotbxXdDyY --update' -      end -    end -    def cf_5                                                                   #processing flag shortcuts -      if defined? @rc['flag']['v'] \ -      and @rc['flag']['v'].is_a?(String) -        @rc['flag']['v'] -      else                               '-NQhewpotbxXdDyYv --update' -      end -    end +  class InfoProcessingFlag < SiSU_Info_Processing_Flag::InfoProcessingFlag # se_processing.rb    end -  class InfoSettings < InfoEnv -    def permission?(prog)                                                      #program defaults -      (defined? @rc['permission_set'][prog]) \ -      ? @rc['permission_set'][prog] -      : false -    end -    def program?(prog)                                                         #program defaults -      (defined? @rc['program_set'][prog]) \ -      ? @rc['program_set'][prog] -      : false -    end +  class InfoSettings < SiSU_Info_Set::InfoSettings         # se_programs.rb    end -  class FileMap < InfoEnv -    attr_accessor :local_sisu_source -    def initialize(opt='') #watch / REVIEW -      super() -      @opt=opt #,opt.fns,opt.cmd -      @env=(@opt.fns && !(@opt.fns.empty?) \ -      ? (SiSU_Env::InfoEnv.new(@opt.fns)) -      : (SiSU_Env::InfoEnv.new('dummy.sst'))) -      ft=[] -      if @opt.act[:ao][:set]==:on -        @md=SiSU_Param::Parameters.new(@opt).get -        if @md \ -        and defined? @md.fn \ -        and @md.fn        # used for by_language_code? -          if @md.opt.act[:html][:set]==:on                 #% --html, -h -H -            ft << @md.fn[:html] -          end -          if @md.opt.act[:concordance][:set]==:on          #% --concordance, -w -            ft << @md.fn[:concordance] -          end -          if @md.opt.act[:manifest][:set]==:on             #% --manifest, -y -            ft << @md.fn[:manifest] -          end -          if @md.opt.act[:txt][:set]==:on                  #% --txt, -t -a -            ft << @md.fn[:plain] -          end -          if @md.opt.act[:txt_textile][:set]==:on          #% --textile -            ft << @md.fn[:txt_textile] -          end -          if @md.opt.act[:txt_asciidoc][:set]==:on         #% --asciidoc -            ft << @md.fn[:txt_asciidoc] -          end -          if @md.opt.act[:txt_markdown][:set]==:on         #% --markdown -            ft << @md.fn[:txt_markdown] -          end -          if @md.opt.act[:txt_rst][:set]==:on              #% --rst, --rest -            ft << @md.fn[:txt_rst] -          end -          if @md.opt.act[:xhtml][:set]==:on                #% --xhtml, -b xhtml -            ft << @md.fn[:xhtml] -          end -          if @md.opt.act[:epub][:set]==:on                 #% --epub, -e -            ft << @md.fn[:epub] -          end -          if @md.opt.act[:manpage][:set]==:on              #% --manpage, -i -            ft << @md.fn[:manpage] -          end -          if @md.opt.act[:hash_digests][:set]==:on         #% --hash-digests, -N digest tree -            ft << @md.fn[:digest] -          end -          if @md.opt.act[:odt][:set]==:on                  #% --odt, -o opendocument -            ft << @md.fn[:odf] -          end -          if @md.opt.act[:pdf][:set]==:on                  #% --pdf-l --pdf, -p latex/ texpdf -            ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] -          end -          if @md.opt.act[:share_source][:set]==:on -            ft << @md.fns -          end -          if @md.opt.act[:sisupod][:set]==:on              #% --sisupod, -S make sisupod -            ft << @md.fn[:sisupod] -          end -          if @md.opt.act[:xml_sax][:set]==:on              #% --xml-sax, -x xml sax type -            ft << @md.fn[:sax] -          end -          if @md.opt.act[:xml_dom][:set]==:on              #% --xml-dom, -X xml dom type -            ft << @md.fn[:dom] -          end -          if @md.opt.act[:xml_docbook_book][:set]==:on     #% --xml-docbook-book -            ft << @md.fn[:xml_docbook_book] -          end -          if @md.opt.act[:xml_fictionbook][:set]==:on      #% --xml-fictionbook -            ft << @md.fn[:xml_fictionbook] -          end -          if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu -            ft << @md.fn[:xml_scaffold_structure_sisu] -          end -          if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse -            ft << @md.fn[:xml_scaffold_structure_collapse] -          end -          @fnb=@md.fnb -        else                                                                     # still needed where/when param is not parsed -          if @opt.act[:html][:set]==:on                    #% --html, -h -H -            ft << '.html' << '.html.??' -          end -          if @opt.act[:concordance][:set]==:on             #% --concordance, -w -            ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' -          end -          if @opt.act[:manifest][:set]==:on                #% --manifest, -y -            ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' -          end -          if @opt.act[:txt][:set]==:on                     #% --txt, -t -a -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_textile][:set]==:on             #% --textile -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_asciidoc][:set]==:on            #% --asciidoc -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_markdown][:set]==:on            #% --markdown -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_rst][:set]==:on                 #% --rst, --rest -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:xhtml][:set]==:on                   #% --xhtml, -b xhtml -            ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' -          end -          if @opt.act[:epub][:set]==:on                    #% --epub, -e -            ft  << @fnb << '.epub' -          end -          if @opt.act[:manpage][:set]==:on                 #% --manpage, -i -            ft << '.1' << '??.man.1' << 'man.??.1' -          end -          if @opt.act[:hash_digests][:set]==:on            #% --hash-digests, -N digest tree -            ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' -          end -          if @opt.act[:odt][:set]==:on                     #% --odt, -o opendocument -            ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' -          end -          if @opt.act[:pdf][:set]==:on                     #% --pdf-l --pdf, -p latex/ texpdf -            ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' -          end -          if @opt.act[:share_source][:set]==:on -            ft << '.sst' << '.ssi' << '.ssm' -          end -          if @opt.act[:sisupod][:set]==:on                 #% --sisupod, -S make sisupod -            ft << '.zip' -          end -          if @opt.act[:xml_sax][:set]==:on                 #% --xml-sax, -x xml sax type -            ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' -          end -          if @opt.act[:xml_dom][:set]==:on                 #% --xml-dom, -X xml dom type -            ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' -          end -          if @opt.act[:xml_docbook_book][:set]==:on        #% --xml-docbook-book -            ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml' -          end -          if @opt.act[:xml_fictionbook][:set]==:on         #% --xml-fictionbook -            ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml' -          end -          if @opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu -            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' -          end -          if @opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse -            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' -          end -        end -        ft=ft.uniq -        filetypes=ft.join(',') -        @filetypes=if filetypes !~/..+/;             ''   # -r called alone, copy all -        elsif @opt.cmd =~/u/;                        ''   # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u -        elsif filetypes =~/\S+?,\S+/;                '*{' + filetypes + '}' # more than one relevant file type -        else                                         '*' + filetypes # one relevant file type -        end -        @source_path=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/#{@fnb}" -        : @env.path.output) -        @source_path_epub=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/epub" -        : @env.path.output_epub) -        @source_path_src=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/src" -        : @env.path.output_src) -        @source_path_pod=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/pod" -        : @env.path.output_pod) -        @source_path_harvest=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/manifest" -        : @env.path.output_harvest) -        @local_sisu_source=(@filetypes =~/\S/) \ -        ? "#{@source_path}/#{@filetypes}" -        : @source_path -      end -      if @opt.act[:rsync][:set]==:on -      end -    end +  class FileMap < SiSU_File_Map::FileMap                   # se_filemap.rb    end -  class CleanOutput -    begin -      require 'fileutils' -        include FileUtils::Verbose -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') -    end -    def initialize(opt) -      @opt=opt -      z=SiSU_Env::FileMap.new(opt) -      zap=z.local_sisu_source -      if opt.cmd =~ /h/i -        zap=Dir.glob(zap).join(' ') -        @zap=if opt.cmd !~ /w/ -          zap.gsub(/#{@source_path}\/concordance.html/,'') -        else zap -        end -      end -      @env=SiSU_Env::InfoEnv.new -    end -    def zap -      def deletion(fn) -        if FileTest.file?(fn)==true -          File.delete(fn) -          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn) -          tell.warn unless @opt.cmd =~/q/ -        end -      end -      def remove_output -        if @opt.act[:maintenance][:set] == :on -          m=InfoFile.new(@opt.fnc) -          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.ao) -          tell.warn unless @opt.cmd =~/q/ -          deletion(m.marshal.ao_content) -          deletion(m.marshal.ao_idx_sst_rel_html_seg) -          deletion(m.ao_idx_sst_rel) -          deletion(m.ao_idx_html) -          deletion(m.ao_idx_xhtml) -          deletion(m.ao_metadata) -          deletion(m.ao_map_nametags) -          deletion(m.ao_map_ocn_htmlseg) -          deletion(m.html_tune) -        end -        md=SiSU_Param::Parameters.new(@opt).get -        f=SiSU_Env::FileOp.new(md) -        deletion(f.place_file.html_segtoc.dir) -        deletion(f.place_file.html_scroll.dir) -        deletion(f.place_file.html_book_index.dir) -        deletion(f.place_file.html_concordance.dir) -        deletion(f.place_file.epub.dir) -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") -        deletion(f.place_file.odt.dir) -        deletion(f.place_file.xhtml.dir) -        deletion(f.place_file.xml_sax.dir) -        deletion(f.place_file.xml_dom.dir) -        deletion(f.place_file.xml_scaffold_structure_sisu.dir) -        deletion(f.place_file.xml_scaffold_structure_collapse.dir) -        deletion(f.place_file.info.dir) -        deletion(f.place_file.manpage.dir) -        deletion(f.place_file.sqlite_discrete.dir) -        deletion(f.place_file.txt.dir) -        deletion(f.place_file.hash_digest.dir) -        deletion(f.place_file.manifest.dir) -        deletion(f.place_file.qrcode_md.dir) -        deletion(f.place_file.qrcode_title.dir) -        deletion(f.place_file.src.dir) -        deletion(f.place_file.sisupod.dir) -      end -      self -    end +  class CleanOutput < SiSU_Clean_Output::CleanOutput       # se_cleanoutput.rb    end -  class InfoRemoteHost -    def initialize -      @rc=GetInit.new.sisu_yaml.rc -    end -    def remote_host #see InfoRemote remote_host_base_general -      r=[] -      r=if (defined? @rc['remote'] \ -      and @rc['remote'].is_a?(Array)) -        r_array=@rc['remote'] -        r_array.each_with_index do |renv,i| -          r[i]={} -          if defined? renv['user'] \ -          and defined? renv['host'] -          end -          r[i][:user]=renv['user'] -          r[i][:host]=renv['host'] -          r[i][:path]=if defined? renv['path'] -            renv['path'] -          else '' -          end -          r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" -        end -        r -      elsif (defined? @rc['remote'] \ -      and @rc['remote'].is_a?(Hash) \ -      and defined? @rc['remote']['user'] \ -      and defined? @rc['remote']['host']) -        r[0]={} -        r[0][:user]=@rc['remote']['user'] -        r[0][:host]=@rc['remote']['host'] -        r[0][:path]=if defined? @rc['remote']['path'] -          @rc['remote']['path'] -        else '' -        end -        r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}" -        r -      else -        r[0]={} -        r[0][:name]='.' -        r[0][:user]='' -        r[0][:host]='' -        r[0][:path]='' -        #puts "no remote host or user" -        r -      end -    end -    def rhost -      def r1 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) -        : nil -      end -      def r2 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) -        : nil -      end -      def r3 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) -        : nil -      end -      def r4 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) -        : nil -      end -      def r5 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) -        : nil -      end -      def r6 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \ -        ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) -         : nil -      end -      self -    end +  class InfoRemoteHost < SiSU_Info_Remote_Host::InfoRemoteHost # se_remotes.rb    end -  class InfoRemote < FileMap -    @@flag_remote=false -    begin -      require 'socket' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('socket NOT FOUND (LoadError)') -    end -    def initialize(opt) -      super(opt) # -      @opt=opt -      @rc=GetInit.new.sisu_yaml.rc -    end -    def remote_host_base_general -      SiSU_Env::InfoRemoteHost.new.remote_host -    end -    def remote_host_base -      remote_host_base_general.each do |remote_conn| -        @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ -      end -      remote_host_base_general -    end -    def scp                                                                    #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built -      def document -        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.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 -          local_pod=@source_path_pod -          remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." -          remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." -          remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." -          src_txt=@opt.fnc -          src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') -          if (local_gen =~/\S/ \ -          and local_gen !~/\/\//) \ -          and (remote_gen =~/\S/ \ -          and remote_gen !~/\/\//) \ -          and @@flag_remote==true \ -          and @opt.cmd !~/U/ -            SiSU_Env::SystemCall.new(local_gen,remote_gen).scp -            if FileTest.file?("#{local_src}/#{src_txt}") -              SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp -            end -            if FileTest.file?("#{local_pod}/#{src_pod}") -              SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp -            end -            if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") -              SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp -            end -          elsif  @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "#{local_gen} -> #{remote_gen}" -            if FileTest.file?("#{local_src}/#{src_doc}") -              puts "#{local_src}/#{src_doc}* -> #{remote_src}" -            end -            if FileTest.file?("#{local_pod}/#{src_doc}.txz") -              puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" -            end -          else -            puts 'suspect scp request, ignored' -            puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" -            puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base                                                               #base site -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            puts "begin scp_base: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "begin scp_base: #{local} -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base_all                                                           #base site -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            puts "begin scp_base_all: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp -            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "scp_base_all: #{local} -> #{remote}" -            puts "#{local}/_sisu/image_sys/ -> #{remote}" -            puts "#{local}/_sisu/image/ -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      self -    end -    def rsync -      def document -        f=(@opt.act[:ao][:set]==:on) \ -        ? SiSU_Env::FileOp.new(@md) -        : nil -        if f -          self.remote_host_base.each do |remote_conn| -            local_gen=@source_path -            #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/ \ -            and local_gen !~/\/\//) \ -            and (remote_gen =~/\S/ \ -            and remote_gen !~/\/\//) \ -            and @@flag_remote==true \ -            and @opt.cmd !~/U/ -#             SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync -              #delete_extra_files='--delete' # '--delete-after' -              inp=[] -              if (@opt.act[:html][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.html_scroll.dir) -                inp << f.output_path.html_seg.rel << f.place_file.html_scroll.rel -              end -              if (@opt.act[:concordance][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.html_concordance.dir) -                inp << f.place_file.html_concordance.rel -              end -              if (@opt.act[:epub][:set]==:on \ -              || @opt.cmd =~/^-R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.epub.dir) -                inp << f.place_file.epub.rel -              end -              if (@opt.act[:odt][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.odt.dir) -                inp << f.place_file.odt.rel -              end -              if (@opt.act[:xhtml][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xhtml.dir) -                inp << f.place_file.xhtml.rel -              end -              if (@opt.act[:xml_sax][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_sax.dir) -                inp << f.place_file.xml_sax.rel -              end -              if (@opt.act[:xml_dom][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_dom.dir) -                inp << f.place_file.xml_dom.rel -              end -              if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir) -                inp << f.place_file.xml_scaffold_structure_sisu.rel -              end -              if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir) -                inp << f.place_file.xml_scaffold_structure_collapse.rel -              end -              if (@opt.act[:txt][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.txt.dir) -                inp << f.place_file.txt.rel -              end -              if (@opt.act[:manpage][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.manpage.dir) -                inp << f.place_file.manpage.rel -              end -              if (@opt.act[:texinfo][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.info.dir) -                inp << f.place_file.info.rel -              end -              if (@opt.act[:hash_digests][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.hash_digest.dir) -                inp << f.place_file.hash_digest.rel -              end -              if (@opt.act[:share_source][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.src.dir) -                inp << f.place_file.src.rel -              end -              if (@opt.act[:sisupod][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.sisupod.dir) -                inp << f.place_file.sisupod.rel -              end -              if (@opt.act[:pdf][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) -                inp <<=(@opt.dir_structure_by == :filename) \ -                ? (f.output_path.pdf.rel + '/*.pdf') -                : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf') -              end -              if (@opt.act[:sqlite_discrete][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.sqlite_discrete.dir) -                inp << f.place_file.sqlite_discrete.rel -              end -              if (@opt.act[:qrcode][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.qrcode_md.dir) -                inp << f.place_file.qrcode_md.rel << f.place_file.qrcode_title.rel -              end -              if (@opt.act[:manifest][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.manifest.dir) -                inp << f.place_file.manifest.rel -              end -              local_gen=if inp.length > 0 -                inp.join(' ') -              else '' -              end -              local_css,images,images_system='','','' -              images=images_skin=images_system=local_css='' -              if @opt.cmd =~/[hwbxX]/ \ -              && (defined? @md.ec[:image]) \ -              && (@md.ec[:image].length > 0) -                images=f.place_file.images.rel + '/' + @md.ec[:image].join(" #{f.output_path.images.rel}/") -              end -              if @opt.cmd =~/[yhwbxX]/ \ -              && (defined? @md.ec[:image]) \ -              && (@md.ec[:image].length > 0) -                local_css=f.output_path.css.rel -                images_system='_sisu/image_sys' -              end -              begin -                ##create file structure without copying files?: -                ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/. -                #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} -                #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync -                local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css -                SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',f.output_path.base.dir) -              rescue -                p __LINE__.to_s + ':' + __FILE__ -                local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} -                SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync -              end -            elsif @opt.cmd =~/U/ -              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -              puts "#{local_gen} -> #{remote_gen}" -              if FileTest.file?("#{local_src}/#{src_doc}") \ -              or FileTest.file?("#{local_src}/#{src_doc}.txz") -                puts "#{local_src}/#{src_doc}* -> #{remote_src}" -              end -            else -              puts 'suspect rsync request, ignored' -              puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" -              puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            end -          end -        end -      end -      def site_harvest -        self.remote_host_base.each do |remote_conn| -          local=@source_path_harvest -          l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" -          lng='en' -          if @env.output_dir_structure.by? == :language -            ldest="#{lng}/manifest" -            files="#{ldest}/authors.html #{ldest}/topics.html" -          elsif @env.output_dir_structure.by? == :filetype -            ldest="manifest" -            files="#{ldest}/authors.#{lng}.html #{ldest}/topics.#{lng}.html" -          elsif @env.output_dir_structure.by? == :filename -            files="#{l_rel}/authors.#{lng}.html #{l_rel}/topics.#{lng}.html" -          end -          remote="#{remote_conn[:name]}/#{@opt.base_stub}" -          if @opt.act[:harvest][:set] \ -          && @opt.act[:rsync][:set] -            (@env.output_dir_structure.by? == :filename) \ -            ? (SiSU_Env::SystemCall.new(files,remote).rsync) -            : (SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel)) -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "rsync_harvest: #{local} -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base                                                             #base site -        ldest='_sisu/*' -        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.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) -        end -      end -      def site_base_sync -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            delete_extra_files='--delete' # '--delete-after' -            puts "begin rsync_base_sync: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) -            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "rsync_base_sync: #{local} -> #{remote}" -            puts "#{local}/_sisu/image_sys/ -> #{remote}" -            puts "#{local}/_sisu/image/ -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      self -    end -    def rsync_sitemaps                                                         #sitemap directory -      self.remote_host_base.each do |remote_conn| -        local="#{@source_path}/sitemapindex.xml" -        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) -        elsif @opt.cmd =~/U/ -          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          puts "rsync_sitemaps: #{local} -> #{remote}" -        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        end -      end -    end +  class InfoRemote < SiSU_Info_Remote::InfoRemote          # se_remotes.rb    end -  class InfoVersion <InfoEnv -    include Singleton -    begin -      require 'rbconfig' -      require 'yaml' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig or yaml NOT FOUND (LoadError)') -    end -    @@lib_path=nil -    def get_version -      @version={} -      @pwd=ENV['PWD'] -      lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') -      @@lib_path ||=lib_path -      if File.exist?(SiSU_is[:version_info_path]) -        @version=YAML::load(File::open(SiSU_is[:version_info_path])) #unless @@noyaml -      end -      @version[:install_method]=if SiSU_is[:run_from]==:gem_install -        spec = Gem::Specification.find_by_name("sisu") -        gem_root = spec.gem_dir -        (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ -        ? ' (ruby gem install)' : '' -      else '' -      end -      @version -    end -    def rbversion -      %x{ruby -v}.strip -    end +  class InfoVersion < SiSU_Info_Version::InfoVersion       # se_version.rb    end -  class InfoAbout -    def initialize(color='') -      @color=color -    end -    def sisu_version -      version=SiSU_Env::InfoVersion.instance.get_version -      rb_ver=SiSU_Env::InfoVersion.instance.rbversion -      if version[:version] -        opt_cmd=if defined? @color.cmd \ -        and @color.cmd =~/[ck]/ -          @color.cmd -        else '-v' -        end -        SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version -      else puts 'SiSU (version information not available)' -      end -    end -    def sisu_about -      puts <<-WOK -     sisu: documents; markup, structuring, publishing in multiple standard formats, & search -     most (not all) useful commands (are made in a directory containing a sisu markup file &) take the form: -       sisu [action(s)] [filename(s)] -     where filename refers to a valid sisu marked up file, e.g.: -       cd /usr/share/doc/sisu/markup-samples/sisu_manual -       sisu --html --verbose sisu_commands.sst -       sisu --txt --html --epub --odt --pdf --sqlite --manpage --texinfo --concordance --qrcode --verbose sisu.ssm -       cd - -     See output produced, or see man pages: man sisu -     <http://www.sisudoc.org/> <http://www.jus.uio.no/sisu/> -        WOK -    end +  class InfoAbout < SiSU_Info_About::InfoAbout             # se_version.rb    end -  class InfoFile <InfoEnv                                                  #todo unify with FileOp -    def initialize(fns) -      begin -        super(fns) -        @fns=fns -        @env=SiSU_Env::InfoEnv.new(@fns) -        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss -        @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] -      rescue -        SiSU_Screen::Ansi.new('',$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def basefilename #Remove if possible -      m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m -      @fns[m,1] -    end -    def make_file(path,filename) -      (File.writable?("#{path}/.")) \ -      ? File.new("#{path}/#{filename}",'w+') -      : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn) -    end -    def touch_file(path,filename) -      if File.writable?("#{path}/."); -        FileUtils::touch("#{path}/#{filename}") -      else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn -      end -    end -    def make_path(path) -      FileUtils::mkdir_p(path) unless FileTest.directory?(path) -    end -    def marshal -      def ao_content -        "#{@env.processing_path.ao}/#{@fns}.content.rbm" -      end -      def ao_idx_sst_rel_html_seg -        "#{@env.processing_path.ao}/#{@fns}.idx_sst.rbm" -      end -      def ao_idx_sst_rel #used by tex & odf -        "#{@env.processing_path.ao}/#{@fns}.idx_raw.rbm" -      end -      def ao_idx_html -        "#{@env.processing_path.ao}/#{@fns}.idx_html.rbm" -      end -      def ao_idx_xhtml -        "#{@env.processing_path.ao}/#{@fns}.idx_xhtml.rbm" -      end -      def ao_metadata -        "#{@env.processing_path.ao}/#{@fns}.metadata.rbm" -      end -      def ao_map_nametags -        "#{@env.processing_path.ao}/#{@fns}.map_name_tags.rbm" -      end -      def ao_map_ocn_htmlseg -        "#{@env.processing_path.ao}/#{@fns}.map_ocn_htmlseg.rbm" -      end -      def html_tune -        "#{@env.processing_path.tune}/#{@fns}.marshal_tune" -      end -      self -    end -    def write_file_processing -      def html_tune -        File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+') -      end -      self -    end -    def mkdir #check moved from FileOp, existing mkdir -      def processing -        def ao -          FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) -        end -        def tune -          FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) -        end -        self -      end -    end +  class InfoFile < SiSU_Info_File::InfoFile                # se_file_op.rb    end -  class ProcessingSettings -    def initialize(md) -      @md=md -    end -    def cnf_rc #sisurc.yml -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -    end -    def env_rc #env rc (including sisurc.yml) -      @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) -    end -    def doc_rc #document rc, make instructions -      (defined? @md.make) \ -      ? @md.make -      : nil -    end -    def cmd_rc_act #command-line rc -      @cmd_rc_act=@md.opt.opt_act -    end -    def build -      def ocn? -        if cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def plaintext_ocn? -        if cmd_rc_act[:txt_ocn][:set]==:on \ -        or cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:txt_ocn][:set]==:off \ -        or cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def odt_ocn? -        if cmd_rc_act[:odt_ocn][:set]==:on \ -        or cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:odt_ocn][:set]==:off \ -        or cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def html_strict? -        if cmd_rc_act[:html_strict][:set]==:on -          true -        elsif cmd_rc_act[:html_strict][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_strict? \ -        and doc_rc.html_strict? ==:on -          true -        else -          false -        end -      end -      def toc? -        if cmd_rc_act[:toc][:set]==:on -          true -        elsif cmd_rc_act[:toc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.toc? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.toc? ==:off -          false -        else -          true -        end -      end -      def manifest? -        if cmd_rc_act[:manifest][:set]==:on -          true -        elsif cmd_rc_act[:manifest][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.manifest? \ -        and doc_rc.manifest? ==:off -          false -        elsif env_rc.build.manifest? ==:off -          false -        else -          true -        end -      end -      def links_to_manifest? -        if cmd_rc_act[:links_to_manifest][:set]==:on -          true -        elsif cmd_rc_act[:links_to_manifest][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.links_to_manifest? \ -        and doc_rc.links_to_manifest? ==:off -          false -        elsif env_rc.build.links_to_manifest? ==:off -          false -        else -          true -        end -      end -      def metadata? -        if cmd_rc_act[:metadata][:set]==:on -          true -        elsif cmd_rc_act[:metadata][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.metadata? \ -        and doc_rc.metadata? ==:off -          false -        elsif env_rc.build.metadata? ==:off -          false -        else -          true -        end -      end -      def minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.minitoc? \ -        and doc_rc.minitoc? ==:off -          false -        elsif env_rc.build.minitoc? ==:off -          false -        else -          true -        end -      end -      def manifest_minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:manifest_minitoc][:set]==:on \ -        || cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ -        || cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.manifest_minitoc? \ -        and (doc_rc.manifest_minitoc? ==:off \ -        || doc_rc.minitoc? ==:off) -          false -        elsif env_rc.build.manifest_minitoc? ==:off \ -        || env_rc.build.minitoc? ==:off -          false -        elsif minitoc? == false -          false -        else -          true -        end -      end -      def html_minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:html_minitoc][:set]==:on \ -        || cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:html_minitoc][:set]==:off \ -        || cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_minitoc? \ -        and (doc_rc.html_minitoc? ==:off \ -        || doc_rc.minitoc? ==:off) -          false -        elsif env_rc.build.html_minitoc? ==:off \ -        || env_rc.build.minitoc? ==:off -          false -        elsif minitoc? == false -          false -        else -          true -        end -      end -      def html_top_band? -        if cmd_rc_act[:html_top_band][:set]==:on -          true -        elsif cmd_rc_act[:html_top_band][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_top_band? \ -        and doc_rc.html_top_band? ==:off -          false -        elsif env_rc.build.html_top_band? ==:off -          false -        else -          true -        end -      end -      def html_navigation? -        if cmd_rc_act[:html_navigation][:set]==:on -          true -        elsif cmd_rc_act[:html_navigation][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_navigation? \ -        and doc_rc.html_navigation? ==:off -          false -        elsif env_rc.build.html_navigation? ==:off -          false -        else -          true -        end -      end -      def html_navigation_bar? -        if cmd_rc_act[:html_navigation_bar][:set]==:on -          true -        elsif cmd_rc_act[:html_navigation_bar][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_navigation_bar? \ -        and doc_rc.html_navigation_bar? ==:off -          false -        elsif env_rc.build.html_navigation_bar? ==:off -          false -        else -          true -        end -      end -      def search_form? -        if cmd_rc_act[:search_form][:set]==:on -          true -        elsif cmd_rc_act[:search_form][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_search_form? \ -        and doc_rc.search_form? ==:off -          false -        elsif env_rc.build.search_form? ==:off -          false -        else -          true -        end -      end -      def html_search_form? -        if cmd_rc_act[:html_search_form][:set]==:on \ -        || cmd_rc_act[:search_form][:set]==:on -          true -        elsif cmd_rc_act[:html_search_form][:set]==:off \ -        || cmd_rc_act[:search_form][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_search_form? \ -        and (doc_rc.html_search_form? ==:off \ -        || doc_rc.search_form? ==:off) -          false -        elsif env_rc.build.html_search_form? ==:off \ -        || env_rc.build.search_form? ==:off -          false -        elsif search_form? == false -          false -        else -          true -        end -      end -      def html_right_pane? -        if cmd_rc_act[:html_right_pane][:set]==:on -          true -        elsif cmd_rc_act[:html_right_pane][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_right_pane? \ -        and doc_rc.html_right_pane? ==:off -          false -        elsif env_rc.build.html_right_pane? ==:off -          false -        else -          true -        end -      end -      def segsubtoc? -        if cmd_rc_act[:segsubtoc][:set]==:on -          true -        elsif cmd_rc_act[:segsubtoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.segsubtoc? \ -        and doc_rc.segsubtoc? ==:off -          false -        elsif env_rc.build.segsubtoc? ==:off -          false -        else -          true -        end -      end -      self -    end -    def ocn_html_identifier -      (build.html_strict?) \ -      ? Mx[:ocn_id_char] -      : '' -    end -    def output_dir_structure -      def by_language_code? -        if cmd_rc_act[:output_by][:set] == :language -          true -        elsif cmd_rc_act[:output_by][:set] == :filetype \ -        or cmd_rc_act[:output_by][:set] == :filename -          false -        elsif cmd_rc_act[:output_by][:set] == :language -          true -        else -          env_rc.output_dir_structure.by_language_code? -        end -      end -      def by_filetype? -        if cmd_rc_act[:output_by][:set] == :filetype -          true -        elsif cmd_rc_act[:output_by][:set] == :language \ -        or cmd_rc_act[:output_by][:set] == :filename -          false -        elsif cmd_rc_act[:output_by][:set] == :filetype -          true -        else -          env_rc.output_dir_structure.by_filetype? -        end -      end -      def by_filename? -        if cmd_rc_act[:output_by][:set] == :filename -          true -        elsif cmd_rc_act[:output_by][:set] == :language \ -        or cmd_rc_act[:output_by][:set] == :filetype -          false -        elsif cmd_rc_act[:output_by][:set] == :filename -          true -        else -          env_rc.output_dir_structure.by_filename? -        end -      end -      def multilingual? -        by_language_code? -      end -      def dump? -        ((cmd_rc_act[:dump][:bool] \ -        &&  cmd_rc_act[:dump][:inst]) \ -        || (env_rc.output_dir_structure.dump?)) \ -        ? true -        : false -      end -      def redirect? -        ((cmd_rc_act[:redirect][:bool] \ -        &&  cmd_rc_act[:redirect][:inst]) \ -        || (env_rc.output_dir_structure.redirect?)) \ -        ? true -        : false -      end -      def dump_or_redirect? -        ((dump?) || (redirect?)) \ -        ? true -        : false -      end -      def by? -        if dump? -          :dump -        elsif redirect? -          :redirect -        elsif by_language_code? -          :language -        elsif by_filetype? -          :filetype -        elsif by_filename? -          :filename -        else #recheck current default -          :language -        end -      end -      self -    end +  class ProcessingSettings < SiSU_Processing_Settings::ProcessingSettings # se_processing.rb    end -  class InfoDb < InfoEnv -    @@rc=nil -    def initialize -      @@pwd=@pwd=SiSU_Utils::Path.new.base_markup -      @env=SiSU_Env::InfoEnv.new -      pt=Pathname.new(@pwd) -      r=Px[:lng_lst_rgx] -      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -      @pwd_stub=pt.realpath.to_s[u,1] -      @rc=@@rc ||=GetInit.new.sisu_yaml.rc -      @defaults=SiSU_Env::InfoEnv.new.defaults -    end -    def share_source? -      ((defined? @rc['db']['share_source']) \ -      && @rc['db']['share_source']==true) \ -      ? @rc['db']['share_source'] -      : false -    end -    def engine -      def default -        ((defined? @rc['db']['engine']['default']) \ -        && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ -        ? @rc['db']['engine']['default'] -        : 'sqlite' -      end -      self -    end -    def psql -      def user(opt=nil) -        if opt \ -        and opt.mod.inspect =~/--db-user[=-]["']?(\S+)["']+/ -          $1 -        elsif opt \ -        and opt.mod =~/--webserv[=-]webrick/ -          @env.user -        else -          ((defined? @rc['db']['postgresql']['user']) \ -          && @rc['db']['postgresql']['user']=~/\S+/) \ -          ? @rc['db']['postgresql']['user'] -          : @env.user -        end -      end -      def db #db_name -        "#{Db[:name_prefix]}#{@pwd_stub}" -      end -      def port #PGPORT -        ((defined? @rc['db']['postgresql']['port']) \ -        && ( @rc['db']['postgresql']['port'] =~/\d+/ \ -        || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \ -        ? @rc['db']['postgresql']['port'] -        : (@defaults[:postgresql_port]) -      end -      def password -        ((defined? @rc['db']['postgresql']['password']) \ -        && @rc['db']['postgresql']['password']=~/\S+/) \ -        ? @rc['db']['postgresql']['password'] -        : '' -      end -      def host -        ((defined? @rc['db']['postgresql']['host']) \ -        && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ -        ? @rc['db']['postgresql']['host'] -        : '' -      end -      def dbi -        PG::Connection.open(:dbname =>  psql.db) -      end -      def dbi_ -        (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ -        ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" -        : "DBI:Pg:database=#{psql.db};port=#{psql.port}" -      end -      def conn_dbi -        DBI.connect(psql.dbi,psql.user,psql.db) -      end -      def conn_pg -        require 'pg' -        PG::Connection.new(dbname: psql.db, port: psql.port) -      end -     self -    end -    def sqlite -      def db -        "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" -      end -      def db_discrete(md) -        # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" -      end -      def dbi -        "DBI:SQLite3:#{sqlite.db}" #sqlite3 ? -      end -      def sqlite3 -        sqlite.db #sqlite3 ? -      end -      def conn_dbi -        DBI.connect(sqlite.dbi) -      end -      def conn_sqlite3 -        SQLite3::Database.new(sqlite.sqlite3) -      end -      self -    end +  class InfoDb < SiSU_Info_Db::InfoDb                      # se_db.rb    end -  class DbOp <InfoDb -    def initialize(md) -      begin -        @md=md -      rescue -        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def sqlite_discrete -      def db -        "#{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}" -      end -      def dbi -        "DBI:SQLite3:#{sqlite_discrete.db}" -      end -      def sqlite3 -        sqlite_discrete.db -      end -      def conn_dbi -        DBI.connect(sqlite_discrete.dbi) -      end -      def conn_sqlite3 -        begin -          $sqlite3=:yes -          require 'sqlite3' -          SQLite3::Database.new(sqlite_discrete.sqlite3) -        rescue LoadError -          $sqlite3=:no -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)') -        end -      end -      self -    end +  class DbOp < SiSU_Db_Op::DbOp                            # se_db.rb    end -  class FileOp <InfoFile                                                    #todo unify with CreateFile -    def initialize(md,fno='') -      begin -        @md,@fno=md,fno -        @env=SiSU_Env::InfoEnv.new(@md.fns) -      rescue -        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def output_dir_structure -      ProcessingSettings.new(@md).output_dir_structure -    end -    def mkdir_initialize                                                       # not used but consider using -      FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) -      FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") -      FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") -      FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) -      FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) -    end -    def path_rel_links -      def html_scroll_2 -        if output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_seg_2 -        if output_dir_structure.by_language_code? -          '../../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def html_scroll_1 -        if output_dir_structure.by_language_code? -          '../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          './' -        end -      end -      def html_seg_1 -        if output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          './' -        end -      end -      def default_output_css -        if (@md.opt.opt_act[:dump][:bool] \ -        &&  @md.opt.opt_act[:dump][:inst]) \ -        || (@md.opt.opt_act[:redirect][:bool] \ -        &&  @md.opt.opt_act[:redirect][:inst]) -          './' -        elsif output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_scroll_css -        default_output_css -      end -      def xhtml_css -        default_output_css -      end -      def xml_css -        default_output_css -      end -      def html_seg_css -        if output_dir_structure.by_language_code? -          '../../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def manifest_css -        if output_dir_structure.by_language_code? -          '../../_sisu/css' -        elsif output_dir_structure.by_filetype? -          '' -        else -          '../' -        end -      end -      self -    end -    def mkdir -      def output -        def base -          FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) -        end -        def css -          FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") -        end -        def epub -          path=output_path.epub.dir -          make_path(path) -        end -        self -      end -      self -    end -    def mkfile #consider using more -      path="#{output_path.base.dir}/#{@md.fnb}" -      make_path(path) -      filename=@fno -      make_file(path,filename) -    end -    def mkfile_pwd -      path=Dir.pwd -      filename=@fno -      make_file(path,filename) -    end -    def write_file -      def txt -        path=output_path.txt.dir -        make_path(path) -        fn=base_filename.txt -        make_file(path,fn) -      end -      def textile -        path=output_path.textile.dir -        make_path(path) -        fn=base_filename.textile -        make_file(path,fn) -      end -      def asciidoc -        path=output_path.asciidoc.dir -        make_path(path) -        fn=base_filename.asciidoc -        make_file(path,fn) -      end -      def markdown -        path=output_path.markdown.dir -        make_path(path) -        fn=base_filename.markdown -        make_file(path,fn) -      end -      def rst -        path=output_path.rst.dir -        make_path(path) -        fn=base_filename.rst -        make_file(path,fn) -      end -      def html_scroll -        pth=output_path.html.dir -        make_path(pth) -        p_fn=place_file.html_scroll.dir -        @@filename_html_scroll=File.new(p_fn,'w+') -      end -      def html_seg_index -        pth=((output_dir_structure.by_filename?) \ -          || (output_dir_structure.dump?)) \ -        ? "#{output_path.html.dir}" -        : "#{output_path.html.dir}/#{@md.fnb}" -        make_path(pth) -        p_fn=place_file.html_seg_index.dir -        @@filename_html_index=File.new(p_fn,'w+') -      end -      def html_segtoc -        pth=((output_dir_structure.by_filename?) \ -          || (output_dir_structure.dump?) \ -          || (output_dir_structure.redirect?)) \ -        ? "#{output_path.html.dir}" -        : "#{output_path.html.dir}/#{@md.fnb}" -        make_path(pth) -        p_fn=place_file.html_segtoc.dir -        @@filename_html_index=File.new(p_fn,'w+') -      end -      def xhtml -        path=output_path.xhtml.dir -        make_path(path) -        fn=base_filename.xhtml -        make_file(path,fn) -      end -      def xml_sax -        path=output_path.xml.dir -        make_path(path) -        fn=base_filename.xml_sax -        make_file(path,fn) -      end -      def xml_dom -        path=output_path.xml.dir -        make_path(path) -        fn=base_filename.xml_dom -        make_file(path,fn) -      end -      def xml_docbook_book -        path=output_path.xml_docbook_book.dir -        make_path(path) -        fn=base_filename.xml_docbook_book -        make_file(path,fn) -      end -      def xml_fictionbook -        path=output_path.xml_fictionbook.dir -        make_path(path) -        fn=base_filename.xml_fictionbook -        make_file(path,fn) -      end -      def xml_scaffold_structure_sisu -        path=output_path.xml_scaffold_structure_sisu.dir -        make_path(path) -        fn=base_filename.xml_scaffold_structure_sisu -        make_file(path,fn) -      end -      def xml_scaffold_structure_collapse -        path=output_path.xml_scaffold_structure_collapse.dir -        make_path(path) -        fn=base_filename.xml_scaffold_structure_collapse -        make_file(path,fn) -      end -      def manpage -        path=output_path.manpage.dir -        make_path(path) -        fn=base_filename.manpage -        make_file(path,fn) -      end -      def texinfo -        path=output_path.texinfo.dir -        make_path(path) -        fn=base_filename.texinfo -        make_file(path,fn) -      end -      def info -        path=output_path.texinfo.dir -        make_path(path) -        fn=base_filename.info -        make_file(path,fn) -      end -      def hash_digest -        path=output_path.hash_digest.dir -        make_path(path) -        fn=base_filename.hash_digest -        make_file(path,fn) -      end -      def qrcode -        path=output_path.qrcode.dir -        make_path(path) -        fn=base_filename.qrcode -        make_file(path,fn) -      end -      def manifest -        path=output_path.manifest.dir -        make_path(path) -        fn=base_filename.manifest -        make_file(path,fn) -      end -      def manifest_txt -        path=output_path.manifest.dir -        make_path(path) -        fn=base_filename.manifest_txt -        make_file(path,fn) -      end -      def pot -        path=output_path.pot.dir -        make_path(path) -        fn=base_filename.pot -        make_file(path,fn) -      end -      def po -        path=output_path.po.dir -        make_path(path) -        fn=base_filename.po -        make_file(path,fn) -      end -      self -    end -    def place_file -      def txt -        def dir -          output_path.txt.dir + '/' + base_filename.txt -        end -        def rel -          output_path.txt.rel + '/' + base_filename.txt -        end -        self -      end -      def textile -        def dir -          output_path.textile.dir + '/' + base_filename.textile -        end -        def rel -          output_path.textile.rel + '/' + base_filename.textile -        end -        self -      end -      def asciidoc -        def dir -          output_path.asciidoc.dir + '/' + base_filename.asciidoc -        end -        def rel -          output_path.asciidoc.rel + '/' + base_filename.asciidoc -        end -        self -      end -      def markdown -        def dir -          output_path.markdown.dir + '/' + base_filename.markdown -        end -        def rel -          output_path.markdown.rel + '/' + base_filename.markdown -        end -        self -      end -      def rst -        def dir -          output_path.rst.dir + '/' + base_filename.rst -        end -        def rel -          output_path.rst.rel + '/' + base_filename.rst -        end -        self -      end -      def html_scroll -        def dir -          output_path.html_scroll.dir + '/' + base_filename.html_scroll -        end -        def rel -          output_path.html_scroll.rel + '/' + base_filename.html_scroll -        end -        self -      end -      def html_seg_index -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_seg_index -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_seg_index -        end -        self -      end -      def html_segtoc -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_segtoc -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_segtoc -        end -        self -      end -      def html_book_index -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_book_index -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_book_index -        end -        self -      end -      def html_concordance -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_concordance -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_concordance -        end -        self -      end -      def odt -        def dir -          output_path.odt.dir + '/' + base_filename.odt -        end -        def rel -          output_path.odt.rel + '/' + base_filename.odt -        end -        self -      end -      def epub -        def dir -          output_path.epub.dir + '/' + base_filename.epub -        end -        def rel -          output_path.epub.rel + '/' + base_filename.epub -        end -        self -      end -      def pdf_p -        STDERR.puts 'ERROR not available due to multiple page format sizes' -      end -      def pdf_l -        STDERR.puts 'ERROR not available due to multiple page format sizes' -      end -      def xhtml -        def dir -          output_path.xhtml.dir + '/' + base_filename.xhtml -        end -        def rel -          output_path.xhtml.rel + '/' + base_filename.xhtml -        end -        self -      end -      def xml_sax -        def dir -          output_path.xml.dir + '/' + base_filename.xml_sax -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_sax -        end -        self -      end -      def xml_dom -        def dir -          output_path.xml.dir + '/' + base_filename.xml_dom -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_dom -        end -        self -      end -      def xml_docbook_book -        def dir -          output_path.xml_docbook.dir + '/' + base_filename.xml_docbook_book -        end -        def rel -          output_path.xml_docbook.rel + '/' + base_filename.xml_docbook_book -        end -        self -      end -      def xml_fictionbook -        def dir -          output_path.xml_fictionbook.dir + '/' + base_filename.xml_fictionbook -        end -        def rel -          output_path.xml_fictionbook.rel + '/' + base_filename.xml_fictionbook -        end -        self -      end -      def xml_scaffold_structure_sisu -        def dir -          output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_sisu -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_sisu -        end -        self -      end -      def xml_scaffold_structure_collapse -        def dir -          output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_collapse -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_collapse -        end -        self -      end -      def sqlite_discrete -        def dir -          output_path.sqlite_discrete.dir + '/' + base_filename.sqlite_discrete -        end -        def rel -          output_path.sqlite_discrete.rel + '/' + base_filename.sqlite_discrete -        end -        self -      end -      def hash_digest -        def dir -          output_path.hash_digest.dir + '/' + base_filename.hash_digest -        end -        def rel -          output_path.hash_digest.rel + '/' + base_filename.hash_digest -        end -        self -      end -      def src -        def dir -          output_path.src.dir + '/' + base_filename.src -        end -        def rel -          output_path.src.rel + '/' + base_filename.src -        end -        self -      end -      def sisupod -        def dir -          output_path.sisupod.dir + '/' + base_filename.sisupod -        end -        def rel -          output_path.sisupod.rel + '/' + base_filename.sisupod -        end -        self -      end -      def po -        def dir -          output_path.po.dir + '/' + base_filename.po -        end -        def rel -          output_path.po.rel + '/' + base_filename.po -        end -        self -      end -      def pot -        def dir -          output_path.pot.dir + '/' + base_filename.pot -        end -        def rel -          output_path.pot.rel + '/' + base_filename.pot -        end -        self -      end -      def po_git -        def dir -          output_path.po_git + '/' + base_filename.po -        end -        def rel -          #output_path.po_git + '/' + base_filename.po -        end -        self -      end -      def pot_git -        def dir -          output_path.pot_git + '/' + base_filename.pot -        end -        def rel -          #output_path.pot_git + '/' + base_filename.pot -        end -        self -      end -      def manpage -        def dir -          output_path.manpage.dir + '/' + base_filename.manpage -        end -        def rel -          output_path.manpage.rel + '/' + base_filename.manpage -        end -        self -      end -      def texinfo -        def dir -          output_path.texinfo.dir + '/' + base_filename.texinfo -        end -        def rel -          output_path.texinfo.rel + '/' + base_filename.texinfo -        end -        self -      end -      def info -        def dir -          output_path.texinfo.dir + '/' + base_filename.info -        end -        def rel -          output_path.texinfo.rel + '/' + base_filename.info -        end -        self -      end -      def qrcode_title -        def dir -          output_path.qrcode.dir + '/' + base_filename.qrcode_title -        end -        def rel -          output_path.qrcode.rel + '/' + base_filename.qrcode_title -        end -        self -      end -      def qrcode_md -        def dir -          output_path.qrcode.dir + '/' + base_filename.qrcode_md -        end -        def rel -          output_path.qrcode.rel + '/' + base_filename.qrcode_md -        end -        self -      end -      def manifest -        def dir -          output_path.manifest.dir + '/' + base_filename.manifest -        end -        def rel -          output_path.manifest.rel + '/' + base_filename.manifest -        end -        self -      end -      self -    end -    def base_filename -      def i18n(f) -        f=default_hash.merge(f) -        f[:lng] ||=@md.lang_code_insert -        f[:fn] + f[:lng] + f[:ft] -      end -      def default_hash -        { -          fn: @md.fnb, -          lng: @md.lang_code_insert, -        } -      end -      def default_hash_build(fh,sfx) -        if fh.is_a?(Hash) -          fh[:fn] ||=@md.fnb -          fh[:lng] ||= @md.lang_code_insert -          fh[:ft]=sfx -          fh -        else -          { -            fn: @md.fnb, -            lng: @md.lang_code_insert, -            ft: sfx, -          } -        end -      end -      def lang_code?(lng) -        (output_dir_structure.by_language_code?) \ -        ? '' -        : (lng ||=@md.lang_code_insert) -      end -      def txt(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def textile(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_textile]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def asciidoc(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_asciidoc]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def markdown(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_markdown]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def rst(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_rst]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_scroll(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_seg_index(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: 'index', -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def html_segtoc(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: fh[:fn] + '.toc', -            ft: fh[:ft], -          } -        else -          { -            fn: 'toc', -            ft: fh[:ft], -            lng: lang_code?(fh[:lng]), -          } -        end -        i18n(fnh) -      end -      def html_seg(fh) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_book_index(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: 'book_index', -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def html_concordance(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: 'concordance', -            ft: fh[:ft], -          } -        else -          { -            fn: 'concordance', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xhtml(fh=nil) -        fh=default_hash_build(fh,Sfx[:xhtml]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def epub(fh=nil) -        fh=default_hash_build(fh,Sfx[:epub]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def odt(fh=nil) -        fh=default_hash_build(fh,Sfx[:odt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'opendocument', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_sax(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_sax]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_dom(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_dom]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_docbook_book(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_docbook_book]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_fictionbook(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_fictionbook]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_scaffold_structure_sisu(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_scaffold_structure_collapse(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def pdf_p(fh=nil) -        fh=default_hash_build(fh,Sfx[:pdf]) -        fh[:lng]=lang_code?(fh[:lng]) -        if output_dir_structure.by_filename? -          'portrait' + fh[:lng] + '.' -        else -          fh[:fn] + '.portrait' + fh[:lng] + '.' -        end -      end -      def pdf_l(fh=nil) -        fh=default_hash_build(fh,Sfx[:pdf]) -        fh[:lng]=lang_code?(fh[:lng]) -        if output_dir_structure.by_filename? -          'landscape' + fh[:lng] + '.' -        else -          fh[:fn] + '.landscape' + fh[:lng] + '.' -        end -      end -      def pdf_p_a4(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_a4] -      end -      def pdf_p_a5(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_a5] -      end -      def pdf_p_b5(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_b5] -      end -      def pdf_p_letter(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_letter] -      end -      def pdf_p_legal(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_legal] -      end -      def pdf_l_a4(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_a4] -      end -      def pdf_l_a5(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_a5] -      end -      def pdf_l_b5(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_b5] -      end -      def pdf_l_letter(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_letter] -      end -      def pdf_l_legal(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_legal] -      end -      def manpage(fh=nil) -        fh=default_hash_build(fh,Sfx[:manpage]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def info(fh=nil) -        fh=default_hash_build(fh,Sfx[:info]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def texinfo(fh=nil) -        fh=default_hash_build(fh,Sfx[:texinfo]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def sqlite_discrete(fh=nil) -        fh=default_hash_build(fh,Sfx[:sql]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def hash_digest(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_language_code? -          { -            fn: fh[:fn] + '.hash_digest', -            ft: fh[:ft], -          } -        elsif output_dir_structure.by_filetype? -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: 'digest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def sitemap(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_language_code? -          { -            fn: fh[:fn] + '.sitemap', -            ft: fh[:ft], -          } -        elsif output_dir_structure.by_filetype? -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: 'sitemap', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def qrcode_title(fh=nil) -        fh=default_hash_build(fh,'.title.png') -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def qrcode_md #check name below -        fh=default_hash_build(fh,'.md.png') -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def manifest_txt(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def manifest(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: fh[:fn] + '.manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        elsif output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def src -        @md.fno -      end -      def po #check -        (@fno.empty?) \ -        ? (@md.fn[:po]) -        : (@fno + '.po') -      end -      def pot -        (@fno.empty?) \ -        ? (@md.fn[:pot]) -        : (@fno + '.pot') -      end -      def sisupod -        (@md.fns =~/\.ssm\.sst$/) \ -        ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz') -        : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz') -      end -      self -    end -    def set_path(ft) -      @ft=ft -      def dir -        def abc -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          elsif output_dir_structure.by_language_code? -            "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.base.dir}/#{@ft}" -          else -            "#{output_path.base.dir}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          elsif output_dir_structure.by_language_code? -            "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.base.dir}/#{@ft}" -          end -        end -        def ab_src -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          else -            "#{output_path.base.dir}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -          end -        end -        def ab_pod -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          else -            "#{output_path.base.dir}/#{@ft}" -          end -        end -        self -      end -      def url -        def abc -          if output_dir_structure.by_language_code? -            "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.base.url}/#{@ft}" -          else -            "#{output_path.base.url}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.base.url}/#{@ft}" -          end -        end -        def ab_src -          "#{output_path.base.url}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -        end -        def ab_pod -          "#{output_path.base.url}/#{@ft}" -        end -        self -      end -      def rel -        def abc -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{@ft}" -          else -            "#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          else -            "#{@ft}" -          end -        end -        def ab_src -          @ft -        end -        def ab_pod -          @ft -        end -        self -      end -      def rel_sm -        def abc -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{@ft}" -          else -            "#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? \ -          or output_dir_structure.by_filetype? -            '../' + @ft -          else '.' -          end -        end -        def ab_src -          locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? -            "../../#{locate}" -          else -            "../#{locate}" -          end -        end -        def ab_pod -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? -            "../../#{@ft}" -          else -            "../#{@ft}" -          end -        end -        self -      end -      def rcp -        def abc -          if output_dir_structure.by_language_code? -            "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.stub.rcp}/#{@ft}" -          else -            "#{output_path.stub.rcp}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.stub.rcp}/#{@ft}" -          end -        end -        self -      end -      self -    end -    def output_path -      def web_base -        def dir -          @env.path.webserv -        end -        def url -          #"#{@env.url.root}" -        end -        def rel -          '.' -        end -        def rcp -          '.' -        end -        self -      end -      def stub -        def dir -          "#{@md.opt.f_pth[:pth_stub]}" -        end -        #def url -        #  "#{@env.url.root}" -        #end -        def rel -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        def rcp -          "#{@md.opt.f_pth[:pth_stub]}" -        end -        self -      end -      def webserver_path -        if output_dir_structure.dump? -          @md.opt.opt_act[:dump][:inst] -        elsif output_dir_structure.redirect? -          @md.opt.opt_act[:redirect][:inst] -        else -          @env.path.webserv -        end -      end -      def base -        def dir -          "#{webserver_path}/#{@md.opt.f_pth[:pth_stub]}" -        end -        def url -          "#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}" -        end -        def rel -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        def rcp -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        self -      end -      def sisugit -        def dir -          "#{output_path.base.dir}/git" -        end -        def url -          "#{output_path.base.url}/git" -        end -        def rel -          "#{output_path.base.rel}/git" -        end -        def rcp -          "#{output_path.base.rcp}/git" -        end -        self -      end -      #def pod -      #  ft='pod' -      #  path=set_path(ft).dir.ab -      #end -      def src -        def ft -          Gt[:src] -        end -        def dir -          set_path(ft).dir.ab_src -        end -        def url -          set_path(ft).url.ab_src -        end -        def rel -          set_path(ft).rel.ab_src -        end -        def rcp -          set_path(ft).rcp.ab_src -        end -        def rel_sm -          set_path(ft).rel_sm.ab_src -        end -        self -      end -      def sisupod -        def ft -          Gt[:src] -        end -        def dir -          set_path(ft).dir.ab_pod -        end -        def url -          set_path(ft).url.ab_pod -        end -        def rel -          set_path(ft).rel.ab_pod -        end -        def rcp -          set_path(ft).rcp.ab_pod -        end -        def rel_sm -          set_path(ft).rel_sm.ab_pod -        end -        self -      end -      def po -        def dir -          "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/po/#{@md.opt.lng}" -        end -        def url -          "#{output_path.base.url}/po4a/#{@md.fnb}/po/#{@md.opt.lng}" -        end -        self -      end -      def pot -        def dir -         "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/pot" -        end -        def url -          "#{output_path.base.url}/po4a/#{@md.fnb}/pot" -        end -        def rcp -          #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" -        end -        self -      end -      def po_git # consider !!! -        def ft -          Gt[:po] -        end -        def dir -          pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + @md.opt.lng -          FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -          pth -        end -        self -      end -      def pot_git # consider !!! -        def ft -          Gt[:pot] -        end -        def dir -          @env.processing_path.git + '/' + @md.fnb + '/' + ft -        end -        self -      end -      def md_harvest -        manifest -        self -      end -      def txt -        def ft -         'txt' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def textile -        def ft -         'textile' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def asciidoc -        def ft -         'asciidoc' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def markdown -        def ft -         'markdown' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def rst -        def ft -         'rst' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def html_scroll -        def ft -         'html' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def html_seg -        def ft -          "html/#{@md.fnb}" -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def html_concordance -        html_seg -        self -      end -      def html -        def ft -         'html' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).url.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def xhtml -        def ft -         'xhtml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def epub -        def ft -         'epub' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          './image' -        end -        self -      end -      def odt -        def ft -         'odt' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def xml -        def ft -         'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_sax -        xml -        self -      end -      def xml_dom -        xml -        self -      end -      def xml_docbook -        def ft -         'docbook' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_docbook_article -        def ft -         'docbook' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_docbook_book -        def ft -         'docbook' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_fictionbook -        def ft -         'fictionbook' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_scaffold_structure_sisu -        def ft -         'sisu.scaffold.xml' -         #'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_scaffold_structure_collapse -        def ft -         'collapsed.scaffold.xml' -         #'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def pdf -        def ft -         'pdf' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def sqlite_discrete -        def ft -         'sql' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def hash_digest -        def ft -         'hashes' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def manifest -        def ft -         'manifest' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        def rcp -          set_path(ft).rcp.abc -        end -        self -      end -      def qrcode -        def ft -         'manifest/qrcode' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def harvest -        def ft -         'site_metadata' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          if output_dir_structure.by_language_code? -            '' -          elsif output_dir_structure.by_filetype? -            '' -          else -            '' -          end -        end -        self -      end -      def manpage -        def ft -         'man' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def texinfo -        def ft -         'texinfo' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def sitemaps -        def ft -          'sitemaps' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        self -      end -      def sqlite #check url -        def dir -          output_path.base.dir -        end -        def url -          output_path.base.url -        end -        def rel -          output_path.base.rel -        end -        def rcp -          output_path.base.rcp -        end -        self -      end -      #def cgi -      #end -      def css -        @d='_sisu/css' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          @d -          #output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.stub.rcp + '/' + @d -        end -        self -      end -      def images -        @d='_sisu/image' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          @d -          #output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.stub.rcp + '/' + @d -        end -        self -      end -      def images_external -        @d='_sisu/image_external' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.base.rcp + '/' + @d -        end -        self -      end -      #def css -      #  #"#{@env.path.output}/#{@env.path.style}" -      #end -      self -    end +  class FileOp < SiSU_File_Op::FileOp                      # se_file_op.rb    end -  class FilenameLanguageCodeInsert -    def initialize(opt,lng=nil) -      @opt,@lng=opt,lng -      @opt=opt -      @lng=lng ||=@opt.lng -    end -    def language_code_insert -      if @opt.dir_structure_by ==:language \ -      or ((@opt.dir_structure_by ==:filetype \ -      || @opt.dir_structure_by ==:filename) \ -      and (@opt.lingual ==:mono \ -      && @lng == @opt.act[:default_language][:code])) -        '' -      elsif (@opt.dir_structure_by ==:filetype \ -      || @opt.dir_structure_by ==:filename) \ -      and not @opt.lingual ==:mono -        ".#{@lng}" -      else -        ".#{@lng}" -      end -    end +  class FilenameLanguageCodeInsert < SiSU_Filename_Lang::FilenameLanguageCodeInsert # se_file_op.rb    end -  class CreateFile <InfoEnv                                                  #todo unify with FileOp -    def initialize(fns) -      begin -        super(fns) -        @env=SiSU_Env::InfoEnv.new(fns) -      rescue -        SiSU_Screen::Ansi.new('',$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def html_root -      #@env.path.output -    end -    def mkdir_pdf -      Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex) -    end -    def file_generic(output_file='') -      filename="#{@env.path.output}/#{@fnb}/#{output_file}" -      File.new(filename,'w+') -    end -    def file_error -      File.new('/tmp/errorlog.sisu','w+') -    end -    def file_txt -      File.new("#{@env.processing_path.ao}/#{@fns}.txt",'w+') -    end -    def file_debug -      File.new("#{@env.processing_path.ao}/#{@fns}.debug.txt",'w+') -    end -    def metaverse -      def file_meta -        File.new("#{@env.processing_path.ao}/#{@fns}.meta",'w+') -      end -      def file_meta_idx_html -        File.new("#{@env.processing_path.ao}/#{@fns}.idx.html",'w+') -      end -      self -    end -    def file_note -      File.new("#{Dir.pwd}/#{@fns}.fn",'w+') -    end -    def meta -      "#{@env.processing_path.ao}/#{@fns}.meta" -    end -    def file_semantic -      filename_semantic="./semantic.yaml" -      @@filename_semantic=File.new(filename_semantic,'w+') -    end -    def file_rss -      filename_rss="./semantic.xml" -      @@filename_rss=File.new(filename_rss,'w+') -    end -    def epub -      @pth=@env.processing_path.epub -      def xhtml_index -        filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml" -        File.new(filename_index,'w+') -      end -      def xhtml_cover_image -        filename_index="#{@pth}/#{Ep[:d_oebps]}/cover_image.xhtml" -        File.new(filename_index,'w+') -      end -      def xhtml_segtoc -        filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml" -        File.new(filename_segtoc,'w+') -      end -      def mimetype  #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype -        File.new("#{@pth}/mimetype",'w') -      end -      def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf -        File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_opf]}",'w') -      end -      def toc_ncx  #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx -        File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_ncx]}",'w') -      end -      def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml -        File.new("#{@pth}/META-INF/container.xml",'w') -      end -      def xhtml_css #fixed epub xhtml css -        File.new("#{@pth}/#{Ep[:d_oebps]}/css/xhtml.css",'w') -      end -      self -    end -    def file_texinfo -      File.new("#{@env.processing_path.texinfo}/#{@fnb}.texinfo",'w+') -    end +  class CreateFile < SiSU_Create_File::CreateFile          # se_file_op.rb    end -  class Clear <InfoEnv                                                  #todo unify with FileOp -    def initialize(cmd,fns,operation='') -      @cmd=cmd -      begin -        super(fns) -        @env=SiSU_Env::InfoEnv.new(fns) -        InfoVersion.instance -        if operation.class.inspect =~/SiSU_Param/ -          @md=operation -        end -        case operation #watch -        when /pdf/                 then @env_out='' -        when /sql/ -        when /xml|plaintext|ascii/ then @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii -        else -          if defined? @md.sfx_src \ -          and @md.sfx_src =~/ss[ftsumc]/ -            @env_suf='lm' -            @env_out_root=@env.path.output -            @env_out="#{@env.path.output}/#{@fnb}" -            @@publisher='SiSU http://www.jus.uio.no/sisu' -            @env_pdf="#{@env_out_root}/pdf" -          end -        end -      rescue -        SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def param_instantiate -      @cX||=SiSU_Screen::Ansi.new(@cmd) -      @@date=SiSU_Env::InfoDate.new -      @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil -      @@publisher='SiSU scribe' -    end +  class Clear < SiSU_Clear::Clear                          # se_clear.rb    end -  class InfoPort < InfoEnv -    def initialize -      @env=SiSU_Env::InfoEnv.new -    end -    def webrick -      @env.port.webrick_port -    end +  class InfoPort < SiSU_Info_Port::InfoPort                # se_info_port.rb    end -  class InfoProgram < InfoEnv                                                #revisit -    attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite -    def initialize -      prog=SiSU_Env::InfoEnv.new.program -      @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite -    end +  class InfoProgram < SiSU_Info_Program::InfoProgram       # se_programs.rb    end -  class CSS_Default -    def html -      'html.css' -    end -    def html_tables -      'html_tables.css' -    end -    def xhtml -      'xhtml.css' -    end -    def xml_sax -      'sax.css' -    end -    def xml_dom -      'dom.css' -    end -    def xml_docbook -      'docbook.css' -    end -    def homepage -      'homepage.css' -    end -    def harvest -      'harvest.css' -    end +  class CSS_Default < SiSU_CSS::CSS_Default                # se_css.rb    end -  class CSS_Select < InfoEnv -    def initialize(md) -      @md=md -      @env=SiSU_Env::InfoEnv.new('',@md) -    end -    def html -      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.base_markup_dir_stub}_html.css") -        "#{@env.path.base_markup_dir_stub}_html.css" -      else -        SiSU_Env::CSS_Default.new.html -      end -    end -    def html_tables -      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.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 -    def xhtml -      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.base_markup_dir_stub}_xhtml.css") -        "#{@env.path.base_markup_dir_stub}_xhtml.css" -      else SiSU_Env::CSS_Default.new.xhtml -      end -    end -    def xml_sax -      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.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 -    def xml_dom -      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.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 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.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.base_markup_dir_stub}_homepage.css") -        "#{@env.path.base_markup_dir_stub}_homepage.css" -      else SiSU_Env::CSS_Default.new.homepage -      end -    end +  class CSS_Select < SiSU_CSS::CSS_Select                  # se_css.rb    end -  class CSS_Stylesheet -    def initialize(md) -      @md=md -      @css=SiSU_Env::CSS_Select.new(@md) -      @env=SiSU_Env::InfoEnv.new('',@md) -      @file=SiSU_Env::FileOp.new(@md) -    end -    def html -      stylesheet="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def html_seg -      stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def html_tables -      stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def xhtml_epub -      %{  <link rel="stylesheet" href="css/xhtml.css" type="text/css" />} -    end -    def epub -      xhtml_epub -    end -    def xhtml -      stylesheet="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}" -      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} -    end -    def xml_sax -      stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}" -      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} -    end -    def xml_dom -      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 +  class CSS_Stylesheet < SiSU_CSS::CSS_Stylesheet          # se_css.rb    end -  class CreateSite < InfoEnv -    require_relative 'css'                              # css.rb -      include SiSU_Style -    def initialize(opt) -      @opt=opt -      @env=SiSU_Env::InfoEnv.new -      @init=SiSU_Env::GetInit.new -      @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd -      @rc=GetInit.new.sisu_yaml.rc -      @vz=SiSU_Viz::Defaults.new -      @vz_home=SiSU_Viz::Home.new -    end -    def create_default_sisu_homepage(action=:none) -      if action==:none -        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.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 -        file_home_toc << @vz_home.homepage -        file_homepage.close -        file_home_toc.close -      end -    end -    def homepage -      home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") -      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.base_markup_dir_stub}") -        end -      else -        create_default_sisu_homepage(:none) -        #create_default_sisu_homepage(:default) -      end -    end -    def cp_images(src_path,dest_path) -      if FileTest.directory?(src_path) -        FileUtils::cd(src_path) -        source=Dir.glob("*.{png,jpg,gif,ico}") -        FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) -        FileUtils::chmod(0755,dest_path) -        source.each do |i| -          if FileTest.file?(i) -            FileUtils::cp(i,"#{dest_path}/#{i}") -            FileUtils::chmod(0644,"#{dest_path}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} -          end -        end -        FileUtils::cd(@pwd) -      else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} -      end -    end -    def cp_local_images -      src="#{@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.base_markup_dir_stub}/_sisu/image_external" -      if FileTest.directory?(src) -        cp_images(src,dest) if FileTest.directory?(src) -      end -    end -    def cp_webserver_images -      src=@env.path.image_source -      dest_arr=[ -        "#{@env.path.webserv}/_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) -      end -    end -    def cp_webserver_images_local #this should not have been necessary -      src=@env.path.image_source -      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.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 -      if defined? @rc['permission_set']['css_modify'] \ -      and @rc['permission_set']['css_modify'] -        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) -            source=Dir.glob("*.{css}") -            source.each do |i| -              if FileTest.file?(i) -                FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") -              else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} -              end -            end -            FileUtils::cd(@pwd) -          end -        end -      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 @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 @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 @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 @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 @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 @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 @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 -      end -    end +  class CreateSite < SiSU_Create_Site::CreateSite          # se_createsite.rb    end  end  module SiSU_Screen @@ -7233,4 +162,3 @@ module SiSU_Errors    require_relative 'errors'                             # errors.rb  end  __END__ -https? intro check 2007-09-22 diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index 955b1060..ad8217ed 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -113,8 +113,16 @@ module SiSU_TexInfo          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          && ! @opt.act[:quiet][:set]==:on \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'TexInfo', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'TexInfo', +            tool +          ).green_title_hi          @md=SiSU_Param::Parameters.new(@opt).get          directories          @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.ao_content diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index 7f6bbaa6..7d12b249 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -119,16 +119,28 @@ module SiSU_TeX      def song        begin          @md=@particulars.md -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'LaTeX/PDF', +          "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" +        ).green_title_hi unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on)            @env.url.output_tell            if @md.opt.act[:pdf_l][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf" +            ).flow            end            if @md.opt.act[:pdf_p][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf" +            ).flow            end          end          @md=@particulars.md @@ -183,7 +195,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} portrait ->").dark_grey_title_hi +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "#{papersize} portrait ->" +            ).dark_grey_title_hi            end            cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd)            tell.grey_open if @md.opt.cmd =~/[MVv]/ @@ -197,7 +212,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} landscape ->").dark_grey_title_hi +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "#{papersize} landscape ->" +            ).dark_grey_title_hi            end            cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)            if (@md.opt.act[:verbose][:set]==:on \ @@ -253,7 +271,11 @@ module SiSU_TeX          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            @@n_lpdf, +            'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)' +          ).generic_number          end        end        def latexrun_selective @@ -323,7 +345,10 @@ module SiSU_TeX                end              end            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped" +            ).warn            end            lst=Dir["*.{aux,log,out}"]            lst.each {|file| File.unlink(file)} if lst @@ -378,7 +403,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],txt_gen).txt_grey +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              txt_gen +            ).txt_grey            end            if defined? @md.rights.all \            and not @md.rights.all.empty? diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index 4693059d..e9ff0fff 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -499,7 +499,12 @@ module SiSU_TeX_Pdf          @txt.gsub!(/<:=\s*(\S+?)\s*>/,            "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          "ERROR - image:", +          %{"#{image}" missing}, +          "search path: #{dir.path.image_source_include}" +        ).error2 unless @md.opt.act[:quiet][:set]==:on          @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile !        end      end @@ -511,7 +516,8 @@ module SiSU_TeX_Pdf          link,url=link.strip,url.strip          link.gsub!(/&/,"#{Xx[:protect]}&")          url="#{@env.url.root}/" + url -        str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") +        str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m, +          "#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}")        end        while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m          link,url=$1,$2 @@ -642,7 +648,10 @@ module SiSU_TeX_Pdf                hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace                caption=(c ?  "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" : '')              elsif images_hash[ps] =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/m -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @md.opt.act[:quiet][:set]==:on +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                %{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n} +              ).print_grey #unless @md.opt.act[:quiet][:set]==:on                images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]')              end              if image #most images fc etc. #% clean up ! @@ -694,7 +703,12 @@ module SiSU_TeX_Pdf                  end                  images_hash[ps]                else -                SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on +                SiSU_Screen::Ansi.new( +                  @md.opt.act[:color_state][:set], +                  "ERROR - image:", +                  %{"#{image}" missing}, +                  "search locations: #{dir.path.image_source_include_local}, #{dir.path.image_source_include_remote} and #{dir.path.image_source_include}" +                ).error2 unless @md.opt.act[:quiet][:set]==:on                  if images_hash[ps] =~url_image_rgx \                  or images_hash[ps] =~image_rgx                    images_hash[ps]='' @@ -1610,7 +1624,11 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\        sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png")          "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}"        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          'WARNING - image directory or image(s) missing:', +          %{"#{dir.path.image_source_include}"} +        ).warn unless @md.opt.act[:quiet][:set]==:on          " SiSU "        end        url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 98df1cfc..7ca3cc85 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -90,11 +90,23 @@ module SiSU_Txt_AsciiDoc            (@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],'AsciiDoc (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'AsciiDoc (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'AsciiDoc (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'AsciiDoc (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb index 8b081349..69bedbc5 100644 --- a/lib/sisu/v5/txt_markdown.rb +++ b/lib/sisu/v5/txt_markdown.rb @@ -90,11 +90,22 @@ module SiSU_Txt_Markdown            (@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],'Markdown (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Markdown (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Markdown (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Markdown (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns,"#{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index 211e66d9..824d29c8 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -91,11 +91,23 @@ module SiSU_Txt_Plain            (@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],'Plaintext',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Plaintext',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Plaintext', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Plaintext', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb index 8565de5f..c3978b06 100644 --- a/lib/sisu/v5/txt_rst.rb +++ b/lib/sisu/v5/txt_rst.rb @@ -90,11 +90,23 @@ module SiSU_Txt_rST            (@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],'rST (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'rST (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'rST (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'rST (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb index 7b9f10a8..f5962b80 100644 --- a/lib/sisu/v5/txt_textile.rb +++ b/lib/sisu/v5/txt_textile.rb @@ -90,11 +90,23 @@ module SiSU_Txt_Textile            (@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],'Textile (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Textile (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Textile (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Textile (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v5/update.rb b/lib/sisu/v5/update.rb index 3004b0b1..a4b6b2b3 100644 --- a/lib/sisu/v5/update.rb +++ b/lib/sisu/v5/update.rb @@ -74,7 +74,11 @@ module SiSU_UpdateControlFlag          @env=SiSU_Env::InfoEnv.new(@md.fns)          out=@env.path.output          base_path="#{out}/#{@md.fnb}" -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Checking previous output',base_path).green_hi_blue unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          'Checking previous output', +          base_path +        ).green_hi_blue unless @md.opt.act[:quiet][:set]==:on          SetCF.new(@md).set_flags        rescue          SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index 9a828440..cef51ab5 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -144,121 +144,256 @@ module SiSU_Urls      def show        def source          def src(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}" +          ).result          end          def pod(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}" +          ).result          end          self        end        def generic(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}" +        ).result        end        def meta(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}" +        ).result        end        def text(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}" +        ).result        end        def textile(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.textile.dir}/#{@md.file.base_filename.textile}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.textile.dir}/#{@md.file.base_filename.textile}" +        ).result        end        def asciidoc(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.asciidoc.dir}/#{@md.file.base_filename.asciidoc}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.asciidoc.dir}/#{@md.file.base_filename.asciidoc}" +        ).result        end        def markdown(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.markdown.dir}/#{@md.file.base_filename.markdown}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.markdown.dir}/#{@md.file.base_filename.markdown}" +        ).result        end        def rst(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.rst.dir}/#{@md.file.base_filename.rst}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.rst.dir}/#{@md.file.base_filename.rst}" +        ).result        end        def epub(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" +        ).result        end        def html          def scroll(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}" +          ).result          end          def toc(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" +          ).result          end          def concordance(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" +          ).result          end          def manifest(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +          ).result          end          self        end        def qrcode(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +        ).result        end        def odt(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" +        ).result        end        def pdf          def portrait(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf" +          ).result          end          def landscape(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf" +          ).result          end          self        end        def manpage(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" +        ).result        end        def pinfo(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -" +        ).result        end        def po4a          def po(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}" +          ).result          end          def pot(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}" +          ).result          end          self        end        def xhtml(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" +        ).result        end        def xml          def sax(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" +          ).result          end          def dom(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" +          ).result          end          def docbook_book(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}" +          ).result          end          def fictionbook(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}" +          ).result          end          def scaffold_structure_sisu(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}" +          ).result          end          def scaffold_structure_collapse(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_collapse.dir}/#{@md.file.base_filename.xml_scaffold_structure_collapse}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_collapse.dir}/#{@md.file.base_filename.xml_scaffold_structure_collapse}" +          ).result          end          def sitemap(x) #BROKEN -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}" +          ).result          end          self        end        def hash_digest(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" +        ).result        end        def db          def psql(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}", +            y +          ).result          end          def sqlite(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite", +            "sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db" +          ).result          end          def sqlite_discrete(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}" +          ).result          end          self        end @@ -274,13 +409,21 @@ module SiSU_Urls          if x =~/^m/ \          and @opt.cmd=~/m/ \          and x=~/^[#{opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta" +          ).maintenance          end          if x=~/^([hw])/ \          and @opt.cmd=~/[hw]/ \          and x=~/^[#{@opt.cmd}]/ \          and x !~/segmented/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune" +          ).maintenance          end          if x=~/^p/ \          and @opt.cmd=~/p/ \ @@ -289,8 +432,17 @@ module SiSU_Urls            fns=@opt.fns.gsub(/~/,'-')            unless @opt.cmd =~/q/              tell=if x =~/landscape/ -              SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex") -            else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex") +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                "-#{x}", +                "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex" +              ) +            else +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                "-#{x}", +                "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex" +              )              end              tell.maintenance            end @@ -303,25 +455,45 @@ module SiSU_Urls          if x=~/^e/ \          and @opt.cmd=~/e/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml" +          ).maintenance          end          if x=~/^o/ \          and @opt.cmd=~/o/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml" +          ).maintenance          end        end      end      def urls_select        unless @opt.cmd =~/q/ -        i1="[#{@opt.f_pth[:lng_is]}]" -        i2="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +        i1='[' + @opt.f_pth[:lng_is] + ']' +        i2='file://' \ +        + @md.file.output_path.manifest.dir + '/' \ +        + @md.file.base_filename.manifest          (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URLs').green_title_hi -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URL (output manifest)',i1, i2).grey_title_grey_blue -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/ +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'URLs' +          ).green_title_hi +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'URL (output manifest)', +            i1, i2 +          ).grey_title_grey_blue +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          i1, i2, +        ).flow if @opt.cmd =~/[MVv]/        end        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m        @pwd_stub="#{@env.url.output_tell}"[m,1] @@ -486,7 +658,11 @@ module SiSU_Urls      end      def urls_all        i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html" -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URLs',i).grey_title_hi +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'URLs', +        i +      ).grey_title_hi        @u.each do |x,y|          case x          when /^m/ diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 4d30d031..4c732a8b 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -123,7 +123,9 @@ module SiSU_Utils        h      end      def message(msg='') -      @message=(msg.empty?) ? '' : " #{msg}" +      @message=(msg.nil? || msg.empty?) \ +      ? '' +      : ' ' + msg      end      def set(v=nil,x=nil)        v=var(v,x) diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index 04626030..e54b8edd 100644 --- a/lib/sisu/v5/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -86,10 +86,18 @@ module SiSU_Wikispeak          || @opt.act[:maintenance][:set]==:on) \          ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}"          : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Wikispeak',tool).green_hi_blue unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'Wikispeak', +          tool +        ).green_hi_blue unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}" +          ).flow          end          @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here          SiSU_Wikispeak::Source::Scroll.new(@ao_array,@md).songsheet diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index ad6d3f0e..8a7df5f2 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -95,11 +95,23 @@ module SiSU_XHTML            (@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],'XHTML',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XHTML',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XHTML', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XHTML', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" +            ).flow            end          end          SiSU_XHTML::Source::Songsheet.new(@particulars).song @@ -428,8 +440,18 @@ WOK            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on)              unless @md.opt.act[:quiet][:set]==:on -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'Using XML Tidy', +                'check document structure' +              ).colorize +              tell=SiSU_Screen::Ansi.new( +                     @md.opt.act[:color_state][:set], +                     'invert', +                     '', +                     '' +                   )                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 40033101..5f43a9d1 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -100,11 +100,23 @@ module SiSU_XHTML_EPUB2            (@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],'EPUB',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'EPUB',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'EPUB', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'EPUB', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" +            ).flow            end          end          @env.processing_path.epub_bld #(@md) @@ -206,7 +218,10 @@ module SiSU_XHTML_EPUB2          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Toc' +          ).txt_grey          end          toc=nil          @@firstseg=nil @@ -587,7 +602,10 @@ module SiSU_XHTML_EPUB2          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Scroll & Segtoc' +          ).txt_grey          end          format_head_toc=SiSU_XHTML_EPUB2_Format::HeadToc.new(@md)          dochead=format_head_toc.head diff --git a/lib/sisu/v5/xhtml_epub2_concordance.rb b/lib/sisu/v5/xhtml_epub2_concordance.rb index 6d7c4758..cb498d0f 100644 --- a/lib/sisu/v5/xhtml_epub2_concordance.rb +++ b/lib/sisu/v5/xhtml_epub2_concordance.rb @@ -83,10 +83,16 @@ module SiSU_XHTML_EPUB2_Concordance            if @md.wc_words < wordmax              SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})" +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words" +          ).warn unless @md.opt.act[:quiet][:set]==:on            SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet          end        rescue diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb index 3c3b3263..917a4f92 100644 --- a/lib/sisu/v5/xhtml_epub2_segments.rb +++ b/lib/sisu/v5/xhtml_epub2_segments.rb @@ -178,7 +178,10 @@ WOK        if (@md.opt.act[:verbose][:set]==:on \        || @md.opt.act[:verbose_plus][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on) -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length) +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          @@seg_name.length +        )        end        SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob| diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb index 82f90366..db234a19 100644 --- a/lib/sisu/v5/xhtml_epub2_tune.rb +++ b/lib/sisu/v5/xhtml_epub2_tune.rb @@ -126,7 +126,10 @@ module SiSU_XHTML_EPUB2_Tune          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Tune' +          ).txt_grey          end          data=SiSU_XHTML_EPUB2_Tune::Tune.new(@data,@md).amp_angle_brackets          data=SiSU_XHTML_EPUB2_Tune::Tune.new(data,@md).endnotes_html diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 62b8845c..829f35be 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -102,11 +102,23 @@ module SiSU_XML_Docbook_Book          (@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],'DocBook',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'DocBook',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'DocBook', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'DocBook', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}" +          ).flow          end        end      end diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index a1b316ac..f06aea53 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -96,11 +96,23 @@ module SiSU_XML_DOM            (@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],'XML DOM',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML DOM',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML DOM', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML DOM', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" +            ).flow            end          end          SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet @@ -545,8 +557,18 @@ WOK          if @prog.tidy !=false            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on -            tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              'invert', +              'Using XML Tidy', +              'check document structure' +            ).colorize unless @md.opt.act[:quiet][:set]==:on +            tell=SiSU_Screen::Ansi.new( +                   @md.opt.act[:color_state][:set], +                   'invert', +                   '', +                   '' +                 )              tell.grey_open unless @md.opt.act[:quiet][:set]==:on              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy=SiSU_Env::SystemCall.new(@file,tidyfile) diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb index f890b329..35bccc71 100644 --- a/lib/sisu/v5/xml_fictionbook2.rb +++ b/lib/sisu/v5/xml_fictionbook2.rb @@ -99,11 +99,23 @@ module SiSU_XML_Fictionbook          (@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],'Fictionbook',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Fictionbook',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Fictionbook', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Fictionbook', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}" +          ).flow          end        end      end diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index e05fc9f7..9bcb29d6 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -96,11 +96,23 @@ module SiSU_XML_ODF_ODT            (@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],'Opendocument (ODF:ODT)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Opendocument (ODF:ODT)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Opendocument (ODF:ODT)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Opendocument (ODF:ODT)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" +            ).flow            end          end          SiSU_XML_ODF_ODT::Source::Scroll.new(@particulars).songsheet @@ -236,7 +248,12 @@ module SiSU_XML_ODF_ODT            if FileTest.file?("#{img_src}/#{i}")              img_src            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          elsif @md.fns =~/\.ss[tm]$/ \ @@ -249,7 +266,12 @@ module SiSU_XML_ODF_ODT          and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")            @env.path.image_source_include_remote          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        end diff --git a/lib/sisu/v5/xml_sax.rb b/lib/sisu/v5/xml_sax.rb index 69a5962d..58ac50da 100644 --- a/lib/sisu/v5/xml_sax.rb +++ b/lib/sisu/v5/xml_sax.rb @@ -95,11 +95,23 @@ module SiSU_XML_SAX            (@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],'XML SAX',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML SAX',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML SAX', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML SAX', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" +            ).flow            end          end          SiSU_XML_SAX::Source::Songsheet.new(@particulars).song @@ -469,8 +481,18 @@ WOK            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on)              unless @md.opt.act[:quiet][:set]==:on -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'Using XML Tidy', +                'check document structure' +              ).colorize +              tell=SiSU_Screen::Ansi.new( +                     @md.opt.act[:color_state][:set], +                     'invert', +                     '', +                     '' +                 )                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v5/zap.rb b/lib/sisu/v5/zap.rb index 85f023a0..94a9e196 100644 --- a/lib/sisu/v5/zap.rb +++ b/lib/sisu/v5/zap.rb @@ -73,13 +73,20 @@ module SiSU_Zap        z=SiSU_Env::CleanOutput.new(@opt)        if SiSU_Env::InfoSettings.new.permission?('zap')          unless @opt.act[:quiet][:set]==:on -          tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{zap_path}") +          tell=SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "Clean files related to processing #{@opt.cmd} ->", +            "#{@opt.fns} -> #{zap_path}" +          )            tell.warn          end          z.zap.remove_output        else          unless @opt.act[:quiet][:set]==:on -          tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'use of -Z (zap) has not enabled in sisurc.yml') +          tell=SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'use of -Z (zap) has not enabled in sisurc.yml' +          )            tell.warn          end        end diff --git a/lib/sisu/v6/db_columns.rb b/lib/sisu/v6/db_columns.rb index 8dd14ddb..f7db347e 100644 --- a/lib/sisu/v6/db_columns.rb +++ b/lib/sisu/v6/db_columns.rb @@ -69,8 +69,11 @@ module SiSU_DbColumns        @md=md        @db=SiSU_Env::InfoDb.new #watch        @lang ||=SiSU_i18n::Languages.new -      if defined? md.opt.mod \ -      and md.opt.mod.inspect=~/import|update/ \ +      if defined? md.opt.act \ +      and ((md.opt.act[:psql_import][:set]==:on \ +      || md.opt.act[:psql_update][:set]==:on) \ +      or (md.opt.act[:sqlite_import][:set]==:on \ +      || md.opt.act[:sqlite_update][:set]==:on)) \        and FileTest.exist?(md.fns)          txt_arr=IO.readlines(md.fns,'')          src=txt_arr.join("\n") @@ -1920,7 +1923,10 @@ module SiSU_DbColumns             IS 'sisu markup source text (if shared)';}          end          def tuple -          if @md.opt.mod.inspect=~/import|update/ \ +          if ((@md.opt.act[:psql_import][:set]==:on \ +          || @md.opt.act[:psql_update][:set]==:on) \ +          or (@md.opt.act[:sqlite_import][:set]==:on \ +          || @md.opt.act[:sqlite_update][:set]==:on)) \            and FileTest.exist?(@md.fns)              ["#{name}, ","'#{@sisutxt}', "]            else ['',''] @@ -1944,7 +1950,10 @@ module SiSU_DbColumns              IS 'document full text clean, searchable';}          end          def tuple -          if @md.opt.mod.inspect=~/import|update/ \ +          if ((@md.opt.act[:psql_import][:set]==:on \ +          || @md.opt.act[:psql_update][:set]==:on) \ +          or (@md.opt.act[:sqlite_import][:set]==:on \ +          || @md.opt.act[:sqlite_update][:set]==:on)) \            and  FileTest.exist?(@md.fns)              ["#{name}, ","'#{@fulltext}', "]            else ['',''] diff --git a/lib/sisu/v6/db_create.rb b/lib/sisu/v6/db_create.rb index a2e3e8c4..e9e6aa40 100644 --- a/lib/sisu/v6/db_create.rb +++ b/lib/sisu/v6/db_create.rb @@ -85,8 +85,16 @@ module SiSU_DbCreate      def create_db        @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.base_markup_dir_stub}"}) +      ? 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.base_markup_dir_stub}"} +        )        if (@opt.act[:verbose][:set]==:on \        || @opt.act[:verbose_plus][:set]==:on \        || @opt.act[:maintenance][:set]==:on) @@ -96,7 +104,7 @@ module SiSU_DbCreate      end      def output_dir?        dir=SiSU_Env::InfoEnv.new('') -      if @opt.cmd =~/d/ +      if @opt.act[:sqlite][:set]==:on          dir.path.webserv_stub_ensure        end      end diff --git a/lib/sisu/v6/db_dbi.rb b/lib/sisu/v6/db_dbi.rb index 6e5f125d..c3160877 100644 --- a/lib/sisu/v6/db_dbi.rb +++ b/lib/sisu/v6/db_dbi.rb @@ -91,7 +91,7 @@ module  SiSU_DbDBI    end    class LoadUrls <SiSU_DbTuple::LoadUrls                                    # db_update urls    end -  class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize                  # db_import.rb +  class Import <SiSU_DbImport::Import #<SiSU_DB::ColumnSize                 # db_import.rb    end  end  __END__ diff --git a/lib/sisu/v6/db_drop.rb b/lib/sisu/v6/db_drop.rb index 926da47f..e93d2889 100644 --- a/lib/sisu/v6/db_drop.rb +++ b/lib/sisu/v6/db_drop.rb @@ -206,7 +206,7 @@ module SiSU_DbDrop          self        end        indexes.base -      @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : indexes.text) +      @opt.act[:psql][:set]==:on ? '' : indexes.text        self      end    end diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb index 35fb631a..f3e8b96c 100644 --- a/lib/sisu/v6/db_import.rb +++ b/lib/sisu/v6/db_import.rb @@ -91,7 +91,9 @@ module SiSU_DbImport        @counter={}        @db=SiSU_Env::InfoDb.new        if @sql_type==:sqlite -        @driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ +        @driver_sqlite3= +        (@conn.inspect.match(/^(.{10})/)[1] \ +        == @db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \          ? true          : false        end @@ -100,7 +102,7 @@ module SiSU_DbImport          @col[:lid] ||=0          @col[:lid]=@driver_sqlite3 \          ? @conn.execute( sql ).join.to_i -        : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } +        : @conn.exec( sql ).getvalue(0,0).to_i        rescue          puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on        end @@ -109,7 +111,7 @@ module SiSU_DbImport        begin          @id_n=@driver_sqlite3 \          ? @conn.execute( sql ).join.to_i -        : @id_n=@conn.exec( sql ).getvalue(0,0).to_i +        : @conn.exec( sql ).getvalue(0,0).to_i          @id_n ||=0        rescue          puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on @@ -126,9 +128,16 @@ module SiSU_DbImport        if (@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],"#{@db.psql.db}::#{@opt.fns}").puts_blue +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "#{@db.psql.db}::#{@opt.fns}" +        ).puts_blue        end -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Marshal Load',@fnc).puts_grey if @opt.act[:verbose][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Marshal Load', +        @fnc +      ).puts_grey if @opt.act[:verbose][:set]==:on  #%        select_first_match=%{          SELECT metadata_and_text.tid @@ -172,22 +181,6 @@ module SiSU_DbImport                end              @conn.exec("COMMIT")            end -        rescue DBI::DatabaseError => e -          STDERR.puts "Error code: #{e.err}" -          STDERR.puts "Error message: #{e.errstr}" -          STDERR.puts "Error SQLSTATE: #{e.state}" -          SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do -            __LINE__.to_s + ':' + __FILE__ -          end -          sqlfn="#{@env.processing_path.sql}/#{@md.fnb}.sql" -          sql=File.new(sqlfn,'w') -          t_d.each {|i| sql.puts i} -          p sqlfn -          if @opt.act[:maintenance][:set]==:on -            puts sql -            p @conn.methods.sort -            puts "#{__FILE__}:#{__LINE__}" -          end          rescue            SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do              __LINE__.to_s + ':' + __FILE__ @@ -261,11 +254,9 @@ module SiSU_DbImport          sql='SELECT MAX(tid) FROM metadata_and_text;'          begin            @@id_t ||=0 -          id_t=if @driver_sqlite3 -            @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i } -          else -            @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } -          end +          id_t=@driver_sqlite3 \ +          ? @conn.execute( sql ).join.to_i # { |x| id_t=x.join.to_i } +          : @conn.exec( sql ).getvalue(0,0).to_i            @@id_t=id_t if id_t          rescue            puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on diff --git a/lib/sisu/v6/db_indexes.rb b/lib/sisu/v6/db_indexes.rb index 7df20889..876fd856 100644 --- a/lib/sisu/v6/db_indexes.rb +++ b/lib/sisu/v6/db_indexes.rb @@ -132,7 +132,7 @@ module SiSU_DbIndex          conn_execute_array(sql_arr)        end        base -      @opt.cmd=~/D/ || ((@opt.mod=~/psql/) ? '' : text) +      @opt.act[:psql][:set]==:on ? '' : text      end    end  end diff --git a/lib/sisu/v6/db_remove.rb b/lib/sisu/v6/db_remove.rb index b1628030..037dda33 100644 --- a/lib/sisu/v6/db_remove.rb +++ b/lib/sisu/v6/db_remove.rb @@ -128,7 +128,10 @@ module SiSU_DbRemove          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey +          SiSU_Screen::Ansi.new( +            @opt.cmd, +            "no such file in database #{@db.psql.db}::#{@opt.fns}" +          ).puts_grey          end        end      end diff --git a/lib/sisu/v6/db_select.rb b/lib/sisu/v6/db_select.rb index 9a2c2eb0..61522e3b 100644 --- a/lib/sisu/v6/db_select.rb +++ b/lib/sisu/v6/db_select.rb @@ -67,40 +67,65 @@ module SiSU_DbSelect        @opt,@conn,@sql_type=opt,conn,sql_type        @db=SiSU_Env::InfoDb.new        @file_maint=sql_maintenance_file -      @sdb=SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type)      # db_dbi.rb -      @sdb_index=SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type) # db_dbi.rb -      @sdb_no=SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type)       # db_dbi.rb -      if @opt.mod.inspect =~/update|import/ -        @sdb_import=SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type) -        @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) -      elsif @opt.mod.inspect =~/remove/ -        @sdb_remove_doc=SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) +      @sdb= +        SiSU_DbDBI::Create.new(@opt,@conn,@file_maint,@sql_type) +      @sdb_index= +        SiSU_DbDBI::Index.new(@opt,@conn,@file_maint,@sql_type) +      @sdb_no= +        SiSU_DbDBI::Drop.new(@opt,@conn,@db,@sql_type) +      if (@opt.act[:psql_import][:set]==:on \ +      || @opt.act[:psql_update][:set]==:on) \ +      or (@opt.act[:sqlite_import][:set]==:on \ +      || @opt.act[:sqlite_update][:set]==:on) +        @sdb_import= +          SiSU_DbDBI::Import.new(@opt,@conn,@file_maint,@sql_type) +        @sdb_remove_doc= +          SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type) +      elsif (@opt.act[:psql_remove][:set]==:on \ +      or @opt.act[:sqlite_remove][:set]==:on) +        @sdb_remove_doc= +          SiSU_DbDBI::Remove.new(@opt,@conn,@file_maint,@sql_type)        end      end      def db_exist?        if @sql_type==:sqlite \ -      and (not (FileTest.file?(@db.sqlite.db)) or FileTest.zero?(@db.sqlite.db)) -        puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?} +      and (not (FileTest.file?(@db.sqlite.db)) \ +      or FileTest.zero?(@db.sqlite.db)) +        puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +        + %{    sisu --#{@sql_type} --createall\n} \ +        + %{  before attempting to populate the database}          exit        end        if @conn.is_a?(NilClass) -        db=@sql_type==:sqlite \ -        ? @db.sqlite.db -        : @db.psql.db -        puts %{no connection with #{@sql_type} database established, createdb "#{db}"?} +        db=if @sql_type==:sqlite +          puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +          + %{    sisu --#{@sql_type} --createall\n} \ +          + %{  before attempting to populate the database} +          @db.sqlite.db +        else +          puts %{no connection with #{@sql_type} database established, you may need to run:\n} \ +          + %{    createdb "#{@db.psql.db}"\n} \ +          + %{  after that don't forget to run:\n} \ +          + %{    sisu --#{@sql_type} --createall\n} \ +          + %{  before attempting to populate the database} +          @db.psql.db +        end          exit        end      end      def sql_maintenance_file -      file=if @opt.inspect =~/M/ +      file=if @opt.act[:maintenance][:set]==:on          if @opt.fns and not @opt.fns.empty?            @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns -          puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on +          if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on +            puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" +          end            @db=SiSU_Env::InfoDb.new            @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql"            File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+')          elsif @opt.fns \ -        and @opt.fns.inspect =~/create/ +        and (@opt.act[:sqlite_create][:set] ==:on \ +        || @opt.act[:psql_create][:set] ==:on)            nil #sort variations later          else nil          end @@ -108,116 +133,88 @@ module SiSU_DbSelect        end        file      end -    def cases -      @opt.mod.each do |mod| -        case mod -        when /^--createdb$/ -          @sdb.output_dir? -          begin -            @sdb.create_db -          rescue; @sdb.output_dir? -          end -        when /^--(?:init(?:ialize)?|create(?:all)?)$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue -            SiSU_Errors::Rescued.new($!,$@,'-D').location; @sdb.output_dir? do -              __LINE__.to_s + ':' + __FILE__ -            end -          end -        when /^--createtables?$/ +    def db_action +      def createdb +        @sdb.output_dir? +        begin +          @sdb.create_db +        rescue            @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue; @sdb.output_dir? -          end -        when /^--recreate$/ -          @sdb.output_dir? -          begin -            @sdb_no.drop.tables -            @sdb.create_table.metadata_and_text -            @sdb.create_table.doc_objects -            @sdb.create_table.endnotes -            @sdb.create_table.endnotes_asterisk -            @sdb.create_table.endnotes_plus -            @sdb.create_table.urls -            @sdb_index.create_indexes -          rescue; @sdb.output_dir? -          end -        when /^--cr(eate)?lex$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.doc_objects -          rescue; @sdb.output_dir? -          end -        when /^--cr(eate)?metadata$/ -          @sdb.output_dir? -          begin -            @sdb.create_table.metadata_and_text -          rescue; @sdb.output_dir? -          end -        when /^--import$/ -          db_exist? -          @sdb_import.marshal_load -          tell=case @sql_type -          when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") -          when :pg     then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") -          else '???' -          end -          tell.puts_grey if @opt.act[:verbose][:set]==:on -        when /^--update$/ -          db_exist? -          @sdb_remove_doc.remove -          @sdb_import.marshal_load -          tell=case @sql_type -          when :sqlite then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") -          when :pg     then SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") -          else '???' -          end -          tell.puts_grey if @opt.act[:verbose][:set]==:on -        when /^--remove$/ -          db_exist? -          @sdb_remove_doc.remove -        when /^--index$/ -          db_exist? +        end +      end +      def drop +        @sdb_no.drop.tables +      end +      def create +        @sdb.output_dir? +        begin +          @sdb.create_table.metadata_and_text +          @sdb.create_table.doc_objects +          @sdb.create_table.endnotes +          @sdb.create_table.endnotes_asterisk +          @sdb.create_table.endnotes_plus +          @sdb.create_table.urls            @sdb_index.create_indexes -        when /^--droptable(s)?$/ -          db_exist? -          @sdb_no.drop.tables -        when /^--dropindex(es)?$/ -          db_exist? -          @sdb_no.drop.indexes -        when /^--(?:dropall|drop)$/ -          db_exist? -          @sdb_no.drop.tables -        when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/ -        when /^--(?:v\d+|dev)$/ -        else +        rescue +          SiSU_Errors::Rescued.new($!,$@,'--sqlite').location +          @sdb.output_dir? do +            __LINE__.to_s + ':' + __FILE__ +          end          end -        if @opt.act[:maintenance][:set]==:on \ -        and @opt.cmd  =~/d/ -          puts @job +      end +      def import +        db_exist? +        @sdb_import.marshal_load +        tell=case @sql_type +        when :sqlite +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "sqlite3 #{@db.sqlite.db} database?" +          ) +        when :pg +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "pgaccess or psql #{@db.psql.db} database?" +          ) +        else '???'          end +        tell.puts_grey if @opt.act[:verbose][:set]==:on +      end +      def remove +        db_exist? +        @sdb_remove_doc.remove        end -      if @opt.act[:psql][:set]==:on \ -      and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/ -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"--pg requires further instruction").warn unless @opt.act[:quiet][:set]==:on +      def update +        remove +        import        end -      begin -      rescue; @sdb.output_dir? +      self +    end +    def cases +      if @opt.act[:psql_drop][:set] ==:on \ +      or @opt.act[:sqlite_drop][:set] ==:on +        db_action.drop +      end +      if @opt.act[:psql_createdb][:set] ==:on \ +      or @opt.act[:sqlite_createdb][:set] ==:on +        db_action.createdb +      end +      if @opt.act[:psql_create][:set] ==:on \ +      or @opt.act[:sqlite_create][:set] ==:on +        db_action.create +      end +      if @opt.act[:psql_update][:set] ==:on \ +      or @opt.act[:sqlite_update][:set] ==:on +        db_action.update +      else +        if @opt.act[:psql_remove][:set] ==:on \ +        or @opt.act[:sqlite_remove][:set] ==:on +          db_action.remove +        end +        if @opt.act[:psql_import][:set] ==:on \ +        or @opt.act[:sqlite_import][:set] ==:on +          db_action.import +        end        end      end    end diff --git a/lib/sisu/v6/db_sqltxt.rb b/lib/sisu/v6/db_sqltxt.rb index 1beaa321..1037d03b 100644 --- a/lib/sisu/v6/db_sqltxt.rb +++ b/lib/sisu/v6/db_sqltxt.rb @@ -84,14 +84,22 @@ module SiSU_DbText            and not @md.creator.author.empty?              s=s.gsub(/@author/,@md.creator.author)            else -            SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              'v', +              'WARNING Document Author information missing; provide @creator: :author:', +              @md.fnb +            ).warn unless @md.opt.act[:quiet][:set]==:on            end            if defined? @md.title \            and defined? @md.title.full \            and not @md.title.full.empty?              s=s.gsub(/@title/,@md.title.full)            else -            SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              'v', +              'WARNING Document Title missing; provide @title:', +              @md.fnb +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          end          s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,''). diff --git a/lib/sisu/v6/dbi.rb b/lib/sisu/v6/dbi.rb index 7432f2f3..5880aa1a 100644 --- a/lib/sisu/v6/dbi.rb +++ b/lib/sisu/v6/dbi.rb @@ -73,22 +73,18 @@ module  SiSU_DBI      def initialize(opt)        @opt=opt        @db=SiSU_Env::InfoDb.new -      if @opt.cmd =~/[Dd]/ \ -      or  @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ -        @sql_type=if @opt.cmd=~/D/ \ -        or @opt.mod.inspect =~/--pg(?:sql)?/ +      if @opt.act[:psql][:set]==:on \ +      or @opt.act[:sqlite][:set]==:on +        @sql_type=if @opt.act[:psql][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :pg -        elsif @opt.cmd =~/d/ \ -        and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ +        elsif @opt.act[:psql][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :pg -        elsif @opt.cmd=~/d/ \ -        or @opt.mod.inspect =~/--(?:sq)?lite/ +        elsif @opt.act[:sqlite][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :sqlite -        elsif @opt.cmd =~/d/ \ -        and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ +        elsif @opt.act[:sqlite][:set]==:on            maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on            :sqlite          else @@ -110,7 +106,7 @@ module  SiSU_DBI          require 'pg'          @conn=@db.psql.conn_pg        rescue -        if @opt.mod.inspect=~/--(?:createall|create)/ +        if @opt.act[:psql_create][:set]==:on            cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX            puts <<-WOK  manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet exist @@ -136,7 +132,11 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet        when :pg     then read_psql #read_pg        when :sqlite then read_sqlite        end -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "DBI (#{@sql_type}) #{@opt.mod}", +        @opt.fno +      ).dbi_title unless @opt.act[:quiet][:set]==:on        begin          SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases        rescue diff --git a/lib/sisu/v6/dbi_discrete.rb b/lib/sisu/v6/dbi_discrete.rb index 0f534e42..9e83009e 100644 --- a/lib/sisu/v6/dbi_discrete.rb +++ b/lib/sisu/v6/dbi_discrete.rb @@ -81,8 +81,7 @@ module  SiSU_DBI_Discrete                               #% database building        @opt=opt        @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)        @md=@particulars.md -      if @opt.cmd =~/[d]/ \ -      or  @opt.mod.inspect =~/--((?:sq)?lite)/ +      if @opt.act[:sqlite][:set]==:on          @sql_type=:sqlite          maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on        end @@ -96,8 +95,8 @@ module  SiSU_DBI_Discrete                               #% database building        create_and_populate      end      def maintenance_check(opt,file,line) -      p opt.mod -      p opt.cmd +      #p opt.mod +      #p opt.cmd        p "at #{file} #{line}"      end      def prepare @@ -126,7 +125,11 @@ module  SiSU_DBI_Discrete                               #% database building        sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,:sqlite)        sdb.output_dir?        begin -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'SQLite', +          "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" +        ).green_title_hi unless @opt.act[:quiet][:set]==:on          sdb.create_db          sdb.create_table.metadata_and_text          sdb.create_table.doc_objects @@ -138,7 +141,10 @@ module  SiSU_DBI_Discrete                               #% database building          db_exist?(db,conn)          sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file_maint,:sqlite)          sdb_import.marshal_load -        tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{db.sqlite.db} database?") +        tell=SiSU_Screen::Ansi.new( +               @opt.act[:color_state][:set], +               "sqlite3 #{db.sqlite.db} database?" +             )          tell.puts_grey if @opt.act[:verbose][:set]==:on        rescue          SiSU_Errors::Rescued.new($!,$@,'-d').location do @@ -159,7 +165,11 @@ module  SiSU_DBI_Discrete                               #% database building      end      def connect        begin -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "DBI (#{@sql_type}) #{@opt.mod}", +          @opt.fns +        ).dbi_title unless @opt.act[:quiet][:set]==:on          @db.sqlite_discrete.conn_sqlite3        rescue          SiSU_Errors::Rescued.new($!,$@,@cf,@opt.fns).location do diff --git a/lib/sisu/v6/digests.rb b/lib/sisu/v6/digests.rb index 7e5e42ab..c7a6d3c1 100644 --- a/lib/sisu/v6/digests.rb +++ b/lib/sisu/v6/digests.rb @@ -86,11 +86,23 @@ module SiSU_DigestView            (@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],"Document #{@dg} Digests",tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Document #{@dg} Digests",tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Document #{@dg} Digests", +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Document #{@dg} Digests", +              tool +            ).green_title_hi            if @opt.act[:verbose_plus][:set]==:on \            or @opt.act[:maintenance][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" +            ).flow            end          end          if SiSU_Env::SystemCall.new.openssl diff --git a/lib/sisu/v6/git.rb b/lib/sisu/v6/git.rb index fbcfcf57..d58ae566 100644 --- a/lib/sisu/v6/git.rb +++ b/lib/sisu/v6/git.rb @@ -112,12 +112,24 @@ module SiSU_Git          (@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],'Git path',@git_path[:fnb]).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Git path',@git_path[:fnb]).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Git path', +            @git_path[:fnb] +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Git path', +            @git_path[:fnb] +          ).green_title_hi          if (@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],"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "Git path", +            "#{@opt.fns} -> #{@git_path[:fnb]}" +          ).warn          end        end      end diff --git a/lib/sisu/v6/harvest_authors.rb b/lib/sisu/v6/harvest_authors.rb index 4bbd1351..c84634b5 100644 --- a/lib/sisu/v6/harvest_authors.rb +++ b/lib/sisu/v6/harvest_authors.rb @@ -202,7 +202,11 @@ module SiSU_HarvestAuthors          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          ? ("file://#{file}") : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest authors (#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "harvest authors (#{@opt.files.length} files)", +          fileinfo +        ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on          @output[lng][:html]=File.new(file,'w')        end      end diff --git a/lib/sisu/v6/harvest_topics.rb b/lib/sisu/v6/harvest_topics.rb index c682bd37..e17b8424 100644 --- a/lib/sisu/v6/harvest_topics.rb +++ b/lib/sisu/v6/harvest_topics.rb @@ -486,7 +486,11 @@ module SiSU_HarvestTopics          || @opt.act[:maintenance][:set]==:on) \          ? ("file://#{file}")          : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest topics(#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "harvest topics(#{@opt.files.length} files)", +          fileinfo +        ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on          @output[lng][:html]=File.new(file,'w')          if @opt.act[:maintenance][:set]==:on            @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 789f2b1c..1e2a51e6 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -110,11 +110,23 @@ module SiSU_HTML            (@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],'HTML',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'HTML',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'HTML', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'HTML', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{primary_output_file}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{primary_output_file}" +            ).flow            end          end          data=nil @@ -253,7 +265,10 @@ module SiSU_HTML          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Toc' +          ).txt_grey          end          toc=nil          @@firstseg=nil @@ -592,7 +607,10 @@ WOK          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Scroll & Segtoc' +          ).txt_grey          end          format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)          dochead=format_head_toc.head diff --git a/lib/sisu/v6/html_concordance.rb b/lib/sisu/v6/html_concordance.rb index 5747deea..0a927998 100644 --- a/lib/sisu/v6/html_concordance.rb +++ b/lib/sisu/v6/html_concordance.rb @@ -89,18 +89,32 @@ module SiSU_Concordance            (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) \ -          ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Concordance",tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Concordance',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "Concordance", +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Concordance', +              tool +            ).green_title_hi          end          wordmax=@env.concord_max          unless @md.wc_words.nil?            if @md.wc_words < wordmax              SiSU_Concordance::Source::Words.new(@particulars).songsheet            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})" +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words" +          ).warn unless @md.opt.act[:quiet][:set]==:on            SiSU_Concordance::Source::Words.new(@particulars).songsheet          end        rescue @@ -373,7 +387,11 @@ WOK          @file_concordance << %{</div></body>\n</html>} # footer          if @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            @md.fns, +            "#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" +          ).flow          end        end      end diff --git a/lib/sisu/v6/html_lite_shared.rb b/lib/sisu/v6/html_lite_shared.rb index 88510f04..7ae17350 100644 --- a/lib/sisu/v6/html_lite_shared.rb +++ b/lib/sisu/v6/html_lite_shared.rb @@ -126,7 +126,14 @@ module SiSU_FormatShared                u=u.gsub(/^\.\.\//,'')                "#{@env.url.root}/#{u}"              else -              "#{@env.url.root}/#{@md.fnb}/#{map_nametags[u][:segname]}#{Sfx[:html]}##{u}" +              if not map_nametags[u].nil? +                @env.url.root + '/' \ +                + @md.fnb + '/' \ +                + map_nametags[u][:segname] \ +                + Sfx[:html] \ +                + '#' + u +              else '' +              end              end              link=m[/(.+)/m]              png=m.scan(/\S+/)[0].strip diff --git a/lib/sisu/v6/html_promo.rb b/lib/sisu/v6/html_promo.rb index c1949aa2..e2832d3c 100644 --- a/lib/sisu/v6/html_promo.rb +++ b/lib/sisu/v6/html_promo.rb @@ -417,7 +417,10 @@ WOK            end          end        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* category not found: #{category}").warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          "*WARN* category not found: #{category}" +        ).warn unless @md.opt.act[:quiet][:set]==:on        end        adverts.join      end diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb index 0ba5f688..d3f96a50 100644 --- a/lib/sisu/v6/html_segments.rb +++ b/lib/sisu/v6/html_segments.rb @@ -210,7 +210,10 @@ module SiSU_HTML_Seg        if (@md.opt.act[:verbose][:set]==:on \        || @md.opt.act[:verbose_plus][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on) -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length).segmented +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          @@seg_name.length +        ).segmented        end        map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob| diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 7508dcbc..e061ee46 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -93,6 +93,22 @@ module SiSU        end      end    end +  class HubClose +    def initialize(call_path) +      begin +        @env=SiSU_Env::InfoEnv.new +      rescue +      ensure +        if FileTest.directory?(@env.processing_path.processing) \ +        and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ +          FileUtils::cd(@env.processing_path.processing_base_tmp) do +            FileUtils::rm_rf('.') +          end +        end +        Dir.chdir(call_path) +      end +    end +  end    class OptionLoopFiles      attr_reader :opt      def initialize(opt) @@ -111,6 +127,7 @@ module SiSU          @opt.pth=@opt.f_pths[i][:pth]          @opt.lng=@opt.f_pths[i][:lng]          Dir.chdir(@opt.f_pth[:pth]) #watch +        SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track          @env=SiSU_Env::InfoEnv.new(fno)          yield        end @@ -612,20 +629,12 @@ module SiSU          path[:xsd]=path[:xml] + '/rng'          re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/          unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line -        # unless ( FileTest.directory?(path[:css]) \ -        # and FileTest.directory?(path[:xsd]) ) -        #   @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX -        # end            if @opt.act[:maintenance][:set] ==:on              $VERBOSE=false                               #debug $VERBOSE=true            end          end          re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/          unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line -        # unless ( FileTest.directory?(path[:css]) \ -        # and FileTest.directory?(path[:xsd]) ) -        #   @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX -        # end            if @opt.act[:maintenance][:set] ==:on              $VERBOSE=false                               #debug $VERBOSE=true            end @@ -792,8 +801,10 @@ module SiSU            and @@env.user \            and FileTest.directory?(@@env.processing_path.processing) \            and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area -            FileUtils::cd(@@env.processing_path.processing_base_tmp) do -              FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on +            if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ +              FileUtils::cd(@@env.processing_path.processing_base_tmp) do +                FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on +              end              end            end          elsif action_on_file_ == :true \ diff --git a/lib/sisu/v6/manifest.rb b/lib/sisu/v6/manifest.rb index 7f90636b..f426028c 100644 --- a/lib/sisu/v6/manifest.rb +++ b/lib/sisu/v6/manifest.rb @@ -88,15 +88,29 @@ module SiSU_Manifest          browser=@env.program.console_web_browser  #       webserv_url=@env.path.url.output_tell #fix in sysenv          unless @opt.act[:quiet][:set]==:on -          url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +          url_html='file://' \ +          + @md.file.output_path.manifest.dir + '/' \ +          + @md.file.base_filename.manifest            (@opt.act[:verbose][:set]==:on \            || @opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) \ -          ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest',"#{xbrowser} #{url_html}").green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Manifest', +              "#{xbrowser} #{url_html}" +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Manifest', +              "[#{@opt.f_pth[:lng_is]}]", +              "#{url_html}" +            ).grey_title_grey_blue            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{browser} #{url_html}").grey_tab +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "#{browser} #{url_html}" +            ).grey_tab            end          end          data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -177,12 +191,20 @@ module SiSU_Manifest          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{dgst[1]} #{file}").warn +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "#{dgst[1]} #{file}" +          ).warn          end          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]          @manifest[:txt] << "#{file} #{id} #{kb}\n" -        @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}#{url_make(url,file,:src)}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/ +        @manifest[:html] << %{<tr>} \ +        + %{<th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th>} \ +        + %{<td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a>   #{dgst[1]}#{url_make(url,file,:src)}</p></td>} \ +        + %{<td class="right"><p class="right">#{kb}</p></td>} \ +        + %{</tr>\n} \ +          if kb and kb =~/\d+/        end        def published_manifests?          @f=SiSU_Env::FileOp.new(@md) #.base_filename diff --git a/lib/sisu/v6/manpage.rb b/lib/sisu/v6/manpage.rb index deb85f39..4a0c978d 100644 --- a/lib/sisu/v6/manpage.rb +++ b/lib/sisu/v6/manpage.rb @@ -95,11 +95,23 @@ module SiSU_Manpage          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          && @opt.cmd !~/q/ \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Manpage', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Manpage', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" +          ).flow          end          @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here          SiSU_Manpage::Source::Scroll.new(@md,@ao_array).songsheet @@ -337,7 +349,7 @@ WOK                paranum=dob.obj[@regx,3]                @p_num=SiSU_ManpageFormat::ParagraphNumber.new(paranum)              end -            x=SiSU_ManpageFormat::FormatTextObject.new(@md,dob) +            SiSU_ManpageFormat::FormatTextObject.new(@md,dob) #check              if dob.is==:heading                manpage_structure(dob)              elsif dob.is==:para diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index 104243a3..c71372e0 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -70,7 +70,7 @@ module SiSU_Commandline    require_relative 'sysenv'                             # sysenv.rb    require_relative 'param_make'                         # param_make.rb    class HeaderCommon -    def sisu_document_make_instructions +    def sisu_document_make_instructions(make_instruct_array=:nil)        @pagenew=          @pagebreak=          @pageline= @@ -87,7 +87,9 @@ module SiSU_Commandline          @home_button_links=          @links=          nil -      make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read +      make_instruct_array=make_instruct_array==:nil \ +      ? SiSU_Env::GetInit.new.sisu_document_make.makefile_read +      : make_instruct_array        @makeset=false        if make_instruct_array          make_instruct_array.each do |para|                                     #% scan document @@ -282,7 +284,10 @@ module SiSU_Commandline          end          if @cmd =~/[vVM]/ \          && @cmd !~/-[ku]*v[ku]*$/ -          SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown +          SiSU_Screen::Ansi.new( +            @cmd, +            "\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n" +          ).print_brown          end        end        @@act ? @act=@@act : @@act=@act=opt_act @@ -331,7 +336,7 @@ module SiSU_Commandline              pod_make_path=fullname + '/sisupod/doc/_sisu'              make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)              @make_instructions_pod= -              HeaderCommon.new(make_instruct_array).sisu_document_make_instructions +              HeaderCommon.new.sisu_document_make_instructions(make_instruct_array)              Dir.chdir(pt.realpath)              system("                chdir #{fullname} @@ -532,6 +537,7 @@ module SiSU_Commandline              mod << s            when /^--(?:epub)$/                                                       then c=c+'e'            when /^--(?:od[ft])$/                                                     then c=c+'o' +          when /^--docbook$/                                                     then c=c+'d'            when /^--(?:pdf)$/                                                        then c=c+'p'            when /^--pdf-(?:a4|a5|b5|legal|letter)$/                                  then c=c+'p'            when /^--pdf-(?:p|l|portrait|landscape)$/                                 then c=c+'L' @@ -544,13 +550,11 @@ module SiSU_Commandline            when /^--(?:xml-sax)$/                                                    then c=c+'x'            when /^--(?:xml-dom)$/                                                    then c=c+'X'            when /^--(?:images)$/                                                     then c=c+'j' -          when /^--(?:hash-digests)$/                                               then c=c+'N' +          when /^--(?:digests?|hash-digests)$/                                      then c=c+'N'            when /^--(?:po4a|pot?)$/                                                  then c=c+'P'            when /^--(?:termsheet)$/                                                  then c=c+'T'            when /^--(?:manifest)$/                                                   then c=c+'y'            when /^--(?:qrcode)$/                                                     then c=c+'Q' -          when /^--(?:sqlite)$/                                                     then c=c+'d' -          when /^--(?:pg|pg?sql|postgresql)$/                                       then c=c+'D'            when /^--(?:remote|rsync)$/                                               then c=c+'R'            when /^--(?:scp)$/                                                        then c=c+'r'            when /^--(?:source)$/                                                     then c=c+'s' @@ -582,8 +586,7 @@ module SiSU_Commandline          extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \          and cmd !~/[mn]/            'm'                        #% add ao -        elsif ((cmd =~/[Dd]/ \ -        or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ +        elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \          and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \          and cmd !~/[mn]/            'm'                        #% add ao @@ -591,18 +594,17 @@ module SiSU_Commandline          end        end        if cmd !~/j/ -        extra+=if cmd =~/[bHhwXxyz]/ \ +        extra+=if cmd =~/[bdHhwXxyz]/ \          and cmd !~/[j]/            'j'                        #% copy images          else ''          end        end        if cmd !~/y/ -        extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ +        extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \          and cmd !~/y/            'ym'                       #% add manifest -        elsif (cmd =~/[Dd]/ \ -        or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ +        elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \          and files[0] !~/^remove$/ \          and cmd !~/y/            'ym'                       #% add manifest @@ -911,7 +913,8 @@ module SiSU_Commandline          || mod.inspect =~/"--xml-dom"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } -        act[:xml_docbook_book]=mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/ \ +        act[:xml_docbook_book]=(cmd =~/d/ \ +        || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:xml_fictionbook]=(cmd =~/f/ \ @@ -962,19 +965,134 @@ module SiSU_Commandline          || mod.inspect =~/"--texinfo"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } -        act[:psql]=(cmd =~/D/ \ -        || mod.inspect =~/"--pg"|"--pgsql"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:sqlite]=(cmd =~/d/ \ -        || mod.inspect =~/"--sqlite"/) \ -        && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:sqlite_discrete]=(cmd =~/d/ \ -        || mod.inspect =~/"--sql"|"--sqlite"/) \ -        && (mod.inspect =~/"--both"/ \ -        || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ +        act[:psql]=if mod.inspect =~/"--pg-\S+"/ \ +        or ((mod.inspect =~/"--pg"/) \ +        && (mod.inspect \ +        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) +          act[:psql_createdb]=if mod.inspect \ +          =~/"--pg-createdb"|"--createdb"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          if mod.inspect \ +          =~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/ +            act[:psql_drop]={ bool: true, set: :on } +            act[:psql_create]={ bool: true, set: :on } +          else +            act[:psql_drop]=if mod.inspect \ +            =~/"--pg-dropall"|"--dropall"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            act[:psql_create]=if mod.inspect \ +            =~/"--pg-create(?:all)?"|"--create(?:all)?"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +          end +          act[:psql_import]=if mod.inspect \ +          =~/"--pg-import"|"--import"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          act[:psql_update]=if mod.inspect \ +          =~/"--pg-update"|"--update"/ +            act[:psql_remove]={ bool: true, set: :on } +            { bool: true, set: :on } +          else +            act[:psql_remove]=if mod.inspect \ +            =~/"--pg-remove"|"--remove"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            { bool: false, set: :na } +          end +          { bool: true, set: :on } +        else +          act[:psql_createdb]= +            { bool: false, set: :na } +          act[:psql_drop]= +            { bool: false, set: :na } +          act[:psql_create]= +            { bool: false, set: :na } +          act[:psql_import]= +            { bool: false, set: :na } +          act[:psql_update]= +            { bool: false, set: :na } +          act[:psql_remove]= +            { bool: false, set: :na } +          { bool: false, set: :na } +        end +        act[:sqlite]=if (mod.inspect =~/"--sqlite-\S+"/) \ +        or ((mod.inspect =~/"--sqlite"/) \ +        && (mod.inspect \ +        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) +          act[:sqlite_createdb]=if mod.inspect \ +          =~/"--sqlite-createdb"|"--createdb"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          if mod.inspect \ +          =~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/ +            act[:sqlite_drop]={ bool: true, set: :on } +            act[:sqlite_create]={ bool: true, set: :on } +          else +            act[:sqlite_create]=if mod.inspect \ +            =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            act[:sqlite_drop]=if mod.inspect \ +            =~/"--sqlite-dropall"|"--dropall"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +          end +          act[:sqlite_import]=if mod.inspect \ +          =~/"--sqlite-import"|"--import"/ +            { bool: true, set: :on } +          else +            { bool: false, set: :na } +          end +          act[:sqlite_update]=if mod.inspect \ +          =~/"--sqlite-update"|"--update"/ +            act[:sqlite_remove]={ bool: true, set: :on } +            { bool: true, set: :on } +          else +            act[:sqlite_remove]=if mod.inspect \ +            =~/"--sqlite-remove"|"--sqlite-remove"/ +              { bool: true, set: :on } +            else +              { bool: false, set: :na } +            end +            { bool: false, set: :na } +          end +          { bool: true, set: :on } +        else +          act[:sqlite_createdb]= +            { bool: false, set: :na } +          act[:sqlite_drop]= +            { bool: false, set: :na } +          act[:sqlite_create]= +            { bool: false, set: :na } +          act[:sqlite_import]= +            { bool: false, set: :na } +          act[:sqlite_update]= +            { bool: false, set: :na } +          act[:sqlite_remove]= +            { bool: false, set: :na } +          { bool: false, set: :na } +        end +        act[:sqlite_discrete]=mod.inspect =~/"--sql"|"--sqlite"/ \ +        && (mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:harvest]=(mod.inspect =~/"--harvest"/) \ @@ -989,7 +1107,7 @@ module SiSU_Commandline          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:hash_digests]=(cmd =~/N/ \ -        || mod.inspect =~/"--hash-digests"/) \ +        || mod.inspect =~/"--digests?"|"--hash-digests"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:pdf_font_size]=if mod.inspect =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/ diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb index a39ff215..25b50ba8 100644 --- a/lib/sisu/v6/param.rb +++ b/lib/sisu/v6/param.rb @@ -143,7 +143,11 @@ module SiSU_Param            if (@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],param_msg,@md.title.main).txt_grey +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              param_msg, +              @md.title.main +            ).txt_grey            end          end          @@md=@md diff --git a/lib/sisu/v6/param_make.rb b/lib/sisu/v6/param_make.rb index 7a93e703..50c9551d 100644 --- a/lib/sisu/v6/param_make.rb +++ b/lib/sisu/v6/param_make.rb @@ -77,7 +77,11 @@ module SiSU_Param_Make          STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"          s        else -        SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          'v', +          "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped", +          @opt.fns +        ).warn unless @opt.act[:quiet][:set]==:on          nil        end      end diff --git a/lib/sisu/v6/po4a.rb b/lib/sisu/v6/po4a.rb index 66c68fce..c4e074ec 100644 --- a/lib/sisu/v6/po4a.rb +++ b/lib/sisu/v6/po4a.rb @@ -121,7 +121,11 @@ module SiSU_Po4a              if (@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],@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                @opt.fns, +                "#{path}/#{md.fnb}/#{md.fn[:plain]}" +              ).flow              end            end            if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \ diff --git a/lib/sisu/v6/qrcode.rb b/lib/sisu/v6/qrcode.rb index a8d27ad2..b9aee5a2 100644 --- a/lib/sisu/v6/qrcode.rb +++ b/lib/sisu/v6/qrcode.rb @@ -89,12 +89,23 @@ module SiSU_QRcode            (@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],'QR code',"#{xbrowser} #{url_html}").green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'QR code', +              "#{xbrowser} #{url_html}" +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'QR code', +              "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" +            ).green_title_hi            if (@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],"#{browser} #{url_html}").grey_tab +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              "#{browser} #{url_html}" +            ).grey_tab            end          end          data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -181,7 +192,10 @@ WOK          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn +          SiSU_Screen::Ansi.new( +            @md.opt.cmd, +            "#{dgst[1]} #{file}" +          ).warn          end          size=(File.size("#{pth}/#{file}")/1024.00).to_s          kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] diff --git a/lib/sisu/v6/remote.rb b/lib/sisu/v6/remote.rb index 37ff723f..54fd144a 100644 --- a/lib/sisu/v6/remote.rb +++ b/lib/sisu/v6/remote.rb @@ -73,35 +73,67 @@ module SiSU_Remote        @remote=SiSU_Env::InfoRemote.new(opt)      end      def rsync -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        @put +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.document      end      def rsync_base -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'rsync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_base      end      def rsync_base_sync -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'rsync and sync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_base_sync      end      def rsync_sitemaps -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement sitemaps ->', +        'rsync' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync_sitemaps      end      def rsync_harvest -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement metadata harvest ->', +        'rsync_harvest' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.rsync.site_harvest      end      def scp -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        @put +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.document      end      def scp_base -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement of base site ->', +        'excluding images' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.site_base      end      def scp_base_all -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','complete').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Remote placement ->', +        'complete' +      ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on        @remote.scp.site_base_all      end    end @@ -109,7 +141,11 @@ module SiSU_Remote      def initialize(opt,get_s)        @opt,@get_s=opt,get_s        @msg,@msgs='',nil -      @tell=lambda { SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@msg,"#{@msgs.inspect if @msgs}") } +      @tell=lambda { +        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set], +        @msg, +        "#{@msgs.inspect if @msgs}") +      }      end      def fns        begin diff --git a/lib/sisu/v6/rexml.rb b/lib/sisu/v6/rexml.rb index 63e70a42..7321ebf5 100644 --- a/lib/sisu/v6/rexml.rb +++ b/lib/sisu/v6/rexml.rb @@ -100,11 +100,20 @@ module SiSU_Rexml              xmlfile=IO.readlines(@fnap,'').join              begin                @xmldoc=REXML::Document.new xmlfile -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.act[:quiet][:set]==:on +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'REXML', +                "XML document #{@fnap} loaded" +              ).colorize unless @md.opt.act[:quiet][:set]==:on                if (@opt.act[:verbose][:set]==:on \                || @opt.act[:verbose_plus][:set]==:on)                  @xmldoc.elements.each(@e_head) do |e| -                  SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'brown',e).colorize unless @md.opt.act[:quiet][:set]==:on +                  SiSU_Screen::Ansi.new( +                    @md.opt.act[:color_state][:set], +                    'brown', +                    e +                  ).colorize unless @md.opt.act[:quiet][:set]==:on                  end                end              rescue REXML::ParseException @@ -112,7 +121,12 @@ module SiSU_Rexml              end            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'fuchsia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'fuchsia', +            "File Not Found #{xmlfile}", +            'requested XML processing skipped' +          ).colorize unless @md.opt.act[:quiet][:set]==:on            exit          end        rescue diff --git a/lib/sisu/v6/se_cleanoutput.rb b/lib/sisu/v6/se_cleanoutput.rb new file mode 100644 index 00000000..d27e6025 --- /dev/null +++ b/lib/sisu/v6/se_cleanoutput.rb @@ -0,0 +1,151 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_cleanoutput.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Clean_Output +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class CleanOutput +    begin +      require 'fileutils' +        include FileUtils::Verbose +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('fileutils NOT FOUND (LoadError)') +    end +    def initialize(opt) +      @opt=opt +      z=SiSU_Env::FileMap.new(opt) +      zap=z.local_sisu_source +      if opt.cmd =~ /h/i +        zap=Dir.glob(zap).join(' ') +        @zap=if opt.cmd !~ /w/ +          zap.gsub(/#{@source_path}\/concordance.html/,'') +        else zap +        end +      end +      @env=SiSU_Env::InfoEnv.new +    end +    def zap +      def deletion(fn) +        if FileTest.file?(fn)==true +          File.delete(fn) +          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn) +          tell.warn unless @opt.cmd =~/q/ +        end +      end +      def remove_output +        if @opt.act[:maintenance][:set] == :on +          m=InfoFile.new(@opt.fnc) +          tell=SiSU_Screen::Ansi.new( +            @opt.cmd,@opt.fns, +            'remove maintenance files from: ' + @env.processing_path.ao +          ) +          tell.warn unless @opt.cmd =~/q/ +          deletion(m.marshal.ao_content) +          deletion(m.marshal.ao_idx_sst_rel_html_seg) +          deletion(m.ao_idx_sst_rel) +          deletion(m.ao_idx_html) +          deletion(m.ao_idx_xhtml) +          deletion(m.ao_metadata) +          deletion(m.ao_map_nametags) +          deletion(m.ao_map_ocn_htmlseg) +          deletion(m.html_tune) +        end +        md=SiSU_Param::Parameters.new(@opt).get +        f=SiSU_Env::FileOp.new(md) +        deletion(f.place_file.html_segtoc.dir) +        deletion(f.place_file.html_scroll.dir) +        deletion(f.place_file.html_book_index.dir) +        deletion(f.place_file.html_concordance.dir) +        deletion(f.place_file.epub.dir) +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") +        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") +        deletion(f.place_file.odt.dir) +        deletion(f.place_file.xhtml.dir) +        deletion(f.place_file.xml_sax.dir) +        deletion(f.place_file.xml_dom.dir) +        deletion(f.place_file.xml_scaffold_structure_sisu.dir) +        deletion(f.place_file.xml_scaffold_structure_collapse.dir) +        deletion(f.place_file.info.dir) +        deletion(f.place_file.manpage.dir) +        deletion(f.place_file.sqlite_discrete.dir) +        deletion(f.place_file.txt.dir) +        deletion(f.place_file.hash_digest.dir) +        deletion(f.place_file.manifest.dir) +        deletion(f.place_file.qrcode_md.dir) +        deletion(f.place_file.qrcode_title.dir) +        deletion(f.place_file.src.dir) +        deletion(f.place_file.sisupod.dir) +      end +      self +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_clear.rb b/lib/sisu/v6/se_clear.rb new file mode 100644 index 00000000..af4097af --- /dev/null +++ b/lib/sisu/v6/se_clear.rb @@ -0,0 +1,112 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_clear.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Clear +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class Clear < SiSU_Info_Env::InfoEnv                     # se_info_env.rb +    #todo unify with FileOp +    def initialize(cmd,fns,operation='') +      @cmd=cmd +      begin +        super(fns) +        @env=SiSU_Env::InfoEnv.new(fns) +        SiSU_Env::InfoVersion.instance +        if operation.class.inspect =~/SiSU_Param/ +          @md=operation +        end +        case operation #watch +        when /pdf/                 then @env_out='' +        when /sql/ +        when /xml|plaintext|ascii/ then @env_out=@env.path.output + @fnb #check change of name to plaintext from ascii +        else +          if defined? @md.sfx_src \ +          and @md.sfx_src =~/ss[ftsumc]/ +            @env_out_root=@env.path.output +            @env_out="#{@env.path.output}/#{@fnb}" +            @@publisher='SiSU http://www.jus.uio.no/sisu' +            @env_pdf="#{@env_out_root}/pdf" +          end +        end +      rescue +        SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def param_instantiate +      @cX||=SiSU_Screen::Ansi.new(@cmd) +      @@date=SiSU_Env::InfoDate.new +      @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil +      @@publisher='SiSU scribe' +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_createsite.rb b/lib/sisu/v6/se_createsite.rb new file mode 100644 index 00000000..c35d24d4 --- /dev/null +++ b/lib/sisu/v6/se_createsite.rb @@ -0,0 +1,275 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_createsite.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Create_Site +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'screen_text_color'                     # screen_text_color.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class CreateSite < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    require_relative 'css'                                 # css.rb +      include SiSU_Style +    def initialize(opt) +      @opt=opt +      @env=SiSU_Env::InfoEnv.new +      @init=SiSU_Env::GetInit.new +      @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @vz=SiSU_Viz::Defaults.new +      @vz_home=SiSU_Viz::Home.new +    end +    def create_default_sisu_homepage(action=:none) +      if action==:none +        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.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 +        file_home_toc << @vz_home.homepage +        file_homepage.close +        file_home_toc.close +      end +    end +    def homepage +      home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") +      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.base_markup_dir_stub}") +        end +      else +        create_default_sisu_homepage(:none) +        #create_default_sisu_homepage(:default) +      end +    end +    def cp_images(src_path,dest_path) +      if FileTest.directory?(src_path) +        FileUtils::cd(src_path) +        source=Dir.glob("*.{png,jpg,gif,ico}") +        FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) +        FileUtils::chmod(0755,dest_path) +        source.each do |i| +          if FileTest.file?(i) +            FileUtils::cp(i,"#{dest_path}/#{i}") +            FileUtils::chmod(0644,"#{dest_path}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +          end +        end +        FileUtils::cd(@pwd) +      else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} +      end +    end +    def cp_local_images +      src=@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.base_markup_dir_stub + '/' \ +        + '_sisu/image_external' +      if FileTest.directory?(src) +        cp_images(src,dest) if FileTest.directory?(src) +      end +    end +    def cp_webserver_images +      src=@env.path.image_source +      dest_arr=[ +        "#{@env.path.webserv}/_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) +      end +    end +    def cp_webserver_images_local      #this should not have been necessary +      src=@env.path.image_source +      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.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 +      if defined? @rc['permission_set']['css_modify'] \ +      and @rc['permission_set']['css_modify'] +        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) +            source=Dir.glob("*.{css}") +            source.each do |i| +              if FileTest.file?(i) +                FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") +              else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} +              end +            end +            FileUtils::cd(@pwd) +          end +        end +      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 @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 @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 @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 @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 @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 @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 @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 +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_css.rb b/lib/sisu/v6/se_css.rb new file mode 100644 index 00000000..e641e42d --- /dev/null +++ b/lib/sisu/v6/se_css.rb @@ -0,0 +1,227 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_css.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_CSS +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class CSS_Default +    def html +      'html.css' +    end +    def html_tables +      'html_tables.css' +    end +    def xhtml +      'xhtml.css' +    end +    def xml_sax +      'sax.css' +    end +    def xml_dom +      'dom.css' +    end +    def xml_docbook +      'docbook.css' +    end +    def homepage +      'homepage.css' +    end +    def harvest +      'harvest.css' +    end +  end +  class CSS_Select < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    def initialize(md) +      @md=md +      @env=SiSU_Env::InfoEnv.new('',@md) +    end +    def html +      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.base_markup_dir_stub}_html.css") +        @env.path.base_markup_dir_stub + '_html.css' +      else +        SiSU_Env::CSS_Default.new.html +      end +    end +    def html_tables +      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.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 +    def xhtml +      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.base_markup_dir_stub}_xhtml.css") +        @env.path.base_markup_dir_stub + '_xhtml.css' +      else SiSU_Env::CSS_Default.new.xhtml +      end +    end +    def xml_sax +      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.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 +    def xml_dom +      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.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 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.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.base_markup_dir_stub}_homepage.css") +        @env.path.base_markup_dir_stub + '_homepage.css' +      else SiSU_Env::CSS_Default.new.homepage +      end +    end +  end +  class CSS_Stylesheet +    def initialize(md) +      @md=md +      @css=SiSU_Env::CSS_Select.new(@md) +      @env=SiSU_Env::InfoEnv.new('',@md) +      @file=SiSU_Env::FileOp.new(@md) +    end +    def html +      stylesheet= +        @file.path_rel_links.html_scroll_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def html_seg +      stylesheet= +        @file.path_rel_links.html_seg_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def html_tables +      stylesheet= +        @file.path_rel_links.html_seg_css \ +        + @env.path.style + '/' \ +        + @css.html +      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} +    end +    def xhtml_epub +      %{  <link rel="stylesheet" href="css/xhtml.css" type="text/css" />} +    end +    def epub +      xhtml_epub +    end +    def xhtml +      stylesheet= +        @file.path_rel_links.xhtml_css \ +        + @env.path.style + '/' \ +        + @css.xhtml +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end +    def xml_sax +      stylesheet= +        @file.path_rel_links.xml_css \ +        + @env.path.style + '/' \ +        + @css.xml_sax +      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} +    end +    def xml_dom +      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 +end +__END__ diff --git a/lib/sisu/v6/se_date.rb b/lib/sisu/v6/se_date.rb new file mode 100644 index 00000000..3a422337 --- /dev/null +++ b/lib/sisu/v6/se_date.rb @@ -0,0 +1,98 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_date.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Date +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoDate +    begin +      require 'date' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('date NOT FOUND (LoadError)') +    end +    attr_accessor :dt,:t +    def initialize +      @dt,@t=Date.today.to_s,Time.now +    end +    def week +      w=@t.strftime('%W') +      "#{@t.year}w#{w}" +    end +    def month +      "#{@t.year}#{@t.month}" +    end +    def year +      @t.year +    end +    def weekonly +      @t.strftime('%W') +    end +    def monthonly +      @t.month +    end +    def year_static +      YEAR +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_db.rb b/lib/sisu/v6/se_db.rb new file mode 100644 index 00000000..37b51ed2 --- /dev/null +++ b/lib/sisu/v6/se_db.rb @@ -0,0 +1,215 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_db.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Db +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoDb < SiSU_Info_Env::InfoEnv                    # se_info_env.rb +    @@rc=nil +    def initialize +      @@pwd=@pwd=SiSU_Utils::Path.new.base_markup +      @env=SiSU_Env::InfoEnv.new +      pt=Pathname.new(@pwd) +      r=Px[:lng_lst_rgx] +      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ +      @pwd_stub=pt.realpath.to_s[u,1] +      @rc=@@rc ||=SiSU_Env::GetInit.new.sisu_yaml.rc +      @defaults=SiSU_Env::InfoEnv.new.defaults +    end +    def share_source? +      ((defined? @rc['db']['share_source']) \ +      && @rc['db']['share_source']==true) \ +      ? @rc['db']['share_source'] +      : false +    end +    def engine +      def default +        ((defined? @rc['db']['engine']['default']) \ +        && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ +        ? @rc['db']['engine']['default'] +        : 'sqlite' +      end +      self +    end +    def psql +      def user(opt=nil) +        if opt \ +        and opt.mod.inspect =~/--db-user[=-]["']?(\S+)["']+/ +          $1 +        elsif opt \ +        and opt.mod =~/--webserv[=-]webrick/ +          @env.user +        else +          ((defined? @rc['db']['postgresql']['user']) \ +          && @rc['db']['postgresql']['user']=~/\S+/) \ +          ? @rc['db']['postgresql']['user'] +          : @env.user +        end +      end +      def db #db_name +        "#{Db[:name_prefix]}#{@pwd_stub}" +      end +      def port #PGPORT +        ((defined? @rc['db']['postgresql']['port']) \ +        && ( @rc['db']['postgresql']['port'] =~/\d+/ \ +        || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \ +        ? @rc['db']['postgresql']['port'] +        : (@defaults[:postgresql_port]) +      end +      def password +        ((defined? @rc['db']['postgresql']['password']) \ +        && @rc['db']['postgresql']['password']=~/\S+/) \ +        ? @rc['db']['postgresql']['password'] +        : '' +      end +      def host +        ((defined? @rc['db']['postgresql']['host']) \ +        && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ +        ? @rc['db']['postgresql']['host'] +        : '' +      end +      def dbi +        PG::Connection.open(:dbname =>  psql.db) +      end +      def dbi_ +        (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ +        ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" +        : "DBI:Pg:database=#{psql.db};port=#{psql.port}" +      end +      def conn_dbi +        DBI.connect(psql.dbi,psql.user,psql.db) +      end +      def conn_pg +        require 'pg' +        PG::Connection.new(dbname: psql.db, port: psql.port) +      end +     self +    end +    def sqlite +      def db +        "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" +      end +      def db_discrete(md) +        # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" +      end +      def dbi +        "DBI:SQLite3:#{sqlite.db}" #sqlite3 ? +      end +      def sqlite3 +        sqlite.db #sqlite3 ? +      end +      def conn_dbi +        DBI.connect(sqlite.dbi) +      end +      def conn_sqlite3 +        SQLite3::Database.new(sqlite.sqlite3) +      end +      self +    end +  end +end +module SiSU_Db_Op +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class DbOp < SiSU_Info_Db::InfoDb +    def initialize(md) +      begin +        @md=md +      rescue +        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def sqlite_discrete +      def db +        @md.file.output_path.sqlite_discrete.dir \ +        + '/' \ +        + @md.file.base_filename.sqlite_discrete +      end +      def dbi +        "DBI:SQLite3:#{sqlite_discrete.db}" +      end +      def sqlite3 +        sqlite_discrete.db +      end +      def conn_dbi +        DBI.connect(sqlite_discrete.dbi) +      end +      def conn_sqlite3 +        begin +          $sqlite3=:yes +          require 'sqlite3' +          SQLite3::Database.new(sqlite_discrete.sqlite3) +        rescue LoadError +          $sqlite3=:no +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error('sqlite3 NOT FOUND (LoadError)') +        end +      end +      self +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_envcall.rb b/lib/sisu/v6/se_envcall.rb new file mode 100644 index 00000000..3727baf6 --- /dev/null +++ b/lib/sisu/v6/se_envcall.rb @@ -0,0 +1,329 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_envcall.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Env_Call +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class EnvCall +    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil +    @@ad={} +    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad +    def initialize(fns='') +      @fns=fns +      @sys=SiSU_Info_Sys::InfoSystem.instance +      get_init=SiSU_Env::GetInit.new +      @rc=get_init.sisu_yaml.rc +      @ad=get_init.ads +      if @fns \ +      and @fns != '' \ +      and @fns !=@@fns +        @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil +      end +      if @fns \ +      and @fns != '' #watch +        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ +        @@fnn ||=@fns[m,1] +        @@fnb ||=@fns[m,2] +        @@fnt ||=@fns[m,3] +        @@flv ||=document_language_versions_found[:f] +        unless @@fns =~/\S+?\.txz/ +          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' +          elsif @@fnb; @@fnb + '.sst.txz' +          else '' # e.g. termsheet +          end +        end +      end +      @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz +    end +    def default_language? +      if @rc \ +      && defined? @rc['language_default'] +        if (@rc['language_default'].is_a?(String)) \ +        && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/) +          @rc['language_default'] +        else 'en' +        end +      else 'en' +      end +    end +    def mono_multi_lingual? +      if @rc \ +      && defined? @rc['lingual'] +        if (@rc['lingual'].is_a?(String)) \ +        && (@rc['lingual'] =~/mono(?:lingual)?/) +          :mono +        elsif  (@rc['lingual'].is_a?(String)) \ +        && (@rc['lingual'] =~/multi(?:lingual)?/) +          :multi +        else :multi +        end +      else :multi +      end +    end +    def output_dir_structure +      def by? +        output_structure=:filename #set default output structure +        if @rc \ +        && defined? @rc['output_dir_structure_by'] +          output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ +          or ((defined? @rc['output_structure']['dump']) \ +          && @rc['output_structure']['dump'] ==true) +            :dump +          elsif (@rc['output_dir_structure_by'] =~/redirect/) \ +          or ((defined? @rc['output_structure']['redirect']) \ +          && @rc['output_structure']['redirect'] ==true) +            :redirect +          elsif (@rc['output_dir_structure_by'] =~/language/) \ +          or ((defined? @rc['output_structure']['by_language']) \ +          && @rc['output_structure']['by_language'] ==true) +            :language +          elsif (@rc['output_dir_structure_by'] =~/filetype/) \ +          or ((defined? @rc['output_structure']['by_filetype']) \ +          && @rc['output_structure']['by_filetype'] ==true) +            :filetype +          elsif (@rc['output_dir_structure_by'] =~/filename/) \ +          or ((defined? @rc['output_structure']['by_filename']) \ +          && @rc['output_structure']['by_filename'] ==true) +            :filename +          else #set default +            :language +          end +        else #set default +          :language +        end +      end +      def dump? +        ((by?) ==:dump) \ +        ? true +        : false +      end +      def redirect? +        ((by?) ==:redirect) \ +        ? true +        : false +      end +      def by_language_code? +        ((by?) ==:language) \ +        ? true +        : false +      end +      def by_filetype? +        ((by?) ==:filetype) \ +        ? true +        : false +      end +      def by_filename? +        ((by?) ==:filename) \ +        ? true +        : false +      end +      def multilingual? +        by_language_code? +      end +      self +    end +    def document_language_versions_found #REVISIT +      @fn={} +      filename=(@fns =~/\.ssm\.sst$/) \ +      ? @fns.gsub(/\.ssm\.sst$/,'.ssm') +      : @fns +      if filename.is_a?(String) \ +      and not filename.empty? +        if output_dir_structure.by_language_code? +          m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/ +          @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3] +        else m=/(.+?)\.(sst|ssm)$/ +          @fn[:b]=@fn[:m]=filename[m,1] +          @fn[:t]=filename[m,2] +        end +      end +      lng_base=SiSU_Env::InfoEnv.new.language_default_set +      lang=SiSU_Env::StandardiseLanguage.new +      langs=lang.codes +      x=[] +      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") +        n=@fn[:m].gsub(/^.+?\//,'') +        n =n + '.' + @fn[:t] +        x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } +      end +      langs.each do |l| +        lng=SiSU_Env::StandardiseLanguage.new(l) +        if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +          x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } +        elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") +          x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } +        end +        if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +          if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } +          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } +          end +        end +        if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +          if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } +          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") +            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } +          end +        end +      end +      @fn[:f]=x +      @fn +    end +    def published_manifests?(output_base) +      @fn={} +      @m=[] +      unless (@fns.nil? \ +      or @fns.empty?) +        if output_dir_structure.by_language_code? +          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ +          @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] +        else m=/(.+?)\.((?:-|ssm\.)?sst$)/ +          @fn[:b]=@fn[:m]=@fns[m,1] +          @fn[:t]=@fns[m,2] +        end +      end +      lang=SiSU_Env::StandardiseLanguage.new +      langs=lang.codes +      x=[] +      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" +      end +      dir=SiSU_Env::InfoEnv.new(@fns) +      @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language +      langs.each do |l| +        lng=SiSU_Env::StandardiseLanguage.new(l) +        fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" +        fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" +        if FileTest.file?(fns_c) +          fn_set_lang=SiSU_Env::StandardiseLanguage.new. +            file_to_language(fns_c) #reconsider file_to_language +          lng=fn_set_lang[:n] +          fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) +          @m << { m: fn[:manifest], l: lng } +        elsif FileTest.file?(fns_l) +          fn_set_lang=SiSU_Env::StandardiseLanguage.new. +            file_to_language(fns_l) #reconsider file_to_language +          @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) +          fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) +          @m << { m: fn[:manifest], l: lng } +        end +      end +      @m=@m.uniq +    end +    def filename(code,name,suffix) +      "#{name}#{suffix}" +    end +    def lang(code) +      { +        html:            filename(code,'','.html'), +        book_index:      filename(code,'book_index','.html'), +        concordance:     filename(code,'concordance','.html'), +        sax:             filename(code,'sax','.xml'), +        dom:             filename(code,'dom','.xml'), +        docbook:         filename(code,'docbook','.xml'), +        xhtml:           filename(code,'scroll','.xhtml'), +        pdf_l:           filename(code,'','.pdf'), +        pdf_p:           filename(code,'','.pdf'), +        pdf_l_a4:        filename(code,"a4",'.pdf'), +        pdf_p_a4:        filename(code,"a4",'.pdf'), +        pdf_l_a5:        filename(code,"a5",'.pdf'), +        pdf_p_a5:        filename(code,"a5",'.pdf'), +        pdf_l_b5:        filename(code,"b5",'.pdf'), +        pdf_p_b5:        filename(code,"b5",'.pdf'), +        pdf_l_letter:    filename(code,"letter",'.pdf'), +        pdf_p_letter:    filename(code,"letter",'.pdf'), +        pdf_l_legal:     filename(code,"legal",'.pdf'), +        pdf_p_legal:     filename(code,"legal",'.pdf'), +        toc:             filename(code,'toc','.html'), +        doc:             filename(code,fnb,'.html'), +        index:           filename(code,'index','.html'), +        po:              filename(code,@fns,'.po'), +        pot:             filename(code,@fns,'.pot'), +        odf:             filename(code,'','.odt'), +        epub:            filename(code,'','.epub'), +        plain:           filename(code,'','.txt'), +        qrcode:          filename(code,'','.jpg'), +        manpage:         filename(code,'','.1'),          #fix, section number +        wiki:            filename(code,'wiki','.txt'), +        digest:          filename(code,'digest','.txt'), +        metadata:        filename(code,'metadata','.html'), #chk +        manifest:        filename(code,'manifest','.html'), +        oai_pmh:         filename(code,'oai_pmh','.xml'), +        sitemap:         filename(code,'sitemap','.xml'), +        sitemap_touch:   filename(code,"sitemap_#{fnb}",'.xml'), +        sxs:             filename(code,fnb,'.sxs.xml'), +        sxd:             filename(code,fnb,'.sxd.xml'), +        sxn:             filename(code,fnb,'.sxn.xml'), +        sisupod:         filename(nil,@fnz,''), +        book_idx_html:   filename(code,'book_index','.html'), +        book_idx_epub:   filename(code,'book_index','.xhtml'), +        epub_concord:    filename(code,'concordance','.xhtml'), +      } +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_file_op.rb b/lib/sisu/v6/se_file_op.rb new file mode 100644 index 00000000..1dc02775 --- /dev/null +++ b/lib/sisu/v6/se_file_op.rb @@ -0,0 +1,2662 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_file_op.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_File +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class InfoFile < SiSU_Info_Env::InfoEnv                  # se_info_env.rb +    #todo unify with FileOp +    def initialize(fns) +      begin +        super(fns) +        @fns=fns +        @env=SiSU_Env::InfoEnv.new(@fns) +        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ +        @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] +      rescue +        SiSU_Screen::Ansi.new('',$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def basefilename #Remove if possible +      m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m +      @fns[m,1] +    end +    def make_file(path,filename) +      (File.writable?("#{path}/.")) \ +      ? File.new("#{path}/#{filename}",'w+') +      : (SiSU_Screen::Ansi.new( +          '', +          "*WARN* is the file or directory writable?, could not create #{filename}" +        ).warn) +    end +    def touch_file(path,filename) +      if File.writable?("#{path}/."); +        FileUtils::touch("#{path}/#{filename}") +      else +        SiSU_Screen::Ansi.new( +          '', +          "*WARN* is the file or directory writable?, could not create #{filename}" +        ).warn +      end +    end +    def make_path(path) +      FileUtils::mkdir_p(path) unless FileTest.directory?(path) +    end +    def marshal +      def ao_content +        @env.processing_path.ao + '/' \ +          + @fns + '.content.rbm' +      end +      def ao_idx_sst_rel_html_seg +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_sst.rbm' +      end +      def ao_idx_sst_rel #used by tex & odf +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_raw.rbm' +      end +      def ao_idx_html +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_html.rbm' +      end +      def ao_idx_xhtml +        @env.processing_path.ao + '/' \ +          + @fns + '.idx_xhtml.rbm' +      end +      def ao_metadata +        @env.processing_path.ao + '/' \ +          + @fns + '.metadata.rbm' +      end +      def ao_map_nametags +        @env.processing_path.ao + '/' \ +          + @fns + '.map_name_tags.rbm' +      end +      def ao_map_ocn_htmlseg +        @env.processing_path.ao + '/' \ +          + @fns + '.map_ocn_htmlseg.rbm' +      end +      def html_tune +        @env.processing_path.tune + '/' \ +          + @fns + '.marshal_tune' +      end +      self +    end +    def write_file_processing +      def html_tune +        File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+') +      end +      self +    end +    def mkdir #check moved from FileOp, existing mkdir +      def processing +        def ao +          FileUtils::mkdir_p(@env.processing_path.ao) \ +            unless FileTest.directory?(@env.processing_path.ao) +        end +        def tune +          FileUtils::mkdir_p(@env.processing_path.tune) \ +            unless FileTest.directory?(@env.processing_path.tune) +        end +        self +      end +    end +  end +end +module SiSU_File_Op +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class FileOp < SiSU_Info_File::InfoFile +    #todo unify with CreateFile +    def initialize(md,fno='') +      begin +        @md,@fno=md,fno +        @env=SiSU_Env::InfoEnv.new(@md.fns) +      rescue +        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def output_dir_structure +      SiSU_Env::ProcessingSettings.new(@md).output_dir_structure +    end +    def mkdir_initialize                # not used but consider using +      FileUtils::mkdir_p(output_path.base.dir) \ +        unless FileTest.directory?(output_path.base.dir) +      FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") \ +        unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") +      FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ +        unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") +      FileUtils::mkdir_p(@env.processing_path.ao) \ +        unless FileTest.directory?(@env.processing_path.ao) +      FileUtils::mkdir_p(@env.processing_path.tune) \ +        unless FileTest.directory?(@env.processing_path.tune) +    end +    def path_rel_links +      def html_scroll_2 +        if output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_seg_2 +        if output_dir_structure.by_language_code? +          '../../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def html_scroll_1 +        if output_dir_structure.by_language_code? +          '../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          './' +        end +      end +      def html_seg_1 +        if output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          './' +        end +      end +      def default_output_css +        if (@md.opt.opt_act[:dump][:bool] \ +        &&  @md.opt.opt_act[:dump][:inst]) \ +        || (@md.opt.opt_act[:redirect][:bool] \ +        &&  @md.opt.opt_act[:redirect][:inst]) +          './' +        elsif output_dir_structure.by_language_code? +          '../../' +        elsif output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_scroll_css +        default_output_css +      end +      def xhtml_css +        default_output_css +      end +      def xml_css +        default_output_css +      end +      def html_seg_css +        if output_dir_structure.by_language_code? +          '../../../' +        elsif output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def manifest_css +        if output_dir_structure.by_language_code? +          '../../_sisu/css' +        elsif output_dir_structure.by_filetype? +          '' +        else +          '../' +        end +      end +      self +    end +    def mkdir +      def output +        def base +          FileUtils::mkdir_p(output_path.base.dir) \ +            unless FileTest.directory?(output_path.base.dir) +        end +        def css +          FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") \ +            unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") +        end +        def epub +          path=output_path.epub.dir +          make_path(path) +        end +        self +      end +      self +    end +    def mkfile #consider using more +      path="#{output_path.base.dir}/#{@md.fnb}" +      make_path(path) +      filename=@fno +      make_file(path,filename) +    end +    def mkfile_pwd +      path=Dir.pwd +      filename=@fno +      make_file(path,filename) +    end +    def write_file +      def txt +        path=output_path.txt.dir +        make_path(path) +        fn=base_filename.txt +        make_file(path,fn) +      end +      def textile +        path=output_path.textile.dir +        make_path(path) +        fn=base_filename.textile +        make_file(path,fn) +      end +      def asciidoc +        path=output_path.asciidoc.dir +        make_path(path) +        fn=base_filename.asciidoc +        make_file(path,fn) +      end +      def markdown +        path=output_path.markdown.dir +        make_path(path) +        fn=base_filename.markdown +        make_file(path,fn) +      end +      def rst +        path=output_path.rst.dir +        make_path(path) +        fn=base_filename.rst +        make_file(path,fn) +      end +      def html_scroll +        pth=output_path.html.dir +        make_path(pth) +        p_fn=place_file.html_scroll.dir +        @@filename_html_scroll=File.new(p_fn,'w+') +      end +      def html_seg_index +        pth=((output_dir_structure.by_filename?) \ +        || (output_dir_structure.dump?)) \ +        ? "#{output_path.html.dir}" +        : "#{output_path.html.dir}/#{@md.fnb}" +        make_path(pth) +        p_fn=place_file.html_seg_index.dir +        @@filename_html_index=File.new(p_fn,'w+') +      end +      def html_segtoc +        pth=((output_dir_structure.by_filename?) \ +        || (output_dir_structure.dump?) \ +        || (output_dir_structure.redirect?)) \ +        ? "#{output_path.html.dir}" +        : "#{output_path.html.dir}/#{@md.fnb}" +        make_path(pth) +        p_fn=place_file.html_segtoc.dir +        @@filename_html_index=File.new(p_fn,'w+') +      end +      def xhtml +        path=output_path.xhtml.dir +        make_path(path) +        fn=base_filename.xhtml +        make_file(path,fn) +      end +      def xml_sax +        path=output_path.xml.dir +        make_path(path) +        fn=base_filename.xml_sax +        make_file(path,fn) +      end +      def xml_dom +        path=output_path.xml.dir +        make_path(path) +        fn=base_filename.xml_dom +        make_file(path,fn) +      end +      def xml_docbook_book +        path=output_path.xml_docbook_book.dir +        make_path(path) +        fn=base_filename.xml_docbook_book +        make_file(path,fn) +      end +      def xml_fictionbook +        path=output_path.xml_fictionbook.dir +        make_path(path) +        fn=base_filename.xml_fictionbook +        make_file(path,fn) +      end +      def xml_scaffold_structure_sisu +        path=output_path.xml_scaffold_structure_sisu.dir +        make_path(path) +        fn=base_filename.xml_scaffold_structure_sisu +        make_file(path,fn) +      end +      def xml_scaffold_structure_collapse +        path=output_path.xml_scaffold_structure_collapse.dir +        make_path(path) +        fn=base_filename.xml_scaffold_structure_collapse +        make_file(path,fn) +      end +      def manpage +        path=output_path.manpage.dir +        make_path(path) +        fn=base_filename.manpage +        make_file(path,fn) +      end +      def texinfo +        path=output_path.texinfo.dir +        make_path(path) +        fn=base_filename.texinfo +        make_file(path,fn) +      end +      def info +        path=output_path.texinfo.dir +        make_path(path) +        fn=base_filename.info +        make_file(path,fn) +      end +      def hash_digest +        path=output_path.hash_digest.dir +        make_path(path) +        fn=base_filename.hash_digest +        make_file(path,fn) +      end +      def qrcode +        path=output_path.qrcode.dir +        make_path(path) +        fn=base_filename.qrcode +        make_file(path,fn) +      end +      def manifest +        path=output_path.manifest.dir +        make_path(path) +        fn=base_filename.manifest +        make_file(path,fn) +      end +      def manifest_txt +        path=output_path.manifest.dir +        make_path(path) +        fn=base_filename.manifest_txt +        make_file(path,fn) +      end +      def pot +        path=output_path.pot.dir +        make_path(path) +        fn=base_filename.pot +        make_file(path,fn) +      end +      def po +        path=output_path.po.dir +        make_path(path) +        fn=base_filename.po +        make_file(path,fn) +      end +      self +    end +    def place_file +      def txt +        def dir +          output_path.txt.dir + '/' \ +          + base_filename.txt +        end +        def rel +          output_path.txt.rel + '/' \ +          + base_filename.txt +        end +        self +      end +      def textile +        def dir +          output_path.textile.dir + '/' \ +          + base_filename.textile +        end +        def rel +          output_path.textile.rel + '/' \ +          + base_filename.textile +        end +        self +      end +      def asciidoc +        def dir +          output_path.asciidoc.dir + '/' \ +          + base_filename.asciidoc +        end +        def rel +          output_path.asciidoc.rel + '/' \ +          + base_filename.asciidoc +        end +        self +      end +      def markdown +        def dir +          output_path.markdown.dir + '/' \ +          + base_filename.markdown +        end +        def rel +          output_path.markdown.rel + '/' \ +          + base_filename.markdown +        end +        self +      end +      def rst +        def dir +          output_path.rst.dir + '/' \ +          + base_filename.rst +        end +        def rel +          output_path.rst.rel + '/' \ +          + base_filename.rst +        end +        self +      end +      def html_scroll +        def dir +          output_path.html_scroll.dir + '/' \ +          + base_filename.html_scroll +        end +        def rel +          output_path.html_scroll.rel + '/' \ +          + base_filename.html_scroll +        end +        self +      end +      def html_seg_index +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_seg_index +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_seg_index +        end +        self +      end +      def html_segtoc +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_segtoc +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_segtoc +        end +        self +      end +      def html_book_index +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_book_index +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_book_index +        end +        self +      end +      def html_concordance +        def dir +          output_path.html_seg.dir + '/' \ +          + base_filename.html_concordance +        end +        def rel +          output_path.html_seg.rel + '/' \ +          + base_filename.html_concordance +        end +        self +      end +      def odt +        def dir +          output_path.odt.dir + '/' \ +          + base_filename.odt +        end +        def rel +          output_path.odt.rel + '/' \ +          + base_filename.odt +        end +        self +      end +      def epub +        def dir +          output_path.epub.dir + '/' \ +          + base_filename.epub +        end +        def rel +          output_path.epub.rel + '/' \ +          + base_filename.epub +        end +        self +      end +      def pdf_p +        STDERR.puts 'ERROR not available due to multiple page format sizes' +      end +      def pdf_l +        STDERR.puts 'ERROR not available due to multiple page format sizes' +      end +      def xhtml +        def dir +          output_path.xhtml.dir + '/' \ +          + base_filename.xhtml +        end +        def rel +          output_path.xhtml.rel + '/' \ +          + base_filename.xhtml +        end +        self +      end +      def xml_sax +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_sax +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_sax +        end +        self +      end +      def xml_dom +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_dom +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_dom +        end +        self +      end +      def xml_docbook_book +        def dir +          output_path.xml_docbook.dir + '/' \ +          + base_filename.xml_docbook_book +        end +        def rel +          output_path.xml_docbook.rel + '/' \ +          + base_filename.xml_docbook_book +        end +        self +      end +      def xml_fictionbook +        def dir +          output_path.xml_fictionbook.dir + '/' \ +          + base_filename.xml_fictionbook +        end +        def rel +          output_path.xml_fictionbook.rel + '/' \ +          + base_filename.xml_fictionbook +        end +        self +      end +      def xml_scaffold_structure_sisu +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_scaffold_structure_sisu +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_scaffold_structure_sisu +        end +        self +      end +      def xml_scaffold_structure_collapse +        def dir +          output_path.xml.dir + '/' \ +          + base_filename.xml_scaffold_structure_collapse +        end +        def rel +          output_path.xml.rel + '/' \ +          + base_filename.xml_scaffold_structure_collapse +        end +        self +      end +      def sqlite_discrete +        def dir +          output_path.sqlite_discrete.dir + '/' \ +          + base_filename.sqlite_discrete +        end +        def rel +          output_path.sqlite_discrete.rel + '/' \ +          + base_filename.sqlite_discrete +        end +        self +      end +      def hash_digest +        def dir +          output_path.hash_digest.dir + '/' \ +          + base_filename.hash_digest +        end +        def rel +          output_path.hash_digest.rel + '/' \ +          + base_filename.hash_digest +        end +        self +      end +      def src +        def dir +          output_path.src.dir + '/' \ +            + base_filename.src +        end +        def rel +          output_path.src.rel + '/' \ +          + base_filename.src +        end +        self +      end +      def sisupod +        def dir +          output_path.sisupod.dir + '/' \ +          + base_filename.sisupod +        end +        def rel +          output_path.sisupod.rel + '/' \ +          + base_filename.sisupod +        end +        self +      end +      def po +        def dir +          output_path.po.dir + '/' \ +          + base_filename.po +        end +        def rel +          output_path.po.rel + '/' \ +          + base_filename.po +        end +        self +      end +      def pot +        def dir +          output_path.pot.dir + '/' \ +          + base_filename.pot +        end +        def rel +          output_path.pot.rel + '/' \ +          + base_filename.pot +        end +        self +      end +      def po_git +        def dir +          output_path.po_git + '/' \ +          + base_filename.po +        end +        def rel +          #output_path.po_git + '/' + base_filename.po +        end +        self +      end +      def pot_git +        def dir +          output_path.pot_git + '/' \ +          + base_filename.pot +        end +        def rel +          #output_path.pot_git + '/' + base_filename.pot +        end +        self +      end +      def manpage +        def dir +          output_path.manpage.dir + '/' \ +          + base_filename.manpage +        end +        def rel +          output_path.manpage.rel + '/' \ +          + base_filename.manpage +        end +        self +      end +      def texinfo +        def dir +          output_path.texinfo.dir + '/' \ +          + base_filename.texinfo +        end +        def rel +          output_path.texinfo.rel + '/' \ +          + base_filename.texinfo +        end +        self +      end +      def info +        def dir +          output_path.texinfo.dir + '/' \ +          + base_filename.info +        end +        def rel +          output_path.texinfo.rel + '/' \ +          + base_filename.info +        end +        self +      end +      def qrcode_title +        def dir +          output_path.qrcode.dir + '/' \ +          + base_filename.qrcode_title +        end +        def rel +          output_path.qrcode.rel + '/' \ +          + base_filename.qrcode_title +        end +        self +      end +      def qrcode_md +        def dir +          output_path.qrcode.dir + '/' \ +          + base_filename.qrcode_md +        end +        def rel +          output_path.qrcode.rel + '/' \ +          + base_filename.qrcode_md +        end +        self +      end +      def manifest +        def dir +          output_path.manifest.dir + '/' \ +            + base_filename.manifest +        end +        def rel +          output_path.manifest.rel + '/' \ +            + base_filename.manifest +        end +        self +      end +      self +    end +    def base_filename +      def i18n(f) +        f=default_hash.merge(f) +        f[:lng] ||=@md.lang_code_insert +        f[:fn] + f[:lng] + f[:ft] +      end +      def default_hash +        { +          fn: @md.fnb, +          lng: @md.lang_code_insert, +        } +      end +      def default_hash_build(fh,sfx) +        if fh.is_a?(Hash) +          fh[:fn] ||=@md.fnb +          fh[:lng] ||= @md.lang_code_insert +          fh[:ft]=sfx +          fh +        else +          { +            fn: @md.fnb, +            lng: @md.lang_code_insert, +            ft: sfx, +          } +        end +      end +      def lang_code?(lng) +        (output_dir_structure.by_language_code?) \ +        ? '' +        : (lng ||=@md.lang_code_insert) +      end +      def txt(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def textile(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_textile]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def asciidoc(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_asciidoc]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def markdown(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_markdown]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def rst(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt_rst]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'plain', +            ft: fh[:ft], +            lng: fh[:lng], +           } +         else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_scroll(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_seg_index(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: 'index', +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def html_segtoc(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: fh[:fn] + '.toc', +            ft: fh[:ft], +          } +        else +          { +            fn: 'toc', +            ft: fh[:ft], +            lng: lang_code?(fh[:lng]), +          } +        end +        i18n(fnh) +      end +      def html_seg(fh) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def html_book_index(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: 'book_index', +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def html_concordance(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: 'concordance', +            ft: fh[:ft], +          } +        else +          { +            fn: 'concordance', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xhtml(fh=nil) +        fh=default_hash_build(fh,Sfx[:xhtml]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def epub(fh=nil) +        fh=default_hash_build(fh,Sfx[:epub]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def odt(fh=nil) +        fh=default_hash_build(fh,Sfx[:odt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'opendocument', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_sax(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_sax]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_dom(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_dom]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_docbook_book(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_docbook_book]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_fictionbook(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_fictionbook]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_scaffold_structure_sisu(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def xml_scaffold_structure_collapse(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'scroll', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def pdf_p(fh=nil) +        fh=default_hash_build(fh,Sfx[:pdf]) +        fh[:lng]=lang_code?(fh[:lng]) +        if output_dir_structure.by_filename? +          'portrait' + fh[:lng] + '.' +        else +          fh[:fn] + '.portrait' + fh[:lng] + '.' +        end +      end +      def pdf_l(fh=nil) +        fh=default_hash_build(fh,Sfx[:pdf]) +        fh[:lng]=lang_code?(fh[:lng]) +        if output_dir_structure.by_filename? +          'landscape' + fh[:lng] + '.' +        else +          fh[:fn] + '.landscape' + fh[:lng] + '.' +        end +      end +      def pdf_p_a4(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_a4] +      end +      def pdf_p_a5(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_a5] +      end +      def pdf_p_b5(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_b5] +      end +      def pdf_p_letter(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_letter] +      end +      def pdf_p_legal(fh=nil) +        pdf_p(fh) + @md.fn[:pdf_p_legal] +      end +      def pdf_l_a4(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_a4] +      end +      def pdf_l_a5(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_a5] +      end +      def pdf_l_b5(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_b5] +      end +      def pdf_l_letter(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_letter] +      end +      def pdf_l_legal(fh=nil) +        pdf_l(fh) + @md.fn[:pdf_l_legal] +      end +      def manpage(fh=nil) +        fh=default_hash_build(fh,Sfx[:manpage]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def info(fh=nil) +        fh=default_hash_build(fh,Sfx[:info]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def texinfo(fh=nil) +        fh=default_hash_build(fh,Sfx[:texinfo]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def sqlite_discrete(fh=nil) +        fh=default_hash_build(fh,Sfx[:sql]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh={ +          fn: fh[:fn], +          ft: fh[:ft], +          lng: fh[:lng], +        } +        i18n(fnh) +      end +      def hash_digest(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_language_code? +          { +            fn: fh[:fn] + '.hash_digest', +            ft: fh[:ft], +          } +        elsif output_dir_structure.by_filetype? +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: 'digest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def sitemap(fh=nil) +        fh=default_hash_build(fh,Sfx[:xml]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_language_code? +          { +            fn: fh[:fn] + '.sitemap', +            ft: fh[:ft], +          } +        elsif output_dir_structure.by_filetype? +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: 'sitemap', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def qrcode_title(fh=nil) +        fh=default_hash_build(fh,'.title.png') +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def qrcode_md #check name below +        fh=default_hash_build(fh,'.md.png') +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def manifest_txt(fh=nil) +        fh=default_hash_build(fh,Sfx[:txt]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def manifest(fh=nil) +        fh=default_hash_build(fh,Sfx[:html]) +        fh[:lng]=lang_code?(fh[:lng]) +        fnh=if output_dir_structure.dump_or_redirect? +          { +            fn: fh[:fn] + '.manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        elsif output_dir_structure.by_filename? +          { +            fn: 'sisu_manifest', +            ft: fh[:ft], +            lng: fh[:lng], +          } +        else +          { +            fn: fh[:fn], +            ft: fh[:ft], +            lng: fh[:lng], +          } +        end +        i18n(fnh) +      end +      def src +        @md.fno +      end +      def po #check +        (@fno.empty?) \ +        ? (@md.fn[:po]) +        : (@fno + '.po') +      end +      def pot +        (@fno.empty?) \ +        ? (@md.fn[:pot]) +        : (@fno + '.pot') +      end +      def sisupod +        (@md.fns =~/\.ssm\.sst$/) \ +        ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz') +        : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz') +      end +      self +    end +    def set_path(ft) +      @ft=ft +      def dir +        def abc +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          elsif output_dir_structure.by_language_code? +            output_path.base.dir + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.base.dir + '/' + @ft +          else +            output_path.base.dir + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          elsif output_dir_structure.by_language_code? +            output_path.base.dir + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.base.dir + '/' + @ft +          end +        end +        def ab_src +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          else +            output_path.base.dir + '/' \ +              + @ft + '/' \ +              + @md.opt.fng + '/' \ +              + Gt[:sisupod] + '/' \ +              + Gt[:doc] + '/' \ +              + @md.opt.lng +          end +        end +        def ab_pod +          if output_dir_structure.redirect? +            @md.opt.opt_act[:redirect][:inst] + '/' + @md.fnb +          elsif output_dir_structure.dump? +            @md.opt.opt_act[:dump][:inst] +          else +            output_path.base.dir + '/' + @ft +          end +        end +        self +      end +      def url +        def abc +          if output_dir_structure.by_language_code? +            output_path.base.url + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.base.url + '/' + @ft +          else +            output_path.base.url + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            output_path.base.url + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.base.url + '/' + @ft +          end +        end +        def ab_src +          output_path.base.url + '/' \ +            + @ft + '/' \ +            + @md.opt.fng + '/' \ +            + Gt[:sisupod] + '/' \ +            + Gt[:doc] + '/' \ +            + @md.opt.lng +        end +        def ab_pod +          output_path.base.url + '/' + @ft +        end +        self +      end +      def rel +        def abc +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            @ft +          else +            @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          else +            @ft +          end +        end +        def ab_src +          @ft +        end +        def ab_pod +          @ft +        end +        self +      end +      def rel_sm +        def abc +          if output_dir_structure.by_language_code? +            @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            @ft +          else +            @md.fnb +          end +        end +        def ab +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? \ +          or output_dir_structure.by_filetype? +            '../' + @ft +          else '.' +          end +        end +        def ab_src +          locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? +            '../../' + locate +          else +            '../' + locate +          end +        end +        def ab_pod +          if output_dir_structure.dump_or_redirect? +            '.' +          elsif output_dir_structure.by_language_code? +            '../../' + @ft +          else +            '../' + @ft +          end +        end +        self +      end +      def rcp +        def abc +          if output_dir_structure.by_language_code? +            output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft +          elsif output_dir_structure.by_filetype? +            output_path.stub.rcp + '/' + @ft +          else +            output_path.stub.rcp + '/' + @md.fnb +          end +        end +        def ab +          if output_dir_structure.by_language_code? +            output_path.stub.rcp + '/' + @md.opt.lng + '/' + @ft +          else +            output_path.stub.rcp + '/' + @ft +          end +        end +        self +      end +      self +    end +    def output_path +      def web_base +        def dir +          @env.path.webserv +        end +        def url +          #"#{@env.url.root}" +        end +        def rel +          '.' +        end +        def rcp +          '.' +        end +        self +      end +      def stub +        def dir +          @md.opt.f_pth[:pth_stub] +        end +        #def url +        #  "#{@env.url.root}" +        #end +        def rel +          './' + @md.opt.f_pth[:pth_stub] +        end +        def rcp +          @md.opt.f_pth[:pth_stub] +        end +        self +      end +      def webserver_path +        if output_dir_structure.dump? +          @md.opt.opt_act[:dump][:inst] +        elsif output_dir_structure.redirect? +          @md.opt.opt_act[:redirect][:inst] +        else +          @env.path.webserv +        end +      end +      def base +        def dir +          webserver_path + '/' + @md.opt.f_pth[:pth_stub] +        end +        def url +          @env.url.webserv + '/' + @md.opt.f_pth[:pth_stub] +        end +        def rel +          './' + @md.opt.f_pth[:pth_stub] +        end +        def rcp +          './' + @md.opt.f_pth[:pth_stub] +        end +        self +      end +      def sisugit +        def dir +          output_path.base.dir + '/git' +        end +        def url +          output_path.base.url + '/git' +        end +        def rel +          output_path.base.rel + '/git' +        end +        def rcp +          output_path.base.rcp + '/git' +        end +        self +      end +      #def pod +      #  ft='pod' +      #  path=set_path(ft).dir.ab +      #end +      def src +        def ft +          Gt[:src] +        end +        def dir +          set_path(ft).dir.ab_src +        end +        def url +          set_path(ft).url.ab_src +        end +        def rel +          set_path(ft).rel.ab_src +        end +        def rcp +          set_path(ft).rcp.ab_src +        end +        def rel_sm +          set_path(ft).rel_sm.ab_src +        end +        self +      end +      def sisupod +        def ft +          Gt[:src] +        end +        def dir +          set_path(ft).dir.ab_pod +        end +        def url +          set_path(ft).url.ab_pod +        end +        def rel +          set_path(ft).rel.ab_pod +        end +        def rcp +          set_path(ft).rcp.ab_pod +        end +        def rel_sm +          set_path(ft).rel_sm.ab_pod +        end +        self +      end +      def po +        def dir +          output_path.base.dir + '/' \ +            + Gt[:src] + '/' \ +            + @md.opt.fng + '/po4a/po/' \ +            + @md.opt.lng +        end +        def url +          output_path.base.url + '/po4a/' \ +            + @md.fnb + '/po/' \ +            + @md.opt.lng +        end +        self +      end +      def pot +        def dir +         output_path.base.dir + '/' \ +           + Gt[:src] + '/' \ +           + @md.opt.fng + '/po4a/pot' +        end +        def url +          output_path.base.url + '/po4a/' \ +            + @md.fnb + '/pot' +        end +        def rcp +          #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" +        end +        self +      end +      def po_git # consider !!! +        def ft +          Gt[:po] +        end +        def dir +          pth=@env.processing_path.git + '/' \ +            + @md.fnb + '/' \ +            + ft + '/' \ +            + @md.opt.lng +          FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +          pth +        end +        self +      end +      def pot_git # consider !!! +        def ft +          Gt[:pot] +        end +        def dir +          @env.processing_path.git + '/' \ +            + @md.fnb + '/' \ +            + ft +        end +        self +      end +      def md_harvest +        manifest +        self +      end +      def txt +        def ft +          'txt' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def textile +        def ft +          'textile' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def asciidoc +        def ft +          'asciidoc' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def markdown +        def ft +          'markdown' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def rst +        def ft +          'rst' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def html_scroll +        def ft +          'html' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def html_seg +        def ft +          'html/' + @md.fnb +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def html_concordance +        html_seg +        self +      end +      def html +        def ft +          'html' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).url.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          if output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        self +      end +      def xhtml +        def ft +          'xhtml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def epub +        def ft +          'epub' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          './image' +        end +        self +      end +      def odt +        def ft +          'odt' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def xml +        def ft +          'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_sax +        xml +        self +      end +      def xml_dom +        xml +        self +      end +      def xml_docbook +        def ft +          'docbook' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_docbook_article +        def ft +          'docbook' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_docbook_book +        def ft +          'docbook' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_fictionbook +        def ft +          'fictionbook' \ +            + DEVELOPER[:under_construction] +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_scaffold_structure_sisu +        def ft +          'sisu.scaffold.xml' +          #'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def xml_scaffold_structure_collapse +        def ft +          'collapsed.scaffold.xml' +          #'xml' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        def rel_image +          '../../_sisu/image' +        end +        self +      end +      def pdf +        def ft +          'pdf' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def sqlite_discrete +        def ft +          'sql' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def hash_digest +        def ft +          'hashes' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def manifest +        def ft +          'manifest' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rel_image +          if output_dir_structure.dump_or_redirect? +            './image' +          elsif output_dir_structure.by_language_code? +            '../../_sisu/image' +          elsif output_dir_structure.by_filetype? +            '../_sisu/image' +          else +            '../_sisu/image' +          end +        end +        def rcp +          set_path(ft).rcp.abc +        end +        self +      end +      def qrcode +        def ft +          'manifest/qrcode' +        end +        def dir +          set_path(ft).dir.abc +        end +        def url +          set_path(ft).url.abc +        end +        def rel +          set_path(ft).rel.abc +        end +        def rcp +          set_path(ft).rcp.abc +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def harvest +        def ft +          'site_metadata' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          if output_dir_structure.by_language_code? +            '' +          elsif output_dir_structure.by_filetype? +            '' +          else +            '' +          end +        end +        self +      end +      def manpage +        def ft +          'man' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def texinfo +        def ft +          'texinfo' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        def rel_sm +          set_path(ft).rel_sm.ab +        end +        self +      end +      def sitemaps +        def ft +          'sitemaps' +        end +        def dir +          set_path(ft).dir.ab +        end +        def url +          set_path(ft).url.ab +        end +        def rel +          set_path(ft).rel.ab +        end +        def rcp +          set_path(ft).rcp.ab +        end +        self +      end +      def sqlite #check url +        def dir +          output_path.base.dir +        end +        def url +          output_path.base.url +        end +        def rel +          output_path.base.rel +        end +        def rcp +          output_path.base.rcp +        end +        self +      end +      #def cgi +      #end +      def css +        @d='_sisu/css' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          @d +          #output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.stub.rcp + '/' + @d +        end +        self +      end +      def images +        @d='_sisu/image' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          @d +          #output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.stub.rcp + '/' + @d +        end +        self +      end +      def images_external +        @d='_sisu/image_external' +        def dir +          output_path.base.dir + '/' + @d +        end +        def url +          output_path.base.url + '/' + @d +        end +        def rel +          output_path.base.rel + '/' + @d +        end +        def rcp +          output_path.base.rcp + '/' + @d +        end +        self +      end +      #def css +      #  #"#{@env.path.output}/#{@env.path.style}" +      #end +      self +    end +  end +end +module SiSU_Create_File +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class CreateFile < SiSU_Info_Env::InfoEnv                # se_info_env.rb +    #todo unify with FileOp +    def initialize(fns) +      begin +        super(fns) +        @env=SiSU_Env::InfoEnv.new(fns) +      rescue +        SiSU_Screen::Ansi.new('',$!,$@).rescue do +          __LINE__.to_s + ':' + __FILE__ +        end +      ensure +      end +    end +    def html_root +      #@env.path.output +    end +    def mkdir_pdf +      Dir.mkdir(@env.processing_path.tex) \ +        unless FileTest.directory?(@env.processing_path.tex) +    end +    def file_generic(output_file='') +      fn=@env.path.output + '/' \ +      + @fnb + '/' \ +      + output_file +      File.new(fn,'w+') +    end +    def file_error +      fn='/tmp/errorlog.sisu' +      File.new(fn,'w+') +    end +    def file_txt +      fn=@env.processing_path.ao + '/' \ +      + @fns + '.txt' +      File.new(fn,'w+') +    end +    def file_debug +      fn=@env.processing_path.ao + '/' \ +      + @fns + '.debug.txt' +      File.new(fn,'w+') +    end +    def metaverse +      def file_meta +        fn=@env.processing_path.ao + '/' \ +        + @fns + '.meta' +        File.new(fn,'w+') +      end +      def file_meta_idx_html +        fn=@env.processing_path.ao + '/' \ +        + @fns + '.idx.html' +        File.new(fn,'w+') +      end +      self +    end +    def file_note +      fn=Dir.pwd + '/' \ +      + @fns + '.fn' +      File.new(fn,'w+') +    end +    def meta +      @env.processing_path.ao + '/' \ +      + @fns + '.meta' +    end +    def file_semantic +      fn='./semantic.yaml' +      @@filename_semantic=File.new(fn,'w+') +    end +    def file_rss +      fn='./semantic.xml' +      @@filename_rss=File.new(fn,'w+') +    end +    def epub +      @pth=@env.processing_path.epub +      def xhtml_index +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/index.xhtml' +        File.new(fn,'w+') +      end +      def xhtml_cover_image +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/cover_image.xhtml' +        File.new(fn,'w+') +      end +      def xhtml_segtoc +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/toc.xhtml' +        File.new(fn,'w+') +      end +      def mimetype  #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype +        File.new("#{@pth}/mimetype",'w') +      end +      def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/' \ +        + Ep[:f_opf] +        File.new(fn,'w') +      end +      def toc_ncx  #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/' \ +        + Ep[:f_ncx] +        File.new(fn,'w') +      end +      def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml +        fn=@pth + '/META-INF/container.xml' +        File.new(fn,'w') +      end +      def xhtml_css #fixed epub xhtml css +        fn=@pth + '/' \ +        + Ep[:d_oebps] + '/css/xhtml.css' +        File.new(fn,'w') +      end +      self +    end +    def file_texinfo +      fn=@env.processing_path.texinfo + '/' \ +      + @fnb + '.texinfo' +      File.new(fn,'w+') +    end +  end +end +module SiSU_Filename_Lang +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class FilenameLanguageCodeInsert +    def initialize(opt,lng=nil) +      @opt=opt +      @lng=lng ||=opt.lng +    end +    def language_code_insert +      if @opt.dir_structure_by ==:language \ +      or ((@opt.dir_structure_by ==:filetype \ +      || @opt.dir_structure_by ==:filename) \ +      and (@opt.lingual ==:mono \ +      && @lng == @opt.act[:default_language][:code])) +        '' +      elsif (@opt.dir_structure_by ==:filetype \ +      || @opt.dir_structure_by ==:filename) \ +      and not @opt.lingual ==:mono +        '.' + @lng +      else +        '.' + @lng +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_filemap.rb b/lib/sisu/v6/se_filemap.rb new file mode 100644 index 00000000..987f8f4f --- /dev/null +++ b/lib/sisu/v6/se_filemap.rb @@ -0,0 +1,247 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_filemap.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_File_Map +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class FileMap < SiSU_Info_Env::InfoEnv                   # se_info_env.rb +    attr_accessor :local_sisu_source +    def initialize(opt='') #watch / REVIEW +      super() +      @opt=opt #,opt.fns,opt.cmd +      @env=(@opt.fns && !(@opt.fns.empty?) \ +      ? (SiSU_Env::InfoEnv.new(@opt.fns)) +      : (SiSU_Env::InfoEnv.new('dummy.sst'))) +      ft=[] +      if @opt.act[:ao][:set]==:on +        @md=SiSU_Param::Parameters.new(@opt).get +        if @md \ +        and defined? @md.fn \ +        and @md.fn        # used for by_language_code? +          if @md.opt.act[:html][:set]==:on                 #% --html, -h -H +            ft << @md.fn[:html] +          end +          if @md.opt.act[:concordance][:set]==:on          #% --concordance, -w +            ft << @md.fn[:concordance] +          end +          if @md.opt.act[:manifest][:set]==:on             #% --manifest, -y +            ft << @md.fn[:manifest] +          end +          if @md.opt.act[:txt][:set]==:on                  #% --txt, -t -a +            ft << @md.fn[:plain] +          end +          if @md.opt.act[:txt_textile][:set]==:on          #% --textile +            ft << @md.fn[:txt_textile] +          end +          if @md.opt.act[:txt_asciidoc][:set]==:on         #% --asciidoc +            ft << @md.fn[:txt_asciidoc] +          end +          if @md.opt.act[:txt_markdown][:set]==:on         #% --markdown +            ft << @md.fn[:txt_markdown] +          end +          if @md.opt.act[:txt_rst][:set]==:on              #% --rst, --rest +            ft << @md.fn[:txt_rst] +          end +          if @md.opt.act[:xhtml][:set]==:on                #% --xhtml, -b xhtml +            ft << @md.fn[:xhtml] +          end +          if @md.opt.act[:epub][:set]==:on                 #% --epub, -e +            ft << @md.fn[:epub] +          end +          if @md.opt.act[:manpage][:set]==:on              #% --manpage, -i +            ft << @md.fn[:manpage] +          end +          if @md.opt.act[:hash_digests][:set]==:on         #% --hash-digests, -N digest tree +            ft << @md.fn[:digest] +          end +          if @md.opt.act[:odt][:set]==:on                  #% --odt, -o opendocument +            ft << @md.fn[:odf] +          end +          if @md.opt.act[:pdf][:set]==:on                  #% --pdf-l --pdf, -p latex/ texpdf +            ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] +          end +          if @md.opt.act[:share_source][:set]==:on +            ft << @md.fns +          end +          if @md.opt.act[:sisupod][:set]==:on              #% --sisupod, -S make sisupod +            ft << @md.fn[:sisupod] +          end +          if @md.opt.act[:xml_sax][:set]==:on              #% --xml-sax, -x xml sax type +            ft << @md.fn[:sax] +          end +          if @md.opt.act[:xml_dom][:set]==:on              #% --xml-dom, -X xml dom type +            ft << @md.fn[:dom] +          end +          if @md.opt.act[:xml_docbook_book][:set]==:on     #% --xml-docbook-book +            ft << @md.fn[:xml_docbook_book] +          end +          if @md.opt.act[:xml_fictionbook][:set]==:on      #% --xml-fictionbook +            ft << @md.fn[:xml_fictionbook] +          end +          if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu +            ft << @md.fn[:xml_scaffold_structure_sisu] +          end +          if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse +            ft << @md.fn[:xml_scaffold_structure_collapse] +          end +          @fnb=@md.fnb +        else   # still needed where/when param is not parsed +          if @opt.act[:html][:set]==:on                    #% --html, -h -H +            ft << '.html' << '.html.??' +          end +          if @opt.act[:concordance][:set]==:on             #% --concordance, -w +            ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' +          end +          if @opt.act[:manifest][:set]==:on                #% --manifest, -y +            ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' +          end +          if @opt.act[:txt][:set]==:on                     #% --txt, -t -a +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_textile][:set]==:on             #% --textile +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_asciidoc][:set]==:on            #% --asciidoc +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_markdown][:set]==:on            #% --markdown +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:txt_rst][:set]==:on                 #% --rst, --rest +            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' +          end +          if @opt.act[:xhtml][:set]==:on                   #% --xhtml, -b xhtml +            ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' +          end +          if @opt.act[:epub][:set]==:on                    #% --epub, -e +            ft  << @fnb << '.epub' +          end +          if @opt.act[:manpage][:set]==:on                 #% --manpage, -i +            ft << '.1' << '??.man.1' << 'man.??.1' +          end +          if @opt.act[:hash_digests][:set]==:on            #% --hash-digests, -N digest tree +            ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' +          end +          if @opt.act[:odt][:set]==:on                     #% --odt, -o opendocument +            ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' +          end +          if @opt.act[:pdf][:set]==:on                     #% --pdf-l --pdf, -p latex/ texpdf +            ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' +          end +          if @opt.act[:share_source][:set]==:on +            ft << '.sst' << '.ssi' << '.ssm' +          end +          if @opt.act[:sisupod][:set]==:on                 #% --sisupod, -S make sisupod +            ft << '.zip' +          end +          if @opt.act[:xml_sax][:set]==:on                 #% --xml-sax, -x xml sax type +            ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' +          end +          if @opt.act[:xml_dom][:set]==:on                 #% --xml-dom, -X xml dom type +            ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' +          end +          if @opt.act[:xml_docbook_book][:set]==:on        #% --xml-docbook-book +            ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml' +          end +          if @opt.act[:xml_fictionbook][:set]==:on         #% --xml-fictionbook +            ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml' +          end +          if @opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu +            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' +          end +          if @opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse +            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' +          end +        end +        ft=ft.uniq +        filetypes=ft.join(',') +        @filetypes=if filetypes !~/..+/ then ''   # -r called alone, copy all +        elsif @opt.cmd =~/u/            then ''   # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u +        elsif filetypes =~/\S+?,\S+/    then '*{' + filetypes + '}' # more than one relevant file type +        else                                 '*' + filetypes # one relevant file type +        end +        @source_path=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/#{@fnb}" +        : @env.path.output) +        @source_path_epub=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/epub" +        : @env.path.output_epub) +        @source_path_src=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/src" +        : @env.path.output_src) +        @source_path_pod=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/pod" +        : @env.path.output_pod) +        @source_path_harvest=(@fnb && !(@fnb.empty?) \ +        ? "#{@env.path.output}/manifest" +        : @env.path.output_harvest) +        @local_sisu_source=(@filetypes =~/\S/) \ +        ? "#{@source_path}/#{@filetypes}" +        : @source_path +      end +      if @opt.act[:rsync][:set]==:on +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_get_init.rb b/lib/sisu/v6/se_get_init.rb new file mode 100644 index 00000000..f7fb213c --- /dev/null +++ b/lib/sisu/v6/se_get_init.rb @@ -0,0 +1,235 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_get_init.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Get_Init +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_system'                        # se_info_system.rb +  @@noyaml=false +  class GetInit < SiSU_Info_Sys_Gen::InfoSystemGen         # se_info_system.rb +    @@noyaml=false +    @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil +    @@ad={ promo: nil, promo_list: nil, flag_promo: false } +    @@sdmd=nil +    attr_accessor :yaml +    def initialize +      super() +        @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory +          false +        else +          @@sdmd=$sisu_document_markup_directory +          true +        end +    end +    def tex +      @@tx ||=SiSU_Viz::TeX.new +    end +    def rc_path_options +      [ +        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", +        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", +        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", +        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", +        "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", +        "#{@@home}/.sisu", +        "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", +        "#{@@sisu_etc}", +      ] +    end +    def sisu_document_make +      def makefile_name +        S_CONF[:header_make] +      end +      def makefile +        rc_path_options.each do |v| +          if FileTest.exist?("#{v}/#{makefile_name}") +            @sisu_make_path=v +            break +          end +        end +        @sisu_make_file_path=@sisu_make_path \ +        ? "#{@sisu_make_path}/#{makefile_name}" +        : nil +      end +      def makefile_read +        if makefile +          sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8') +          @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m) +        end +        @sisu_doc_makefile +      end +      self +    end +    def sisu_yaml +      def rc +        if @markup_dir_changed_ +          rc_path_options.each do |v| +            if @@noyaml \ +            or FileTest.exist?("#{v}/noyaml") +              STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml +              @@noyaml=true +              break +            else +              f=S_CONF[:rc_yml] +              p_f="#{v}/#{f}" +              if FileTest.exist?(p_f) +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@sisurc_path=v +                @@rc=YAML::load(File::open(p_f)) +                break +              end +              unless @@rc +                f='sisurc.yaml' +                p_f="#{v}/#{f}" +                if FileTest.exist?(p_f) +                  begin +                    require 'yaml' +                  rescue LoadError +                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                      error('yaml NOT FOUND (LoadError)') +                  end +                  @@sisurc_path=v +                  @@rc=YAML::load(File::open(p_f)) +                  break +                end +              end +            end +          end +        end +        @@rc +      end +      def rc_path +        rc +        @@sisurc_path +      end +      self +    end +    def ads #WORK AREA +      tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' +      if @markup_dir_changed_ +        @ad_path=[ +          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", +          "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", +          "#{@@home}/.sisu/skin/yml", +          "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", +          "#{@@sisu_etc}/skin/yml", +        ] +        @ad_path.each do |v| +          if @@noyaml \ +          or FileTest.exist?("#{v}/noyaml") +            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml +            @@noyaml=true +            break +          else +            if FileTest.exist?("#{v}/list.yml") +              unless @@ad[:promo_list] +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) +              end +              @@ad[:flag_promo]=true +              break +            end +            @@ad[:flag_promo]=false +          end +        end +        @ad_path.each do |v| +          if @@noyaml \ +          or FileTest.exist?("#{v}/noyaml") +            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml +            @@noyaml=true +            break +          else +            if FileTest.exist?("#{v}/promo.yml") +              unless @@ad[:promo] +                begin +                  require 'yaml' +                rescue LoadError +                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +                    error('yaml NOT FOUND (LoadError)') +                end +                @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) +              end +              @@ad[:flag_promo]=true +              break +            end +            @@ad[:flag_promo]=false +          end +        end +      end +      @@ad +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_info_env.rb b/lib/sisu/v6/se_info_env.rb new file mode 100644 index 00000000..a03c7d65 --- /dev/null +++ b/lib/sisu/v6/se_info_env.rb @@ -0,0 +1,2172 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_info_env.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +@@current_document=Dir.pwd #nil #'' +module SiSU_Info_Env +  require_relative 'se_envcall'                            # se_envcall.rb +  begin +    require 'singleton' +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton or fileutils NOT FOUND (LoadError)') +  end +  class InfoEnv < SiSU_Env_Call::EnvCall                   # se_envcall.rb +    begin +      require 'pathname' +      require 'fileutils' +        include FileUtils +    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,: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) +      super() #you may not want to re-execute this static info so frequently! +      @init=SiSU_Env::GetInit.new #SiSU_Get_Init::GetInit +      @fns,@md=fns,md +      @env=SiSU_Env::EnvCall.new(fns) if fns #SiSU_Env_Call::EnvCall +      fnb=if @md \ +      and defined? @md.fnb +        @md.fnb +      elsif defined? @env.fnb \ +      and @env.fnb +        @env.fnb +      elsif @fns.is_a?(String) \ +      and not @fns.empty? +        m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m +        @fns[m,1] if not @fns.empty? +      end +      if fnb; @@fb ||=fnb +      end +      @sys=SiSU_Info_Sys::InfoSystem.instance +      @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters +      @fixed_websev_root='' # @home +      @pwd=@@pwd=Dir.pwd +      @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' +      m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +      @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd +      pt=Pathname.new(Dir.pwd) +      stub=if output_dir_structure.by_language_code? +        r=Px[:lng_lst_rgx] +        stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/ +          lng=pt.split[-1].to_s +          lng_part='/' + lng +          base=pt.split[0].split[-1].to_s +        else +          lng_part='/' + language_default_set +          base=pt.split[-1].to_s +        end +        base + lng_part +      elsif output_dir_structure.by_filetype? +        pt.split[-1].to_s +      elsif  output_dir_structure.by_filename? +        '' +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn('set output type, by: language, filetype or filename') +      end +      @stub_set_manifest=stub + '/manifest' +    end +    def user +      @sys.user +    end +    def hostname +      @sys.hostname +    end +    def host +      @sys.host +    end +    def arch +      @sys.arch +    end +    def rbver +      @sys.rbver +    end +    def locale +      @sys.locale +    end +    def concord_max +      ((defined? @rc['processing']['concord_max']) \ +      && @rc['processing']['concord_max']) \ +      ? @rc['processing']['concord_max'] +      : (defaults[:concord_max]) +    end +    def language_default_set           #set directory (default) language +      ((defined? @rc['default']['language']) \ +      && @rc['default']['language'] =~/\S+/) \ +      ? @rc['default']['language'] +      : 'en' +    end +    def markup_emphasis +      if defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/bold/ +        'bold' +      elsif defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/italic/ +        'italics' +      elsif defined? @rc['default']['emphasis'] \ +      and @rc['default']['emphasis'] \ +      and @rc['default']['emphasis']=~/underscore/ +        'underscore' +      else 'bold' +      end +    end +    def plaintext_wrap +      ((defined? @rc['default']['text_wrap']) \ +      && (@rc['default']['text_wrap']) \ +      && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ +      && (@rc['default']['text_wrap'].to_i > 19) \ +      && (@rc['default']['text_wrap'].to_i < 201)) \ +      ? @rc['default']['text_wrap'].to_i +      : 78 +    end +    def current_document +      @@current_document||=Dir.pwd +      @@current_document +    end +    def stub_pwd                       #200412 +      @stub_pwd +    end +    def base_markup_dir_stub +      @base_markup_dir_stub +    end +    def stub_md_harvest                #watch +      @stub_set_manifest +    end +    def stub_src +      @stub_src +    end +    def stub_pod +      @stub_pod +    end +    def sisupod_v4(opt) +      #processing_path.processing +      #  sisupod +      #    doc/ +      #      manifest.txt +      #      en/content.sst                [file content] +      #      fr/content.sst +      #      _sisu +      #        sisu_document_make +      #        image@ (ln -s ../../image) +      #        audio@ (ln -s ../../audio) +      #        video@ (ln -s ../../video) +      #    image/                          [all images for specific document gathered here] +      #    audio/ +      #    video/ +      spp="#{processing_path.processing}/#{Gt[:sisupod]}" +      sppc="#{spp}/doc/_sisu" +      lng_dirs=[] +      if FileTest.directory?(spp) \ +      or FileTest.file?(spp) +        FileUtils::rm_rf(spp) +      end +      paths=[] +      flv=SiSU_Env::EnvCall.new(opt.fns). +        document_language_versions_found +      flv[:f].each {|l| lng_dirs << l[:l] } +      lng_dirs.uniq.each do |lng| +        paths << "#{spp}/doc/#{lng}" +      end +      paths \ +      << "#{spp}/image" +     #<< "#{spp}/audio" \ +     #<< "#{spp}/video" \ +      paths.each do |x| +        unless FileTest.directory?(x) +          FileUtils::mkdir_p(x) +        end +      end +      if FileTest.directory?(sppc) +        pwd=Dir.pwd +        Dir.chdir(sppc) +        FileUtils::ln_s('../../image', 'image') +       #FileUtils::ln_s('../../audio', 'audio') +       #FileUtils::ln_s('../../video', 'video') +        Dir.chdir(pwd) +      end +    end +    def sisupod_v3(opt) +      #processing_path.processing +      #  sisupod +      #    doc/ +      #      manifest.txt +      #      en/content.sst                [file content] +      #      fr/content.sst +      #      _sisu +      #        skin/ +      #          doc                       [relevant skin if any other than default] +      #        image@ (ln -s ../../image) +      #        audio@ (ln -s ../../audio) +      #        video@ (ln -s ../../video) +      #    image/                          [all images for specific document gathered here] +      #    audio/ +      #    video/ +      spp="#{processing_path.processing}/#{Gt[:sisupod]}" +      sppc="#{spp}/doc/_sisu" +      lng_dirs=[] +      if FileTest.directory?(spp) \ +      or FileTest.file?(spp) +        FileUtils::rm_rf(spp) +      end +      paths=[] +      flv=SiSU_Env::EnvCall.new(opt.fns). +        document_language_versions_found +      flv[:f].each {|l| lng_dirs << l[:l] } +      lng_dirs.uniq.each do |lng| +        paths << "#{spp}/doc/#{lng}" +      end +      paths \ +      << "#{spp}/image" \ +      << "#{sppc}/skin/doc" \ +      << "#{sppc}/skin/dir" \ +      << "#{sppc}/skin/site" +     #<< "#{spp}/audio" \ +     #<< "#{spp}/video" \ +      paths.each do |x| +        unless FileTest.directory?(x) +          FileUtils::mkdir_p(x) +        end +      end +      if FileTest.directory?(sppc) +        pwd=Dir.pwd +        Dir.chdir(sppc) +        FileUtils::ln_s('../../image', 'image') +       #FileUtils::ln_s('../../audio', 'audio') +       #FileUtils::ln_s('../../video', 'video') +        Dir.chdir(pwd) +      end +    end +    def sisupod_v2 +      #processing_path.processing +      #  sisupod +      #    content.sst              [file content] +      #    filename.sst             [link to content.sst] +      #    _sisu +      #      skin/ +      #        doc                  [relevant skin if any other than default] +      #      image                  [all images for specific document gathered here] +      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      paths=[] +      paths=[ +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site", +        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image" +      ] +      paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) } +    end +    def defaults                       #multiple default directories +      @default_dir ||=@sys.default_dir #DEFAULT_DIR +    end +    def html_seg_title_banner? +      ((defined? @rc['html']['seg_title_banner']) \ +      && @rc['html']['seg_title_banner']==true) \ +      ? @rc['html']['seg_title_banner'] +      : false +    end +    def html_quick_ref? +      ((defined? @rc['html']['quick_ref']) \ +      && @rc['html']['quick_ref']==true) \ +      ? @rc['html']['quick_ref'] +      : false +    end +    def html_minitoc? +      if defined? @rc['html']['minitoc'] \ +      and @rc['html']['minitoc'].is_a?(String) +        @rc['html']['minitoc'] +      else false +      end +    end +    def manifest_minitoc? +      if defined? @rc['manifest']['minitoc'] \ +      and @rc['manifest']['minitoc'].is_a?(String) +        @rc['manifest']['minitoc'] +      else false +      end +    end +    def build +      def omit_list +        @off_list ||=if defined? @rc['omit_list'] \ +        and @rc['omit_list'].is_a?(String) +          @rc['omit_list'] +        elsif defined? @rc['omit']['list'] \ +        and @rc['omit']['list'].is_a?(String) +          @rc['omit']['list'] +        else +          nil +        end +      end +      def listed?(test) #fix +        listed=if omit_list +          x=(omit_list.scan(/\b#{test}\b/)).join +          test==x \ +          ? true +          : false +        else +          false +        end +        listed +      end +      def ocn? +        if (defined? @rc['omit']['ocn'] \ +        and not @rc['omit']['ocn'].nil?) \ +        or listed?('ocn') +          :off +        else +          :na +        end +      end +      def toc? +        if (defined? @rc['omit']['toc'] \ +        and not @rc['omit']['toc'].nil?) \ +        or listed?('toc') +          :off +        else +          :na +        end +      end +      def manifest? +        if (defined? @rc['omit']['manifest'] \ +        and not @rc['omit']['manifest'].nil?) \ +        or listed?('manifest') +          :off +        else +          :na +        end +      end +      def links_to_manifest? +        if (defined? @rc['omit']['links_to_manifest'] \ +        and not @rc['omit']['links_to_manifest'].nil?) \ +        or (listed?('links_to_manifest') \ +        ||  listed?('manifest_links')) +          :off +        else +          :na +        end +      end +      def metadata? +        if (defined? @rc['omit']['metadata'] \ +        and not @rc['omit']['metadata'].nil?) \ +        or listed?('metadata') +          :off +        else +          :na +        end +      end +      def minitoc? +        if (defined? @rc['omit']['minitoc'] \ +        and not @rc['omit']['minitoc'].nil?) \ +        or (listed?('minitoc')) +          :off +        else +          :na +        end +      end +      def manifest_minitoc? +        if (defined? @rc['omit']['manifest_minitoc'] \ +        and not @rc['omit']['manifest_minitoc'].nil?) \ +        or listed?('manifest_minitoc') +          :off +        else +          :na +        end +      end +      def html_minitoc? +        if (defined? @rc['omit']['html_minitoc'] \ +        and not @rc['omit']['html_minitoc'].nil?) \ +        or (listed?('html_minitoc') \ +        || listed?('minitoc')) +          :off +        else +          :na +        end +      end +      def html_navigation? +        if (defined? @rc['omit']['html_navigation'] \ +        and not @rc['omit']['html_navigation'].nil?) \ +        or listed?('html_navigation') +          :off +        else +          :na +        end +      end +      def html_navigation_bar? +        if (defined? @rc['omit']['html_navigation_bar'] \ +        and not @rc['omit']['html_navigation_bar'].nil?) \ +        or listed?('html_navigation_bar') +          :off +        else +          :na +        end +      end +      def segsubtoc? +        if (defined? @rc['omit']['segsubtoc'] \ +        and not @rc['omit']['segsubtoc'].nil?) \ +        or listed?('segsubtoc') +          :off +        else +          :na +        end +      end +      def html_right_pane? +        if (defined? @rc['omit']['html_right_pane'] \ +        and not @rc['omit']['html_right_pane'].nil?) \ +        or listed?('html_right_pane') +          :off +        else +          :na +        end +      end +      def html_top_band? +        if (defined? @rc['omit']['html_top_band'] \ +        and not @rc['omit']['html_top_band'].nil?) \ +        or listed?('html_top_band') +          :off +        else +          :na +        end +      end +      def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line +        if (defined? @rc['omit']['search_form'] \ +        and not @rc['omit']['search_form'].nil?) \ +        or listed?('search_form') +          :off +        else +          :na +        end +      end +      def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line +        if (defined? @rc['omit']['html_search_form'] \ +        and not @rc['omit']['html_search_form'].nil?) \ +        or listed?('html_search_form') +          :off +        else +          :na +        end +      end +      self +    end +    def odt_ocn? +      ((defined? @rc['odt']['ocn']) \ +      && @rc['odt']['ocn']==false) \ +      ? @rc['odt']['ocn'] +      : true +    end +    def xml_docbook_ocn? +      ((defined? @rc['xml_docbook']['ocn']) \ +      && @rc['xml_docbook']['ocn']==false) \ +      ? @rc['xml_docbook']['ocn'] +      : true +    end +    def xml_fictionbook_ocn? +      ((defined? @rc['xml_fictionbook']['ocn']) \ +      && @rc['xml_fictionbook']['ocn']==false) \ +      ? @rc['xml_fictionbook']['ocn'] +      : true +    end +    def xml_scaffold_ocn? +      ((defined? @rc['xml_scaffold']['ocn']) \ +      && @rc['xml_scaffold']['ocn']==false) \ +      ? @rc['xml_scaffold']['ocn'] +      : true +    end +    def plaintext_ocn? +      ((defined? @rc['plaintext']['ocn']) \ +      && @rc['plaintext']['ocn']==false) \ +      ? @rc['plaintext']['ocn'] +      : true +    end +    def textile_ocn? +      ((defined? @rc['textile']['ocn']) \ +      && @rc['textile']['ocn']==true) \ +      ? @rc['textile']['ocn'] +      : false +    end +    def asciidoc_ocn? +      ((defined? @rc['asciidoc']['ocn']) \ +      && @rc['asciidoc']['ocn']==true) \ +      ? @rc['asciidoc']['ocn'] +      : false +    end +    def markdown_ocn? +      ((defined? @rc['markdown']['ocn']) \ +      && @rc['markdown']['ocn']==true) \ +      ? @rc['markdown']['ocn'] +      : false +    end +    def rst_ocn? +      ((defined? @rc['rst']['ocn']) \ +      && @rc['rst']['ocn']==true) \ +      ? @rc['rst']['ocn'] +      : false +    end +    def widget #needs (md) #move +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @ad=SiSU_Env::GetInit.new.ads +      @vz=SiSU_Viz::Defaults.new +      @flag={ +        ad: false, +        md: false, +        sk: false, +        rc: false +      } +      def promo? +        @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] +          @flag[:md]=true +          true +        elsif defined? @vz.widget_promo \ +        and not @vz.widget_promo.nil? \ +        and @vz.widget_promo.is_a?(Array) \ +        and @vz.widget_promo.length > 0 +          @flag[:sk]=true +          true +        elsif defined? @rc['html']['promo'] \ +        and not @rc['html']['promo'].nil? \ +        and @rc['html']['promo'].length > 0 +          @flag[:rc]=true +          true +        else false +        end +        @flag +      end +      def search? +        searches=['sisu'] +        flag=false +        if defined? @rc['search'] +          searches.each do |type| +            flag=if defined? @rc['search'][type] \ +            and defined? @rc['search'][type]['action'] \ +            and @rc['search'][type]['flag']==true \ +            and @rc['search'][type]['action'] =~/https?:\/\// +              flag=if promo?[:ad] +                false +              elsif defined? @vz.widget_search \ +              and @vz.widget_search==true +                true +              elsif defined? @rc['search'][type]['flag'] \ +              and @rc['search'][type]['flag']==true +                true +              else false +              end +            else false +            end +          end +        else false +        end +        flag +      end +      def search_fixed? +        searches=['sisu','hyperestraier'] +        flag=if defined? @rc['search'] +          searches.each do |type| +            if defined? @rc['search'][type] \ +            and defined? @rc['search'][type]['action'] \ +            and @rc['search'][type]['action'] =~/https?:\/\// \ +            and defined? @rc['search'][type]['db'] \ +            and @rc['search'][type]['db'] =~/\S+/ +              flag=if promo?[:ad] +                false +              elsif defined? @vz.widget_search \ +              and @vz.widget_search==true +                true +              elsif defined? @rc['search'][type]['flag'] \ +              and @rc['search'][type]['flag']==true +                true +              else false +              end +            else false +            end +          end +        else false +        end +      end +      def search_form(type='sisusearch',action=nil,db=nil,table=false) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form_sisu=if action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget.search? +          db=if rc['search']['sisu']['flag']==true \ +          and rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        elsif defined? rc['search']['sisu']['flag'] \ +        and defined? rc['search']['sisu']['action'] \ +        and rc['search']['sisu']['flag']==true \ +        and rc['search']['sisu']['action'] =~/https?:\/\// +          true +        else false +        end +        if table +          table_open='<td align="center" bgcolor="#ffffff">' +          table_close='</td>' +        else +          table_open='' +          table_close='<br />' +        end +        form=if create_form_sisu \ +        and type=~/sisusearch/ \ +        and defined? rc['search']['sisu'] \ +        and defined? rc['search']['sisu']['action'] +          <<WOK +<!-- SiSU Search --> +#{table_open} +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="ltd" value="1000" /> +<input type="hidden" name="off" value="0" /> +<input type="hidden" name="doc" value="#{@md.fnb}" /><br /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font></form> +#{table_close} +<!-- SiSU Search --> +WOK +        else '' +        end +        form +      end +      def search_form_static(action=nil,db=nil) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form=if rc['search']['sisu']['flag']==true \ +        and action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget.search_fixed? +          db=if rc['search']['sisu']['flag']==true \ +          and rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        else false +        end +        if create_form +          %{<td align="center" bgcolor="#ffffff"> +<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="ltd" value="1000" /> +<input type="hidden" name="off" value="0" /> +<input type="hidden" name="doc" value="#{@md.fnb}" /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> +</td> } +        else '' +        end +      end +      def search_action #check +        if search? +        else '' +        end +      end +      self +    end +    def widget_static +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +      @vz=SiSU_Viz::Defaults.new +      @flag={ ad: false, md: false, sk: false, rc: false } +      def search? +        flag=if defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\// \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ +          flag=if defined? @vz.widget_search \ +          and @vz.widget_search==true +            true +          elsif defined? @rc['search']['sisu']['flag'] \ +          and @rc['search']['sisu']['flag']==true +            true +          else +            false +          end +        else +          false +        end +      end +      def search_fixed? +        flag=if defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\// \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ \ +        and defined? @rc['search']['sisu']['db'] \ +        and @rc['search']['sisu']['db'] =~/\S+/ +          flag=if defined? @vz.widget_search \ +          and @vz.widget_search==true +            true +          elsif defined? @rc['search']['sisu']['flag'] \ +          and @rc['search']['sisu']['flag']==true +            true +          else +            false +          end +        else +          false +        end +      end +      def search_form(action=nil,db=nil) +        rc=SiSU_Env::GetInit.new.sisu_yaml.rc +        create_form=if defined? rc['search']['sisu']['flag'] \ +        and rc['search']['sisu']['flag']==true \ +        and action \ +        and db \ +        and action =~/https?:\/\// \ +        and db =~/\S+/ +          true +        elsif widget_static.search? \ +        and rc['search']['sisu']['flag']==true +          db=if rc['search']['sisu']['db']=~/\S+/ +            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ +            ? rc['search']['sisu']['db'] +            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" +          else nil +          end +          action=rc['search']['sisu']['action'] +          true +        else false +        end +        if create_form \ +        and @fnb \ +        and @fnb=~/\S+/ +          %{<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="hidden" name="doc" value="#{@fnb}" /> +<input type="submit" name="search" value="search doc" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> } +        elsif create_form +          %{<!-- SiSU Search --> +<a name="search"></a> +<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> +<font size="2"> +<input type="text" name="s1" size="24" maxlength="255" /> +<br /> +<input type="hidden" name="db" value="#{db}" /> +<input type="submit" name="search" value="search db" /> +</font> +</form> +<!-- SiSU Search --> } +        else '' +        end +      end +      def search_action #check +        if search? +        else '' +        end +      end +      self +    end +    def source_file_path +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') +      unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" +      else "#{processing_path.composite_file}" +      end +    end +    def source_file_with_path +      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') +      "#{source_file_path}/#{file}" +    end +    def texpdf_hyperlinks(cli) +      @cli=cli +      @hyplnks=if cli != :na +        cli +      elsif (defined? @rc['default']['pdf_hyperlinks']) \ +      && (@rc['default']['pdf_hyperlinks']=~/color/) +        :color +      elsif (defined? @rc['default']['pdf_hyperlinks']) \ +      && (@rc['default']['pdf_hyperlinks'] \ +      =~/(?:no-color|color-off|mono(?:chrome)?)/) +        :mono +      else :na +      end +      def landscape +        if @cli != :na +          @cli +        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ +        && (@rc['default']['pdf_hyperlinks_landscape']=~/color/) +          :color +        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ +        && (@rc['default']['pdf_hyperlinks_landscape'] \ +        =~/(?:no-color|color-off|mono(?:chrome)?)/) +          :mono +        elsif @hyplnks != :na +          @hyplnks +        else :na +        end +      end +      def portrait +        if @cli != :na +          @cli +        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ +        && (@rc['default']['pdf_hyperlinks_portrait']=~/color/) +          :color +        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ +        && (@rc['default']['pdf_hyperlinks_portrait'] \ +        =~/(?:no-color|color-off|mono(?:chrome)?)/) +          :mono +        elsif @hyplnks != :na +          @hyprlnks +        else :na +        end +      end +      self +    end +    def font +      def size(pt=nil) +        if pt && pt != :na +          pt +        elsif defined? @rc['default']['fontsize'] \ +        && @rc['default']['fontsize']=~/\d{1,2}/ +          @rc['default']['fontsize'] +        else :na +        end +      end +      def texpdf +        # you may wish to check selected font against available fonts: +        # fc-list :outline -f "%{family}\n" +        # fc-list :lang=ja +        def main +          (defined? @rc['default']['texpdf_fontface']) \ +          && (@rc['default']['texpdf_fontface']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface'] +          : 'Liberation Sans' +        end +        def sans                       # not used +          (defined? @rc['default']['texpdf_fontface_sans']) \ +          && (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_sans'] +          : 'Liberation Sans' +        end +        def serif                      # not used +          (defined? @rc['default']['texpdf_fontface_serif']) \ +          && (@rc['default']['texpdf_font_serif']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_serif'] +          : 'Liberation Serif' +        end +        def mono +          (defined? @rc['default']['texpdf_fontface_mono']) \ +          && (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_mono'] +          : 'Liberation Mono' +        end +        def cjk +          (defined? @rc['default']['texpdf_fontface_cjk']) \ +          && (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk'] +          : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' +        end +        def cjk_zh +          (defined? @rc['default']['texpdf_fontface_cjk_zh']) \ +          && (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_zh'] +          : 'IPAGothic' +        end +        def cjk_ja +          (defined? @rc['default']['texpdf_fontface_cjk_ja']) \ +          && (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_ja'] +          : 'IPAGothic' +        end +        def cjk_ko +          (defined? @rc['default']['texpdf_fontface_cjk_ko']) \ +          && (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/)  \ +          ? @rc['default']['texpdf_fontface_cjk_ko'] +          : 'IPAGothic' +        end +        def size(pt=nil) +          if pt && pt != :na +            pt +          elsif (defined? @rc['default']['texpdf_fontsize']) \ +          && (@rc['default']['texpdf_fontsize']=~/\d{1,2}/) +            @rc['default']['texpdf_fontsize'] +          elsif (defined? @rc['default']['fontsize']) \ +          && (@rc['default']['fontsize']=~/\d{1,2}/) +            @rc['default']['fontsize'] +          else +            :na +          end +        end +        self +      end +      self +    end +    def path_rel_links +      def html_scroll_2 +        if @env.output_dir_structure.by_language_code? +          '../../' +        elsif @env.output_dir_structure.by_filetype? +          '../' +        else +          '../' +        end +      end +      def html_seg_2 +        if @env.output_dir_structure.by_language_code? +          '../../../' +        elsif @env.output_dir_structure.by_filetype? +          '../../' +        else +          '../' +        end +      end +      def html_scroll_1 +        if @env.output_dir_structure.by_language_code? +          '../' +        elsif @env.output_dir_structure.by_filetype? +          '../' +        else +          './' +        end +      end +      def html_seg_1 +        if @env.output_dir_structure.by_language_code? +          '../../' +        elsif @env.output_dir_structure.by_filetype? +          '../../' +        else +          './' +        end +      end +      self +    end +    def read_source_file_array(fns) +      (fns !~/\.ssm.sst$/) \ +      ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) +      : (IO.readlines( +           "#{processing_path.composite_file}/#{fns}", +           mode: 'r:utf-8', +           cr_newline: true +        )) +    end +    def read_source_file(fns) +      read_source_file_array(fns) +    end +    def read_source_file_string(fns) +      (fns !~/\.ssm.sst$/) \ +      ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) +      : (IO.read( +           "#{processing_path.composite_file}/#{fns}", +           mode: 'r:utf-8', +           cr_newline: true +        )) +    end +    def source_file_processing_array(fns) +      read_source_file_string(fns).split(/\s*\n\s*\n/m) +    end +    def path                           #dir +      def home +        @sys.home +      end +      def sisurc_path +        GetInit.new.sisu_yaml.rc_path +      end +      def pwd +        @sys.pwd +      end +      def stub_pwd +        @stub_pwd +      end +      def base_markup_dir_stub +        @base_markup_dir_stub +      end +      def stub_epub +        @stub_epub +      end +      def stub_src +        @stub_src +      end +      def stub_pod +        @stub_pod +      end +      def etc +        defaults[:sisu_etc]                                                      #live/dynamic +      end +      def arch +        @sys.dir_arch +      end +      def sitearch +        @sys.dir_sitearch +      end +      def bin +        @sys.dir_bin +      end +      def share                        #shared data repository source directory +        #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green). +        #  mark(defaults[:sisu_share]) +        defaults[:sisu_share] +      end +      def style +        if @md \ +        && ((@md.opt.opt_act[:dump][:bool] \ +        &&   @md.opt.opt_act[:dump][:inst]) \ +        ||  (@md.opt.opt_act[:redirect][:bool] \ +        &&   @md.opt.opt_act[:redirect][:inst])) +          'css' +        else +         defaults[:stylesheet_stub] +        end +      end +      def sample_data                  #sample data repository source directory +        defaults[:sample_data_path] +      end +      def rc +        @init.rc_path +      end +      def yamlrc +        GetInit.new.sisu_yaml.rc_path +      end +      def man #check use +        (defined? @rc['webserv']['man']) \ +        ? "#{webserv}/#{@rc['webserv']['man']}" +        : defaults[:webserv_man] +      end +      def webserv_path #testing, check need, remove +        webserv +      end +      def webserv               #separation required for webrick which cannot use path.output (different requirements as no file is passed) +        man_path=if @@man_path.nil? +          man_path=if defined? @rc['webserv']['path'] \ +          and @rc['webserv']['path'] =~/\S\S+/ +            pwd=Dir.pwd +            Dir.chdir(SiSU_Utils::Path.new.base_markup) +            man_path=@@man_path=File.expand_path(@rc['webserv']['path']) +            Dir.chdir(pwd) +            man_path +          else defaults[:webserv_path] +          end +        else @@man_path +        end +        man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1') +        unless FileTest.directory?(man_path) +          FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.") +        end +        @webserv_path=if defined? man_path \ +        and File.writable?("#{man_path}/.") +          man_path #web server path as configured in rc file +        elsif FileTest.directory?(defaults[:webserv_path]) \ +        and File.writable?("#{defaults[:webserv_path]}/.") #web server path default +          defaults[:webserv_path] +        else #create default directory under home and place output there +          unless FileTest.directory?(defaults[:output_local]) +            FileUtils::mkdir_p(defaults[:output_local]) +          end +          defaults[:output_local] +        end +      end +      def webserv_stub_ensure +        FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) +        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}/#{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] +      end +      def webserv_image         #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) +        images=if defined? @rc['webserv']['images'] +          @rc['webserv']['images'] +        else defaults[:images] +        end +        "#{path.webserv}/#{images}" +      end +      def output                #web/webserv output directory... subdirectory into which further subdirectories are made based on file names +        r=Px[:lng_lst_rgx] +        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ +        base_stub=@sys.pwd.gsub(u,'\1') +        if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/ +          "#{path.webserv}/#{Gt[:doc]}" +        else +          "#{path.webserv}/#{base_stub}" +        end +      end +      def feed +        (defined? @rc['webserv']['feed']) \ +        ? ("#{public_output}/#{@rc['webserv']['feed']}") +        : (defaults[:webserv_feed]) +      end +      def feed_home +        "#{public_output}/#{@rc['webserv']['feed_home']}" +      end +      def scripts                                                                #used previously only to include tla version info +        if defined? @rc['project']['path'] +          "#{home}/#{@rc['project']['path']}" +        end +      end +      def cgi +        (defined? @rc['webserv']['cgi']) \ +        ? "#{@rc['webserv']['cgi']}" +        : (defaults[:webserv_cgi]) +      end +      def php +        (defined? @rc['webserv']['php']) \ +        ? "#{public_output}/#{@rc['webserv']['php']}" +        : (defaults[:webserv_php]) +      end +      #% programs +      def output_tell +        url.webserv_map_pwd +      end +      def image_source                 #image repository source directory +        if defined? @rc['image']['path'] \ +        and defined? @rc['image']['public'] +          pth="#{@rc['image']['path']}" +          "#{pth}/#{@rc['image']['public']}" +        else +          "#{share}/image" +        end +      end +      def image_source_sisu_includes +        "#{share}/image" +      end +      def image_source_include         #image repository source directory +        if defined? @rc['image']['path'] \ +        and defined? @rc['image']['public'] \ +        and FileTest.directory?( +          "#{@rc['image']['path']}/#{@rc['image']['public']}" +        )==true +          "#{@rc['image']['path']}/#{@rc['image']['public']}" +        elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true +          "#{@@pwd}/#{defaults[:image_stub]}" +        elsif FileTest.directory?( +          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" +        )==true +          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" +        else +          "#{share}/image" +        end +      end +      def image_external +        "#{processing}/external_document/image" +      end +      def image_source_include_local +        if FileTest.directory?(defaults[:image_local]) +          defaults[:image_local] +        end +      end +      def image_source_include_remote +        if FileTest.directory?(image_external); image_external +        end +      end +      self +    end +    def processing_path +      def encoding +        pth="#{processing}/#{defaults[:processing_encoding]}" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def processing_base_tmp +        defaults[:processing_path_tmp_base] +      end +      def tmp_root_dir +        defaults[:processing_dir_tmp_root] +      end +      def root_dir +        proposed_path_base=if defined? @rc['processing']['path'] \ +        and not @rc['processing']['path'].nil? \ +        and not @rc['processing']['path'].empty? +          x=if @rc['processing']['path'] =~/^(?:~|home)$/ +            home #fix +          else @rc['processing']['path'] +          end +        else nil +        end +        proposed_dir=if defined? @rc['processing']['dir'] \ +        and not @rc['processing']['dir'].nil? \ +        and not @rc['processing']['dir'].empty? +          @rc['processing']['dir'] +        else defaults[:processing_dir] +        end +        v=SiSU_Env::InfoVersion.instance.get_version +        v_dev=(DEVELOPER[:maintenance]==:true) \ +        ? "_#{v[:version]}" +        : '' +        path=if proposed_path_base \ +        and FileTest.directory?(proposed_path_base) \ +        and File.writable?("#{proposed_path_base}/.") +          x=proposed_dir \ +          ? "#{proposed_path_base}/#{proposed_dir}" +          : "#{proposed_path_base}/#{defaults[:processing_dir]}" +        else defaults[:processing_dir_tmp_root] +        end +        path = path + v_dev +      end +      def usr_dir? +        case root_dir +        when /^\/home/ then false +        else                true +        end +      end +      def stub_dir +        (usr_dir?) \ +        ? ("#{root_dir}/#{user}/#{stub_pwd}") +        : ("#{root_dir}/#{stub_pwd}") # 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] +      end +      def processing_sisupod(opt=nil)  #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) +        @opt=opt +        def paths +          processing_path_usr="#{root_dir}/#{user}" +          processing_path_fnb=processing_path_usr \ +            + '/' + Gt[:pods] \ +            + '/' + @opt.fng +          processing_path_sisupod=processing_path_fnb \ +            + '/' + Gt[:sisupod] +          { +            fnb: processing_path_fnb, +            sisupod: processing_path_sisupod, +          } +        end +        def make +          unless FileTest.directory?(root_dir) +            FileUtils::mkdir_p(root_dir) +            File.chmod(0777,root_dir) +          end +          if usr_dir? +            processing_path_usr="#{root_dir}/#{user}" +            FileUtils::mkdir_p(processing_path_usr) \ +              unless FileTest.directory?(processing_path_usr) +            File.chmod(0700,processing_path_usr) +          end +          sisupod_processing_path=paths[:sisupod] +          FileUtils::mkdir_p(sisupod_processing_path) \ +            unless FileTest.directory?(sisupod_processing_path) +          sisupod_processing_path_lng=if defined? @opt.lng +            sisupod_processing_path \ +              + '/' + Gt[:doc] \ +              + '/' + @opt.lng +          else +            sisupod_processing_path \ +              + '/' + Gt[:doc] +          end +          unless FileTest.directory?(sisupod_processing_path_lng) +            #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" +            FileUtils::mkdir_p(sisupod_processing_path_lng) +            File.chmod(0700,sisupod_processing_path_lng) +          end +          sisupod_processing_path +        end +        self +      end +      def processing                   #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) +        unless FileTest.directory?(root_dir) +          FileUtils::mkdir_p(root_dir) +          File.chmod(0777,root_dir) +        end +        if usr_dir? +          processing_path_usr="#{root_dir}/#{user}" +          FileUtils::mkdir_p(processing_path_usr) \ +            unless FileTest.directory?(processing_path_usr) +          File.chmod(0700,processing_path_usr) +        end +        FileUtils::mkdir_p(stub_dir) \ +          unless FileTest.directory?(stub_dir) +        File.chmod(0700,stub_dir) +        path_processing=[ +          stub_dir, +          defaults[:processing_path], +          defaults[:processing_path_home] +        ] +        processing=nil +        path_processing.each do |v|                                              # +          processing=v +          unless FileTest.directory?(processing) +            FileUtils::mkdir_p(processing) +            File.chmod(0700,processing) +          end +          break +        end +        processing +      end +      def ao +        pth=if defined? @rc['processing']['dal'] \ +          and @rc['processing']['dal'].is_a?(String) +          "#{processing}/#{@rc['processing']['dal']}" +        else "#{processing}/#{defaults[:processing_ao]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def tune +        pth=if defined? @rc['processing']['tune'] \ +          and @rc['processing']['tune'].is_a?(String) +          "#{processing}/#{@rc['processing']['tune']}" +        else "#{processing}/#{defaults[:processing_tune]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def composite_file +        pth=processing_path.ao  #"#{processing}/composite" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def git +        pth=if defined? @rc['git']['dir'] \ +        and @rc['git']['dir'].is_a?(String) +          (@rc['git']['dir'] =~/^(?:~|home)$/) \ +          ? home + '/' + Gt[:git] +          : @rc['git']['dir'] + '/' + Gt[:git] +        else defaults[:processing_git] +        end +        unless FileTest.directory?(pth) +          FileUtils::mkdir_p(pth) +          File.chmod(0700,pth) +        end +        pth +      end +      def odf_pth +        pth="#{processing}/odf/#{@fns}" +        pth +      end +      def odf +        odt +      end +      def odt +        pth=odf_pth + '/odt' +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def odf +        pth="#{processing}/odf" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def odt_bld +        FileUtils::rm_rf(processing_path.odt) +        FileUtils::mkdir_p(processing_path.odt) \ +          unless FileTest.directory?(processing_path.odt) +        FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") \ +          unless FileTest.directory?("#{processing_path.odt}/Configurations2") +        FileUtils::mkdir_p("#{processing_path.odt}/META-INF") \ +          unless FileTest.directory?("#{processing_path.odt}/META-INF") +        FileUtils::mkdir_p("#{processing_path.odt}/Pictures") \ +          unless FileTest.directory?("#{processing_path.odt}/Pictures") +        FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") \ +          unless FileTest.directory?("#{processing_path.odt}/Thumbnails") +        processing_path.odt +      end +      def epub +        "#{processing}/epub/#{@fnb}" +      end +      def epub_bld #(md) +        FileUtils::rm_rf(processing_path.epub) \ +          if FileTest.directory?(processing_path.epub) +        FileUtils::mkdir_p(processing_path.epub) \ +          unless FileTest.directory?(processing_path.epub) +        FileUtils::mkdir_p("#{processing_path.epub}/META-INF") \ +          unless FileTest.directory?("#{processing_path.epub}/META-INF") +        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") \ +          unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image") +        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") \ +          unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css") +        processing_path.epub +      end +      def epub_cp_images(md) +        pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        src="#{path.share}/image" +        images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] +        images.each do |i| #move to avoid repeated tests +          if FileTest.file?("#{src}/#{i}") +            FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") \ +              unless FileTest.file?("#{pth}/#{i}") +          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} +          end +        end +        pth +      end +      def tex +        pth=if defined? @rc['processing']['latex'] \ +        and @rc['processing']['latex'].is_a?(String) +          "#{processing}/#{@rc['processing']['latex']}" +        else "#{processing}/#{defaults[:processing_latex]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def texi +        pth=if defined? @rc['processing']['texinfo'] \ +        and @rc['processing']['texinfo'].is_a?(String) +          "#{processing}/#{@rc['processing']['texinfo']}" +        else "#{processing}/#{defaults[:processing_texinfo]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def texinfo                      #texinfo webserv, check +        "#{processing}/#{defaults[:processing_texinfo]}" +      end +      def manpage +        "#{path.output}/man" +      end +      def lout +        pth=if defined? @rc['processing']['lout'] \ +        and @rc['processing']['lout'].is_a?(String) +          "#{processing}/#{@rc['processing']['lout']}" +        else "#{processing}/#{defaults[:processing_lout]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def sql +        pth="#{processing}/sql" +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def sqlite +        pth=if defined? @rc['processing']['sqlite'] \ +        and @rc['processing']['sqlite'].is_a?(String) +          "#{processing}/#{@rc['processing']['sqlite']}" +        else "#{processing}/#{defaults[:processing_sqlite]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      def postgresql +        pth=if defined? @rc['processing']['postgresql'] \ +        and @rc['processing']['postgresql'].is_a?(String) +          "#{processing}/#{@rc['processing']['postgresql']}" +        else "#{processing}/#{defaults[:processing_postgresql]}" +        end +        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) +        pth +      end +      self +    end +    def url +      def hostname +        "http://#{@sys.hostname}" +      end +      def dir_url +        "file://#{path.webserv}/#{stub_pwd}" +      end +      def localhost +        "http://localhost/#{stub_pwd}" +      end +      def local +        "http://#{hostname}/#{@stub_pwd}" +      end +      def root +        if defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/https?:\/\// +          "#{@rc['webserv']['url_root']}/#{@stub_pwd}" +        elsif defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/localhost/ +          "http://localhost/#{@stub_pwd}" +        else "file://#{path.output}" +        end +      end +      def remote +        root +      end +      def txt +        "#{root}/txt" +      end +      def html +        "#{root}/html" +      end +      def epub +        "#{root}/epub" +      end +      def odt +        "#{root}/odt" +      end +      def pdf +        "#{root}/pdf" +      end +      def src_txt +        "#{root}/src" +      end +      def src_pod +        "#{root}/pod" +      end +      def pot +        "#{root}/po4a/pot" +      end +      def po +        "#{root}/po4a/po" +      end +      def webserv_host_base(opt=nil) +        if defined? @rc['webserv']['host'] +          case  @rc['webserv']['host'] +          when /https?:\/\// then @rc['webserv']['host'] +          when /\S+/         then "http://#{@rc['webserv']['host']}" +          else                    defaults[:webserv_host_cgi] +          end +        else                      defaults[:webserv_host_cgi] +        end +      end +      def webserv_cgi(opt=nil)         #web url for local webserv (localhost, or hostname) +        http=if defined? @rc['webserv_cgi']['host'] \ +        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 +          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 +          end +        end +        http=http.strip +      end +      def webserv_base_cgi(opt=nil)    #web url for local webserv (localhost, or hostname) +        http=if opt.mod.inspect =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ +          m=$1 +          (m=~/http\/\/:/) ? m : %{http://#{m}} +        elsif defined? @rc['webserv_cgi']['host'] \ +        and @rc['webserv_cgi']['host'].is_a?(String) +          http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') +          if port.webserv_port_cgi(opt) +            http + @rc['webserv_cgi']['host'] + ':' \ +              + port.webserv_port_cgi(opt) +          else +            http + @rc['webserv_cgi']['host'] +          end +        else +          http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') +          if port.webserv_port_cgi(opt) +            http + webserv_host_base + ':' \ +              + port.webserv_port_cgi(opt) +          else "#{http}#{webserv_host_base}" +          end +        end +        http=http.strip +        #%q{http://#{ENV['HTTP_HOST']}} +      end +      def webrick #must have a port    #REMOVE +        if defined? @rc['webserv_cgi']['host'] \ +        and @rc['webserv_cgi']['host'].is_a?(String) +          http=if @rc['webserv_cgi']['host'] =~/http:\/\// +            'http://' +          elsif @rc['webserv_cgi']['host'] =~/https:\/\// +            'https://' +          else defaults +          end +          "#{http}#{@rc['webserv_cgi']['host']}" +        elsif webserv_host_base \ +        and webserv_host_base.is_a?(String) +          http + webserv_host_base +        else +          http + 'localhost' +        end +      end +      def webserv                      #web url for local webserv (localhost, or hostname) +        if defined? @rc['webserv']['url_root'] \ +        and @rc['webserv']['url_root'] =~/http/ +          # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere +          @rc['webserv']['url_root'] +        elsif path.webserv_dir \ +        and path.webserv =~ /#{path.webserv_dir}/ #revisit +          path.webserv + '/' \ +            + @base_markup_dir_stub. +              gsub(/#{path.webserv_dir}/, +                "#{url.hostname}/#{@stub_pwd}") +        elsif defined? @rc['webserv']['webrick_url'] \ +        and @rc['webserv']['webrick_url']==false +          'file://' + path.webserv +        elsif port.webserv_port_cgi =~/\S+/ +          url.hostname + ':' + port.webserv_port_cgi +        else +          url.hostname +        end +      end +      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}") +        elsif defined? @rc['webserv']['webrick_url'] \ +        and @rc['webserv']['webrick_url']==false +          "file://#{path.webserv}" +        else "#{url.webrick_base}" +        end +      end +      def webserv_files_from_db(opt=nil) #sort this out, messy +        if opt.mod.inspect =~/--webserv-output[=-]["']?(\S+)["']+/ +          m=$1 +          (m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}} +        else +          show_output_on=if defined? @rc['webserv_cgi']['show_output_on'] +            @rc['webserv_cgi']['show_output_on'] +          elsif  defined? @rc['webserv_cgi']['file_links'] +            @rc['webserv_cgi']['file_links'] +          else '' +          end +          m=case show_output_on +          when /webserv_cgi/ then url.webserv_base_cgi(opt) +          when /webserv/     then @rc['webserv']['url_root'] +          when /https?:\/\// then @rc['webserv_cgi']['file_links'] +          when /\S+/         then 'http://' + @rc['webserv_cgi']['file_links'] +          else                     webserv_base_cgi(opt) +          end +        end +        #%q{http://#{ENV['HTTP_HOST']}/cgi-bin} +      end +      def cgi_sample_search_form_name(opt=nil) +        if opt.mod.inspect \ +        =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ +          $1 +        elsif not opt.mod.inspect =~/--db[=-]["']?sqlite/ \ +        and defined? @rc['search'] \ +        and defined? @rc['search']['sisu'] \ +        and defined? @rc['search']['sisu']['action'] \ +        and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ +          /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/. +            match(@rc['search']['sisu']['action'])[1] +        else +          (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ +          ? "#{Db[:name_prefix_db]}sqlite.cgi" \ +          :  "#{Db[:name_prefix_db]}pg.cgi" +        end +      end +      def sample_search_form_title(organised_by=:language) +        title=if defined? @rc['search']['sisu']['title'] \ +        and @rc['search']['sisu']['title'] =~/\S+/ +          @rc['search']['sisu']['title'] +        else %{SiSU (generated sample) search form} +        end +        title=title + " (content organised by #{organised_by})" +      end +      def output_tell                  #BROKEN Revisit 2011-02 +        output_type=if defined? @rc['show_output_on'] \ +        and @rc['show_output_on'] \ +        =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ +          @rc['show_output_on'] +        else 'filesystem' +        end +        case output_type +        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 /^localhost/                 then url.localhost +        when /^webrick/                   then url.webrick +        when /^path/                      then url.webserv_map_pwd +        else                                   url.webserv_map_pwd +        end +      end +      def images +        "#{Xx[:html_relative2]}/_sisu/image" +      end +      #def images +      #  '../_sisu/image' +      #end +      def images_local +        if FileTest.directory?(path.image_source_include) +          path.image_source_include +        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/ +            @@local_image=false +          end +          url.images +        end +      end +      def images_external +        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 +            @@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/ +            @@local_image=false +          end +          url.images_external +        end +      end +      def images_epub +        './image' +      end +      self +    end +    def port +      def webrick_port +        if @md \ +        and @md.opt.cmd.inspect=~/-F/ \ +        and @md.opt.mod.inspect=~/port=(\d+)/ +           $1 +        else +          if defined? @rc['webserv_cgi']['port'] +            if @rc['webserv_cgi']['port'].nil? \ +            and (defined? @md.opt.mod \ +            and not @md.opt.mod.nil? \ +            and @md.opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            elsif not @rc['webserv_cgi']['port'].nil? +              @rc['webserv_cgi']['port'] +            else defaults[:webserv_port_cgi] +            end +          else   defaults[:webserv_port_cgi] +          end +        end +      end +      def webserv_port_cgi(opt=nil) +        port=if opt \ +        and opt.cmd.inspect=~/-F/ \ +        and opt.mod.inspect=~/port=(\d+)/ +           $1 +        else +          port=if defined? @rc['webserv_cgi']['port'] +            if @rc['webserv_cgi']['port'].nil? \ +            and (defined? opt.mod \ +            and not opt.mod.nil? \ +            and opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            elsif not @rc['webserv_cgi']['port'].nil? +              @rc['webserv_cgi']['port'] +            else nil +            end +          else +            if (defined? opt.mod \ +            and not opt.mod.nil? \ +            and opt.mod.inspect=~/webrick/) +              defaults[:webserv_port_cgi] +            else nil +            end +          end +        end +      end +      self +    end +    def digest_conf? +      if defined? @rc['default']['digest'] \ +      and @rc['default']['digest'] != nil +        case @rc['default']['digest'] +        when /^sha(?:5|512)?$/ then :sha512 +        when /^sha(?:2|256)?$/ then :sha256 +        when /^md5$/           then :md5 +        else                        :sha256 +        end +      else                          :sha256 +      end +    end +    def digest(opt=nil) +      @opt=opt +      def type +        if @opt +          case @opt.act[:hash_digest_algo] +          when :sha512 then :sha512 +          when :sha256 then :sha256 +          when :md5    then :md5 +          else              digest_conf? +          end +        else                digest_conf? +        end +      end +      def length +        case digest(@opt).type +        when :sha512 then 128 +        when :sha256 then  64 +        when :md5    then  32 +        else               64 +        end +      end +      def pattern +        "[0-9a-f]{#{digest(@opt).length}}" #/[0-9a-f]{#{digest.length}}/ +      end +      self +    end +    def program +      def text_editor +        if defined? @rc['program_select']['editor'] \ +        and @rc['program_select']['editor'] =~/\S\S+/ +          @rc['program_select']['editor'] +        elsif defined? @rc['program_select']['text_editor'] \ +        and @rc['program_select']['text_editor'] =~/\S\S+/ +          @rc['program_select']['text_editor'] +        else 'editor'                                                            #'gvim -c :R -c :S' +        end +      end +      def pdf_viewer +        ((defined? @rc['program_select']['pdf_viewer']) \ +        && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['pdf_viewer'] +        : 'pdf-viewer'                                                        #'evince' +      end +      def web_browser +        if defined? @rc['program_select']['www_browser'] \ +        and @rc['program_select']['www_browser'] =~/\S\S+/ +          @rc['program_select']['www_browser'] +        elsif defined? @rc['program_select']['web_browser'] \ +        and @rc['program_select']['web_browser'] =~/\S\S+/ +          @rc['program_select']['web_browser'] +        else 'x-www-browser'                                                      #'firefox' 'iceweasel' 'kazehakase' 'galeon' +        end +      end +      def www_browser +        web_browser +      end +      def console_web_browser +        if defined? @rc['program_select']['console_www_browser'] \ +        and @rc['program_select']['console_www_browser'] =~/\S\S+/ +          @rc['program_select']['console_www_browser'] +        elsif defined? @rc['program_select']['console_web_browser'] \ +        and @rc['program_select']['console_web_browser'] =~/\S\S+/ +          @rc['program_select']['console_web_browser'] +        else 'console-www-browser'                                             #'lynx' 'links' 'links2' 'elinks' 'w3m' +        end +      end +      def console_www_browser +        web_browser +      end +      def epub_viewer +        ((defined? @rc['program_select']['epub_viewer']) \ +        && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['epub_viewer'] +        : 'ebook-viewer'                                                    #'calibre' 'fbreader' +      end +      def xml_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def docbook_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def fictionbook_viewer +        ((defined? @rc['program_select']['xml_viewer']) \ +        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['xml_viewer'] +        : text_editor +      end +      def xml_editor +        xml_viewer +      end +      def odf_viewer +        ((defined? @rc['program_select']['odf_viewer']) \ +        && @rc['program_select']['odf_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['odf_viewer'] +        : 'lowriter'                                                           #'odf-viewer','oowriter' +      end +      def manpage_viewer +        'man' +      end +      def manpage_generator +        ((defined? @rc['program_select']['man']) \ +        && @rc['program_select']['man'] =~/\S\S+/) \ +        ? @rc['program_select']['man'] +        : 'nroff -man'                                                        #'nroff -man' #'groff -man -Tascii' +      end +      def texinfo +        ((defined? @rc['program_select']['info_viewer']) \ +        && @rc['program_select']['info_viewer'] =~/\S\S+/) \ +        ? @rc['program_select']['info_viewer'] +        : 'pinfo -f'                                                          #'pinfo -f' 'info' 'tkinfo' +      end +      def file_encoding +        is=(defined? @rc['program_set']['file_encoding']) \ +        ? @rc['program_set']['encoding'] : '' +        (is.nil? || is==true) ? 'encoding' : is +      end +      def wc #wordcount +        is=(defined? @rc['program_set']['wc']) \ +          ? @rc['program_set']['wc'] : '' +        (is.nil? || is==true) ? 'wc' : is +      end +      def tidy +        is=(defined? @rc['program_set']['tidy']) \ +          ? @rc['program_set']['tidy'] : nil +        (is.nil? || is==true) ? 'tidy' : is +      end +      def rmagick +        is=(defined? @rc['program_set']['rmagick']) \ +          ? @rc['program_set']['rmagick'] : nil +        (is.nil? || is==true) ? 'rmagick' : is +      end +      def rexml                        #should be part of ruby 1.8 but apparently not always +        is=(defined? @rc['program_set']['rexml']) ? \ +          @rc['program_set']['rexml'] : '' +        (is.nil? || is==true) ? 'rexml' : is +      end +      def pdflatex +        is=(defined? @rc['program_set']['pdflatex']) ? \ +          @rc['program_set']['pdflatex'] : '' +        (is.nil? || is==true) ? 'pdflatex' : is +      end +      def postgresql +        is=(defined? @rc['program_set']['postgresql']) ? \ +          @rc['program_set']['postgresql'] : '' +        (is.nil? || is==true) ? 'postgresql' : is +      end +      def sqlite +        is=(defined? @rc['program_set']['sqlite']) ? \ +          @rc['program_set']['sqlite'] : '' +        (is.nil? || is==true) ? 'sqlite' : is +      end +      self +    end +    def i18n +      def language                     # language settings +        m=/.+\/\S+?\~(\S+)/ +        pwd=Dir.pwd +        conf=(defined? @rc['default']['language']) \ +        ? @rc['default']['language'] : nil +        l=if pwd=~ m    then pwd[m,1]                                        #2 directory: by visible directory name +        elsif conf      then @rc['default']['language']                      #3 config: from sisurc.yaml +        else            defaults[:language]                                  #4 sisu: program default +        end                                                                  #1 document: param gets +        SiSU_Env::StandardiseLanguage.new(l) +      end +      #def multilingual +      #  x=(defined? @rc['output_structure']['multilingual'] \ +      #  && @rc['output_structure']['multilingual'] ==true) \ +      #  ? true : false +      #end +      #def bundle +      #  x=(defined? @rc['output_structure']['bundle'] \ +      #  && @rc['output_structure']['bundle'] ==true) \ +      #  ? true : false +      #end +      def lang_filename(l) +        @lang={} +        x=if output_dir_structure.by_language_code? +          (( defined? @rc['default']['language_file']) \ +          && @rc['default']['language_file'] != nil) \ +          ? @rc['default']['language_file'] +          : 1 +        else 0 +        end +        if (l != defaults[:language_code]) \ +        or (language.code != defaults[:language_code]) #watch +          if x==1    then @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' +          elsif x==2 then @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' +          elsif x==3 then @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" +          else            @lang[:pre],@lang[:mid],@lang[:post]='','','' +          end +        else              @lang[:pre],@lang[:mid],@lang[:post]='','','' +        end +        @lang +      end +      self +    end +    def file_encoding +      is='' +      if defined? @rc['program_set']['file_encoding'] +        is=@rc['program_set']['encoding'] +      end +      if is.nil? \ +      or is==true +        is='encoding' +      end +      is +    end +    def papersize                      # paper settings, default overidden in param if set within document +      (defined? @rc['default']['papersize']) \ +      ? @rc['default']['papersize'].downcase +      : (defaults[:papersize].downcase) +    end +    def odf_structure +      FileUtils::rm_rf(processing_path.processing_path.odf_pth) +      FileUtils::mkdir_p(processing_path.processing_path.odf_pth) +      system( +        "unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}" +      ) +    end +    def sisupod_gen(fns_pod) +      sisupod_gen_v3(fns_pod) +    end +    def sisupod_gen_v3(fns_pod) +      pwd=Dir.pwd +      sisupod_processing_path= +        processing_path.processing + '/' + Gt[:sisupod] +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      unless FileTest.directory?(sisupod_processing_path) +        FileUtils::mkdir_p(sisupod_processing_path) +      end +      f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}") +        "#{Dir.pwd}/#{fns_pod}" +      elsif FileTest.file?(fns_pod) +        fns_pod +      end +      if f_pod \ +      && FileTest.file?(f_pod) +        (SiSU_Env::SystemCall.new.program_found?('tree')) \ +        ? 'tree ' + processing_path.processing + '/' + Gt[:sisupod] +        : '' +        if FileTest.directory?(processing_path.processing) +          Dir.chdir(processing_path.processing) +          system(%{tar xJf #{f_pod}}) +          Dir.chdir(pwd) +        end +        #system(tree)                                                          #enable if (/[vVM]/) +      else +        SiSU_Screen::Ansi.new( +          '', +          '*WARN* file not found: ' + fns_pod +        ).warn unless @cmd=~/q/ +      end +      sisupod_processing_path +    end +    def sisupod_gen_v2(fns_pod) +      sisupod_processing_path= +        processing_path.processing + '/' + Gt[:sisupod] +      if FileTest.directory?(sisupod_processing_path) \ +      or FileTest.file?(sisupod_processing_path) +        FileUtils::rm_rf(sisupod_processing_path) +      end +      unless FileTest.directory?(sisupod_processing_path) +        FileUtils::mkdir_p(sisupod_processing_path) +      end +      (FileTest.file?(fns_pod)) \ +      ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") +      : (SiSU_Screen::Ansi.new( +          '', +          "*WARN* file not found: #{fns_pod}" +        ).warn unless @cmd=~/q/) +      sisupod_processing_path +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_info_port.rb b/lib/sisu/v6/se_info_port.rb new file mode 100644 index 00000000..b616edb9 --- /dev/null +++ b/lib/sisu/v6/se_info_port.rb @@ -0,0 +1,76 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_info_port.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Port +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoPort < SiSU_Info_Env::InfoEnv                  # se_info_env.rb +    def initialize +      @env=SiSU_Env::InfoEnv.new +    end +    def webrick +      @env.port.webrick_port +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_info_system.rb b/lib/sisu/v6/se_info_system.rb new file mode 100644 index 00000000..6f290a4e --- /dev/null +++ b/lib/sisu/v6/se_info_system.rb @@ -0,0 +1,207 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_info_system.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Sys_Gen +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoSystemGen +    begin +      require 'rbconfig' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') +    end +    @@user,       @@home,     @@hostname,     @@pwd,     @@sisu_etc,                            @@host,                @@arch,                @@rbver,          @@dir_arch,               @@dir_sitearch,               @@dir_bin,               @@locale,                @@rc,@@sisurc_path,@@ad= +      ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil, nil,          {} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] +    out=Config::CONFIG['localstatedir'] +    etc=Config::CONFIG['sysconfdir'] + '/sisu' +    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}" +    if @@user +      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 +    processing_pth=tmp_processing_individual +    processing_dir=prcss_dir +    processing_git="#{Dir.pwd}/#{Gt[:grotto]}" +    #user=ENV['USER'] +    port_pgsql=if defined? ENV['PGPORT'] \ +    and not (ENV['PGPORT'].nil? \ +    || ENV['PGPORT'].empty?) \ +    and ENV['PGPORT']=~/^\d+$/ +      ENV['PGPORT'] +    else '5432' +    end +    IMAGES=:images +    SISU_ETC=:sisu_etc +    SISU_SHARE=:sisu_share +    SAMPLE_DATA_PATH=:sample_data_path +    IMAGE_STUB=:image_stub +    STYLESHEET_STUB=:stylesheet_stub +    IMAGE_LOCAL=:image_local +    WEBSERV_PATH=:webserv_path +    WEBSERV_MAN=:webserv_man +    WEBSERV_PHP=:webserv_php +    WEBSERV_CGI=:webserv_cgi +    WEBSERV_RSS=:webserv_rss +    WEBSERV_SQLITE=:webserv_sqlite +    OUTPUT_LOCAL=:output_local +    PROCESSING_DIR=:processing_dir +    PROCESSING_PATH=:processing_path +    PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root +    PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base +    PROCESSING_AO=:processing_ao +    PROCESSING_TUNE=:processing_tune +    PROCESSING_LATEX=:processing_latex +    PROCESSING_TEXINFO=:processing_texinfo +    PROCESSING_LOUT=:processing_lout +    PROCESSING_SQLITE=:processing_sqlite +    PROCESSING_POSTGRESQL=:processing_postgresql +    PROCESSING_ENCODING=:processing_encoding +    PROCESSING_GIT=:processing_git +    PAPERSIZE=:papersize +    #LANGUAGE=:language +    #LANGUAGE_CODE=:language_code +    MULTILINGUAL=:multilingual +    BUNDLE=:bundle +    CONCORD_MAX=:concord_max +    DIGEST=:digest +    WEBSERV_HOST_CGI=:webserv_host_cgi +    WEBSERV_PORT_CGI=:webserv_port_cgi +    POSTGRESQL_USER=:postgresql_user +    POSTGRESQL_PORT=:postgresql_port +    SQLITE_USER=:sqlite_user +    SQLITE_PATH=:sqlite_path +    SQLITE_PORT=:sqlite_port +    DEFAULT_DIR={ +      IMAGES =>                   '_sisu/image', +      SISU_ETC =>                 etc, +      SISU_SHARE =>               share, +      SAMPLE_DATA_PATH =>         data, +      IMAGE_STUB =>               '_sisu/image', +      STYLESHEET_STUB =>          '_sisu/css', +      IMAGE_LOCAL =>              @@pwd + '/_sisu/image', +      WEBSERV_PATH =>             out + '/www', +      #WEBSERV_DIR =>             www, # uncomment for urls... +      #WEBSERV_IMAGE =>            out + '/www/_sisu/image', +      WEBSERV_MAN =>              out + '/www/man', #alter +      WEBSERV_PHP =>              out + '/www/php', +      WEBSERV_CGI =>              '/usr/lib/cgi-bin', +      WEBSERV_RSS =>              out + '/www/feed', +      WEBSERV_SQLITE =>           out + '/www/sqlite', +      OUTPUT_LOCAL =>             @@home + '/sisu_www', +      PROCESSING_DIR =>           processing_dir, +      PROCESSING_PATH =>          processing_pth, +      PROCESSING_DIR_TMP_ROOT  => prcss_dir_tmp_root, +      PROCESSING_PATH_TMP_BASE => processing_pth, +      PROCESSING_AO =>            'ao', +      PROCESSING_TUNE =>          'tune', +      PROCESSING_LATEX =>         'tex', +      PROCESSING_TEXINFO =>       'texinfo', +      PROCESSING_SQLITE =>        'sqlite', +      PROCESSING_POSTGRESQL=>     'postgresql', +      PROCESSING_ENCODING =>      'encoding', +      PROCESSING_GIT =>           processing_git, +      #TEXINFO_STUB =>             'texinfo', +      PAPERSIZE =>                'A4', #A4, US_letter, book_b5, book_a5, US_legal +      #LANGUAGE =>                 'English', +      #LANGUAGE_CODE =>            'en', #change, unecessary duplication though currently used +      MULTILINGUAL =>             false, +      BUNDLE =>                   false, +      CONCORD_MAX =>              260000, +      DIGEST =>                   :sha256, +      WEBSERV_HOST_CGI =>         'http://localhost', +      WEBSERV_PORT_CGI =>         8081, #8111,8123,8081 +      POSTGRESQL_USER =>          @@user, #'ralph', # change user !!! +      POSTGRESQL_PORT =>          port_pgsql, +      #POSGRESQL_LINKS_PATH =>    '', +      SQLITE_USER =>              @@user, +      SQLITE_PATH =>              @@user, #?? +      SQLITE_PORT =>              '**', +    } +    @@default_dir=DEFAULT_DIR +    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +    @@pwd=@pwd=SiSU_Utils::Path.new.base_markup +    attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path +    def initialize +      @user,   @home, @hostname, @pwd, @sisu_etc, @host, @arch, @rbver, @dir_arch, @dir_sitearch, @dir_bin, @locale, @default_dir= +        @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir +      #note rbver is duplicated in InfoVersion +    end +  end +end +module SiSU_Info_Sys +  class InfoSystem < SiSU_Info_Sys_Gen::InfoSystemGen +    include Singleton +    def initialize +      super() +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_load.rb b/lib/sisu/v6/se_load.rb new file mode 100644 index 00000000..69aaf176 --- /dev/null +++ b/lib/sisu/v6/se_load.rb @@ -0,0 +1,114 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_load.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Load +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class Load +    def initialize(prog,mandatory=false) +      @prog,@mandatory=prog,mandatory +    end +    def prog +      load_prog=false +      $:.each do |reqpath| +        if FileTest.exist?("#{reqpath}/#{@prog}.rb") +          load_prog=true +          #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).ok("#{reqpath}/#{@prog}.rb loaded") +          break +        #else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{reqpath}/#{@prog}.rb not found") +        end +      end +      if load_prog \ +      and @prog=~/dbi/ +        begin +          require 'dbi' +        rescue LoadError +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error('dbi NOT FOUND (LoadError)') +        end +      end +      if load_prog +        begin +          require @prog +        rescue LoadError +          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +            error("#{@prog} NOT FOUND (LoadError)") +        end +      else +        @mandatory \ +        ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) +        : '' #(SiSU_Screen::Ansi.new(@prog,"*WARN* #{@prog} load requested").warn) +      end +      load_prog +    end +    def prog? +      load_prog=false +      $:.each do |reqpath| +        if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true +          break +        end +      end +      load_prog +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_processing.rb b/lib/sisu/v6/se_processing.rb new file mode 100644 index 00000000..46bed123 --- /dev/null +++ b/lib/sisu/v6/se_processing.rb @@ -0,0 +1,527 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_processing.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Processing_Settings +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class ProcessingSettings +    def initialize(md) +      @md=md +    end +    def cnf_rc #sisurc.yml +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +    end +    def env_rc #env rc (including sisurc.yml) +      @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) +    end +    def doc_rc #document rc, make instructions +      (defined? @md.make) \ +      ? @md.make +      : nil +    end +    def cmd_rc_act #command-line rc +      @cmd_rc_act=@md.opt.opt_act +    end +    def build +      def ocn? +        if cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def plaintext_ocn? +        if cmd_rc_act[:txt_ocn][:set]==:on \ +        or cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:txt_ocn][:set]==:off \ +        or cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def odt_ocn? +        if cmd_rc_act[:odt_ocn][:set]==:on \ +        or cmd_rc_act[:ocn][:set]==:on +          true +        elsif cmd_rc_act[:odt_ocn][:set]==:off \ +        or cmd_rc_act[:ocn][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.ocn? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.ocn? ==:off +          false +        else +          true +        end +      end +      def html_strict? +        if cmd_rc_act[:html_strict][:set]==:on +          true +        elsif cmd_rc_act[:html_strict][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_strict? \ +        and doc_rc.html_strict? ==:on +          true +        else +          false +        end +      end +      def toc? +        if cmd_rc_act[:toc][:set]==:on +          true +        elsif cmd_rc_act[:toc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.toc? \ +        and doc_rc.toc? ==:off +          false +        elsif env_rc.build.toc? ==:off +          false +        else +          true +        end +      end +      def manifest? +        if cmd_rc_act[:manifest][:set]==:on +          true +        elsif cmd_rc_act[:manifest][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.manifest? \ +        and doc_rc.manifest? ==:off +          false +        elsif env_rc.build.manifest? ==:off +          false +        else +          true +        end +      end +      def links_to_manifest? +        if cmd_rc_act[:links_to_manifest][:set]==:on +          true +        elsif cmd_rc_act[:links_to_manifest][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.links_to_manifest? \ +        and doc_rc.links_to_manifest? ==:off +          false +        elsif env_rc.build.links_to_manifest? ==:off +          false +        else +          true +        end +      end +      def metadata? +        if cmd_rc_act[:metadata][:set]==:on +          true +        elsif cmd_rc_act[:metadata][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.metadata? \ +        and doc_rc.metadata? ==:off +          false +        elsif env_rc.build.metadata? ==:off +          false +        else +          true +        end +      end +      def minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.minitoc? \ +        and doc_rc.minitoc? ==:off +          false +        elsif env_rc.build.minitoc? ==:off +          false +        else +          true +        end +      end +      def manifest_minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:manifest_minitoc][:set]==:on \ +        || cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ +        || cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.manifest_minitoc? \ +        and (doc_rc.manifest_minitoc? ==:off \ +        || doc_rc.minitoc? ==:off) +          false +        elsif env_rc.build.manifest_minitoc? ==:off \ +        || env_rc.build.minitoc? ==:off +          false +        elsif minitoc? == false +          false +        else +          true +        end +      end +      def html_minitoc? +        if html_top_band? == false #one form of navigation necessary +          true +        elsif cmd_rc_act[:html_minitoc][:set]==:on \ +        || cmd_rc_act[:minitoc][:set]==:on +          true +        elsif cmd_rc_act[:html_minitoc][:set]==:off \ +        || cmd_rc_act[:minitoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_minitoc? \ +        and (doc_rc.html_minitoc? ==:off \ +        || doc_rc.minitoc? ==:off) +          false +        elsif env_rc.build.html_minitoc? ==:off \ +        || env_rc.build.minitoc? ==:off +          false +        elsif minitoc? == false +          false +        else +          true +        end +      end +      def html_top_band? +        if cmd_rc_act[:html_top_band][:set]==:on +          true +        elsif cmd_rc_act[:html_top_band][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_top_band? \ +        and doc_rc.html_top_band? ==:off +          false +        elsif env_rc.build.html_top_band? ==:off +          false +        else +          true +        end +      end +      def html_navigation? +        if cmd_rc_act[:html_navigation][:set]==:on +          true +        elsif cmd_rc_act[:html_navigation][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_navigation? \ +        and doc_rc.html_navigation? ==:off +          false +        elsif env_rc.build.html_navigation? ==:off +          false +        else +          true +        end +      end +      def html_navigation_bar? +        if cmd_rc_act[:html_navigation_bar][:set]==:on +          true +        elsif cmd_rc_act[:html_navigation_bar][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_navigation_bar? \ +        and doc_rc.html_navigation_bar? ==:off +          false +        elsif env_rc.build.html_navigation_bar? ==:off +          false +        else +          true +        end +      end +      def search_form? +        if cmd_rc_act[:search_form][:set]==:on +          true +        elsif cmd_rc_act[:search_form][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_search_form? \ +        and doc_rc.search_form? ==:off +          false +        elsif env_rc.build.search_form? ==:off +          false +        else +          true +        end +      end +      def html_search_form? +        if cmd_rc_act[:html_search_form][:set]==:on \ +        || cmd_rc_act[:search_form][:set]==:on +          true +        elsif cmd_rc_act[:html_search_form][:set]==:off \ +        || cmd_rc_act[:search_form][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_search_form? \ +        and (doc_rc.html_search_form? ==:off \ +        || doc_rc.search_form? ==:off) +          false +        elsif env_rc.build.html_search_form? ==:off \ +        || env_rc.build.search_form? ==:off +          false +        elsif search_form? == false +          false +        else +          true +        end +      end +      def html_right_pane? +        if cmd_rc_act[:html_right_pane][:set]==:on +          true +        elsif cmd_rc_act[:html_right_pane][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.html_right_pane? \ +        and doc_rc.html_right_pane? ==:off +          false +        elsif env_rc.build.html_right_pane? ==:off +          false +        else +          true +        end +      end +      def segsubtoc? +        if cmd_rc_act[:segsubtoc][:set]==:on +          true +        elsif cmd_rc_act[:segsubtoc][:set]==:off +          false +        elsif doc_rc.is_a?(Method) \ +        and defined? doc_rc.segsubtoc? \ +        and doc_rc.segsubtoc? ==:off +          false +        elsif env_rc.build.segsubtoc? ==:off +          false +        else +          true +        end +      end +      self +    end +    def ocn_html_identifier +      (build.html_strict?) \ +      ? Mx[:ocn_id_char] +      : '' +    end +    def output_dir_structure +      def by_language_code? +        if cmd_rc_act[:output_by][:set] == :language +          true +        elsif cmd_rc_act[:output_by][:set] == :filetype \ +        or cmd_rc_act[:output_by][:set] == :filename +          false +        elsif cmd_rc_act[:output_by][:set] == :language +          true +        else +          env_rc.output_dir_structure.by_language_code? +        end +      end +      def by_filetype? +        if cmd_rc_act[:output_by][:set] == :filetype +          true +        elsif cmd_rc_act[:output_by][:set] == :language \ +        or cmd_rc_act[:output_by][:set] == :filename +          false +        elsif cmd_rc_act[:output_by][:set] == :filetype +          true +        else +          env_rc.output_dir_structure.by_filetype? +        end +      end +      def by_filename? +        if cmd_rc_act[:output_by][:set] == :filename +          true +        elsif cmd_rc_act[:output_by][:set] == :language \ +        or cmd_rc_act[:output_by][:set] == :filetype +          false +        elsif cmd_rc_act[:output_by][:set] == :filename +          true +        else +          env_rc.output_dir_structure.by_filename? +        end +      end +      def multilingual? +        by_language_code? +      end +      def dump? +        ((cmd_rc_act[:dump][:bool] \ +        &&  cmd_rc_act[:dump][:inst]) \ +        || (env_rc.output_dir_structure.dump?)) \ +        ? true +        : false +      end +      def redirect? +        ((cmd_rc_act[:redirect][:bool] \ +        &&  cmd_rc_act[:redirect][:inst]) \ +        || (env_rc.output_dir_structure.redirect?)) \ +        ? true +        : false +      end +      def dump_or_redirect? +        ((dump?) || (redirect?)) \ +        ? true +        : false +      end +      def by? +        if dump? +          :dump +        elsif redirect? +          :redirect +        elsif by_language_code? +          :language +        elsif by_filetype? +          :filetype +        elsif by_filename? +          :filename +        else #recheck current default +          :language +        end +      end +      self +    end +  end +end +module SiSU_Info_Processing_Flag +  class InfoProcessingFlag +    attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 +    def initialize +      @rc=SiSU_Get_Init::GetInit.new.sisu_yaml.rc +    end +    def color                          #processing flag shortcuts +      (defined? @rc['flag']['color']) \ +      ? @rc['flag']['color'] +      : false +    end +    def cf_0                           #processing flag shortcuts +      if defined? @rc['flag']['default'] \ +      and @rc['flag']['default'].is_a?(String) +        @rc['flag']['default'] +      else #'-NQhewpotbxXdyYv' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest' +      end +    end +    def cf_1                           #processing flag shortcuts +      if defined? @rc['flag']['i'] \ +      and @rc['flag']['i'].is_a?(String) +        @rc['flag']['i'] +      else #'-Qhewpoty' +        '--digest --qrcode --text --html --epub --concordance --pdf --manifest' +      end +    end +    def cf_2                           #processing flag shortcuts +      if defined? @rc['flag']['ii'] \ +      and @rc['flag']['ii'].is_a?(String) +        @rc['flag']['ii'] +      else #'-NQhewpotbxXdy' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --manifest' +      end +    end +    def cf_3                           #processing flag shortcuts +      if defined? @rc['flag']['iii'] \ +      and @rc['flag']['iii'].is_a?(String) +        @rc['flag']['iii'] +      else #'-NQhewpotbxXdyY' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest' +      end +    end +    def cf_4                           #processing flag shortcuts +      if defined? @rc['flag']['iv'] \ +      and @rc['flag']['iv'].is_a?(String) +        @rc['flag']['iv'] +      else #'-NQhewpotbxXdDyY --update' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --postresql --update --manifest' +      end +    end +    def cf_5                           #processing flag shortcuts +      if defined? @rc['flag']['v'] \ +      and @rc['flag']['v'].is_a?(String) +        @rc['flag']['v'] +      else #'-NQhewpotbxXdyYsS' +        '--digest --qrcode --text --html --epub --concordance --pdf --odf --docbook --xhtml --xml-sax --xml-dom --sqlite --manifest --sisupod --source' +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_programs.rb b/lib/sisu/v6/se_programs.rb new file mode 100644 index 00000000..5771c4a4 --- /dev/null +++ b/lib/sisu/v6/se_programs.rb @@ -0,0 +1,384 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_programs.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Sys_Call +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class SystemCall +    @@locale_flag=false +    def initialize(input='',output='',opt_or_cmd='') +      @input,@output=input,output +      (opt_or_cmd.is_a?(SiSU_Commandline::Options)) \ +      ? (@cmd,@opt=opt_or_cmd.cmd,opt_or_cmd) +      : (@cmd,@opt=opt_or_cmd,nil) #cmd.is_a?(String) +      @prog=SiSU_Env::InfoProgram.new +      @sys=SiSU_Info_Sys::InfoSystem.instance +    end +    def program_found?(program) +      found=`which #{program}` #`whereis #{program}` +      (found =~/bin\/#{program}\b/) ? true : false +    end +    def locale                         #locales utf8 or other +      unless @@locale_flag +        @@locale_flag=true +      end +      @sys.locale +    end +    def file_encoding(filename,cmd='') #file encoding +      program='file' +      fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path +      if program_found?(program) +        encoding=%x{file -L #{fnsp}}.strip +        encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'') +        encoding=if encoding \ +        and not encoding.empty? +          encoding +        else 'UTF-8 assumed, encoding undetermined' +        end +        puts encoding if cmd =~/[VM]/ +        encoding +      else encoding='UTF-8 assumed, file encoding check program unavailable' +      end +    end +    def wc                             #word count +      program='wc' +      if program_found?(program) \ +      and locale !~/utf-?8/i +        true +      else +        program_ref="(not available)" unless program_found?(program) +        program_ref="(UTF-8)" if locale =~/utf-?8/i +        false +      end +    end +    def rcs                            #rcs for document markup data +      program='rcs' +      program_ref="\n\t\tdocument version information requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def cvs                            #cvs for document markup data +      program='cvs' +      program_ref="\n\t\tdocument version information requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def zip                            #zip +      program='zip' +      program_ref="\n\t\tused to in the making of number of file formats, odf, epub" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          mark("*WARN* #{program} is not installed #{program_ref}") +        false +      end +    end +    def openssl                        #openssl for digests +      program='openssl' +      program_ref="\n\t\tused to generate requested source document identification digest" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def md5(filename)                  #md5 dgst +      program='openssl' +      program_ref="\n\t\tmd5 digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def sha256(filename)               #sha dgst +      program='openssl' +      program_ref="\n\t\tsha digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def sha512(filename)               #sha dgst +      program='openssl' +      program_ref="\n\t\tsha digest requested" +      if program_found?(program) +        pwd=Dir.pwd +        Dir.chdir(File.dirname(filename)) +        dgst=%x{openssl dgst -sha512 #{File.basename(filename)}}.strip #use file name without file path +        Dir.chdir(pwd) +        dgst.scan(/\S+/) +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def psql                           #psql +      program='psql' +      program_ref="\n\t\tpsql requested" +      if program_found?(program); true +      else +        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +          warn("#{program} is not installed #{program_ref}") +        false +      end +    end +    def create_pg_db(dbname_stub=nil)  #createdb +      unless dbname_stub +        @pwd ||=Dir.pwd +        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m +        dbname_stub=@pwd[m,1] +      end +      program='createdb' +      db_name="#{Db[:name_prefix]}#{dbname_stub}" +      program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" +      (program_found?(program)) \ +      ? system("#{program} #{dbname_name}") +      : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") +    end +    def relaxng(cmd='')                #trang - convert between different schema languages for XML +      program='trang' +      program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" +      (program_found?(program)) \ +      ? system("#{program} #{@input} #{@output}") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) +    end +    def qrencode                       #qrcode - for generating QR code +      program='qrencode' +      program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" +      found=(program_found?(program)) ? true : false +      found \ +      ? (system(%{ +          echo "#{@input}" | #{program} -s 3 -o #{@output} +        })) +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) +      #found +    end +    def imagemagick                    #imagemagick is a image manipulation program +      program='identify' +      #program_ref="\n\t\tsee <http://www.imagemagick.org/>" +      found=(program_found?(program)) ? true : false +      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found +      found +    end +    def graphicksmagick                #graphicsmagick is a image manipulation program +      program='gm' +      #program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" +      found=(program_found?(program)) ? true : false +      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found +      found +    end +    def well_formed?                   #tidy - check for well formed xml xhtml etc. +      program=@prog.tidy +      program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" +      (program_found?(program)) \ +      ? system("#{@prog.tidy} -xml #{@input} > #{@output}") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") +    end +    def tex2pdf_engine +      progs=['xetex','xelatex','pdflatex','pdfetex','pdftex'] +      @pdfetex_flag=false +      @cmd ||='' +      @texpdf=nil +      progs.each do |program| +        if program_found?(program) +          @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/ +          @pdfetex_flag=true +          break +        end +      end +      if @pdfetex_flag==false +        @texpdf=progs.join(', ') +      end +      @texpdf +    end +    def latex2pdf(md,papersize='a4')   #convert from latex to pdf +      tell=if @cmd =~/[MV]/ +        '' +      elsif @cmd =~/[v]/ +        %q{2>&1 | grep -v ' WARNING '} +      else %q{2>&1 | grep -v '$'} +      end +      mode='batchmode' #mode='nonstopmode' +      texpdf=tex2pdf_engine +      if @pdfetex_flag +        texpdf_cmd=case texpdf +        when /xetex/ +          %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} +        when /xelatex/ +          %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} +        when /pdftex/ +          "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" +        when /pdflatex/ +          "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" +        end +        system(texpdf_cmd) +      else STDERR.puts "\t*WARN* none of the following programs are installed: #{@texpdf}" +      end +    end +    def makeinfo                       #texinfo +      program='makeinfo' +      options='' #'--force' #'' +      program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" +      (program_found?(program)) \ +      ? system("#{program} #{options} #{@input}\n") +      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") +    end +    def scp +      puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/ +      puts "scp disabled" +    end +    def rsync(action='',chdir=nil) +      program='rsync' +      if program_found?(program) +        vb=if @cmd =~/q/; 'q' +        elsif @cmd =~/v/; 'v' +        else              '' +        end +        cX=SiSU_Screen::Ansi.new(@cmd).cX +        msg=(@cmd =~/q/) ? '' : %{ && echo " #{cX.grey}OK: #{@input} -> #{@output}#{cX.off}"} +        amp=(@opt \ +        && @opt.files.length > 1) \ +        ? '' +        : ((@cmd =~/[vVM]/) ? '' : '&') +        rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" +        puts rsync_cmd if @cmd =~/[vVM]/ +        dir_change=dir_return=nil +        if not chdir.nil? \ +        && chdir != Dir.pwd +          dir_change=Dir.chdir(chdir) +          dir_return=Dir.pwd +        end +        dir_change if dir_change +        system(" +          #{rsync_cmd} #{msg} #{amp} +        ") +        dir_return if dir_return +      else STDERR.puts "\t*WARN* #{program} not found" +      end +    end +    def rm +      if @cmd =~/^-Z[mMvVq]*$/;      FileUtils::rm_rf(@input) +      elsif @cmd =~/V/;              FileUtils::rm(@input) +      elsif @cmd !~/q/;              FileUtils::rm(@input) +      elsif @cmd =~/q/;              FileUtils::rm(@input) +      else                           STDERR.puts "\t*WARN* operation ignored" +      end +    end +  end +end +module SiSU_Info_Program +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoProgram < SiSU_Info_Env::InfoEnv               # se_info_env.rb +    attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite +    def initialize +      prog=SiSU_Env::InfoEnv.new.program +      @editor,           @wc,    @tidy,    @rexml,    @pdflatex,    @postgresql,    @sqlite= +        prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite +    end +  end +end +module SiSU_Info_Set +  require_relative 'se_info_env'                           # se_info_env.rb +  class InfoSettings < SiSU_Info_Env::InfoEnv              # se_info_env.rb +    def permission?(prog)                                  # program defaults +      (defined? @rc['permission_set'][prog]) \ +      ? @rc['permission_set'][prog] +      : false +    end +    def program?(prog)                                     # program defaults +      (defined? @rc['program_set'][prog]) \ +      ? @rc['program_set'][prog] +      : false +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_remotes.rb b/lib/sisu/v6/se_remotes.rb new file mode 100644 index 00000000..5c2fd86b --- /dev/null +++ b/lib/sisu/v6/se_remotes.rb @@ -0,0 +1,559 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_remotes.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Remote_Host +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  class InfoRemoteHost +    def initialize +      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc +    end +    def remote_host #see InfoRemote remote_host_base_general +      r=[] +      r=if (defined? @rc['remote'] \ +      and @rc['remote'].is_a?(Array)) +        r_array=@rc['remote'] +        r_array.each_with_index do |renv,i| +          r[i]={} +          if defined? renv['user'] \ +          and defined? renv['host'] +          end +          r[i][:user]=renv['user'] +          r[i][:host]=renv['host'] +          r[i][:path]=if defined? renv['path'] +            renv['path'] +          else '' +          end +          r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" +        end +        r +      elsif (defined? @rc['remote'] \ +      and @rc['remote'].is_a?(Hash) \ +      and defined? @rc['remote']['user'] \ +      and defined? @rc['remote']['host']) +        r[0]={} +        r[0][:user]=@rc['remote']['user'] +        r[0][:host]=@rc['remote']['host'] +        r[0][:path]=if defined? @rc['remote']['path'] +          @rc['remote']['path'] +        else '' +        end +        r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}" +        r +      else +        r[0]={} +        r[0][:name]='.' +        r[0][:user]='' +        r[0][:host]='' +        r[0][:path]='' +        #puts "no remote host or user" +        r +      end +    end +    def rhost +      def r1 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) +        : nil +      end +      def r2 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) +        : nil +      end +      def r3 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) +        : nil +      end +      def r4 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) +        : nil +      end +      def r5 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \ +        ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) +        : nil +      end +      def r6 +        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \ +        ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) +         : nil +      end +      self +    end +  end +end +module SiSU_Info_Remote +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_filemap'                            # se_filemap.rb +  begin +    require 'fileutils' +      include FileUtils::Verbose +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('fileutils NOT FOUND (LoadError)') +  end +  class InfoRemote < SiSU_File_Map::FileMap                # se_filemap.rb +    @@flag_remote=false +    begin +      require 'socket' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('socket NOT FOUND (LoadError)') +    end +    def initialize(opt) +      super(opt) # +      @opt=opt +      @rc=GetInit.new.sisu_yaml.rc +    end +    def remote_host_base_general +      SiSU_Env::InfoRemoteHost.new.remote_host +    end +    def remote_host_base +      remote_host_base_general.each do |remote_conn| +        @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ +      end +      remote_host_base_general +    end +    def scp                            #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built +      def document +        self.remote_host_base.each do |remote_conn| +          local_gen=@source_path +          remote_gen=case @opt.cmd +          when /u/ +            remote_conn[:name] + '/' \ +              + @env.path.base_markup_dir_stub + '/.'             #creates remote directory tree, this is not the usual function of u +          when /[abhHNopwxXy]/ +            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 +          local_pod=@source_path_pod +          remote_epub= +            remote_conn[:name] + '/' + @env.path.stub_epub + '/.' +          remote_src= +            remote_conn[:name] + '/' + @env.path.stub_src + '/.' +          remote_pod= +            remote_conn[:name] + '/' + @env.path.stub_pod + '/.' +          src_txt=@opt.fnc +          src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') +          if (local_gen =~/\S/ \ +          and local_gen !~/\/\//) \ +          and (remote_gen =~/\S/ \ +          and remote_gen !~/\/\//) \ +          and @@flag_remote==true \ +          and @opt.cmd !~/U/ +            SiSU_Env::SystemCall.new(local_gen,remote_gen).scp +            if FileTest.file?("#{local_src}/#{src_txt}") +              SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp +            end +            if FileTest.file?("#{local_pod}/#{src_pod}") +              SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp +            end +            if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") +              SiSU_Env::SystemCall.new( +                "#{local_epub}/#{@opt.fnb}.epub", +                remote_epub,@opt.cmd +              ).scp +            end +          elsif  @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "#{local_gen} -> #{remote_gen}" +            if FileTest.file?("#{local_src}/#{src_doc}") +              puts "#{local_src}/#{src_doc}* -> #{remote_src}" +            end +            if FileTest.file?("#{local_pod}/#{src_doc}.txz") +              puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" +            end +          else +            puts 'suspect scp request, ignored' +            puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" +            puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          end +        end +      end +      def site_base                    #base site +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            puts "begin scp_base: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "begin scp_base: #{local} -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          end +        end +      end +      def site_base_all                #base site +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            puts "begin scp_base_all: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "scp_base_all: #{local} -> #{remote}" +            puts "#{local}/_sisu/image_sys/ -> #{remote}" +            puts "#{local}/_sisu/image/ -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      self +    end +    def rsync +      def document +        f=(@opt.act[:ao][:set]==:on) \ +        ? SiSU_Env::FileOp.new(@md) +        : nil +        if f +          self.remote_host_base.each do |remote_conn| +            local_gen=@source_path +            #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/ \ +            and local_gen !~/\/\//) \ +            and (remote_gen =~/\S/ \ +            and remote_gen !~/\/\//) \ +            and @@flag_remote==true \ +            and @opt.cmd !~/U/ +#             SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync +              #delete_extra_files='--delete' # '--delete-after' +              inp=[] +              if (@opt.act[:html][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.html_scroll.dir) +                inp \ +                  << f.output_path.html_seg.rel \ +                  << f.place_file.html_scroll.rel +              end +              if (@opt.act[:concordance][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.html_concordance.dir) +                inp << f.place_file.html_concordance.rel +              end +              if (@opt.act[:epub][:set]==:on \ +              || @opt.cmd =~/^-R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.epub.dir) +                inp << f.place_file.epub.rel +              end +              if (@opt.act[:odt][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.odt.dir) +                inp << f.place_file.odt.rel +              end +              if (@opt.act[:xhtml][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xhtml.dir) +                inp << f.place_file.xhtml.rel +              end +              if (@opt.act[:xml_sax][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_sax.dir) +                inp << f.place_file.xml_sax.rel +              end +              if (@opt.act[:xml_dom][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_dom.dir) +                inp << f.place_file.xml_dom.rel +              end +              if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir) +                inp << f.place_file.xml_scaffold_structure_sisu.rel +              end +              if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir) +                inp << f.place_file.xml_scaffold_structure_collapse.rel +              end +              if (@opt.act[:txt][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.txt.dir) +                inp << f.place_file.txt.rel +              end +              if (@opt.act[:manpage][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.manpage.dir) +                inp << f.place_file.manpage.rel +              end +              if (@opt.act[:texinfo][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.info.dir) +                inp << f.place_file.info.rel +              end +              if (@opt.act[:hash_digests][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.hash_digest.dir) +                inp << f.place_file.hash_digest.rel +              end +              if (@opt.act[:share_source][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.src.dir) +                inp << f.place_file.src.rel +              end +              if (@opt.act[:sisupod][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.sisupod.dir) +                inp << f.place_file.sisupod.rel +              end +              if (@opt.act[:pdf][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) +                inp <<=(@opt.dir_structure_by == :filename) \ +                ? (f.output_path.pdf.rel + '/*.pdf') +                : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf') +              end +              if (@opt.act[:sqlite_discrete][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.sqlite_discrete.dir) +                inp << f.place_file.sqlite_discrete.rel +              end +              if (@opt.act[:qrcode][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.qrcode_md.dir) +                inp \ +                  << f.place_file.qrcode_md.rel \ +                  << f.place_file.qrcode_title.rel +              end +              if (@opt.act[:manifest][:set]==:on \ +              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ +              && FileTest.file?(f.place_file.manifest.dir) +                inp << f.place_file.manifest.rel +              end +              local_gen=if inp.length > 0 +                inp.join(' ') +              else '' +              end +              local_css,images,images_system='','','' +              images=images_skin=images_system=local_css='' +              if @opt.cmd =~/[hwbxX]/ \ +              && (defined? @md.ec[:image]) \ +              && (@md.ec[:image].length > 0) +                images= +                  f.place_file.images.rel + '/' \ +                    + @md.ec[:image].join(" #{f.output_path.images.rel}/") +              end +              if @opt.cmd =~/[yhwbxX]/ \ +              && (defined? @md.ec[:image]) \ +              && (@md.ec[:image].length > 0) +                local_css=f.output_path.css.rel +                images_system='_sisu/image_sys' +              end +              begin +                ##create file structure without copying files?: +                ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/. +                #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} +                #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +                local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css +                SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd). +                  rsync('--relative',f.output_path.base.dir) +              rescue +                p __LINE__.to_s + ':' + __FILE__ +                local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} +                SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +              end +            elsif @opt.cmd =~/U/ +              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +              puts "#{local_gen} -> #{remote_gen}" +              if FileTest.file?("#{local_src}/#{src_doc}") \ +              or FileTest.file?("#{local_src}/#{src_doc}.txz") +                puts "#{local_src}/#{src_doc}* -> #{remote_src}" +              end +            else +              puts 'suspect rsync request, ignored' +              puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" +              puts "permission not granted #{__FILE__} #{__LINE__}" \ +                if @opt.cmd =~/M/ +            end +          end +        end +      end +      def site_harvest +        self.remote_host_base.each do |remote_conn| +          local=@source_path_harvest +          l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" +          lng='en' +          if @env.output_dir_structure.by? == :language +            ldest=lng + '/manifest' +            files= +              ldest + '/authors.html' + ' ' \ +                + ldest + '/topics.html' +          elsif @env.output_dir_structure.by? == :filetype +            ldest="manifest" +            files= +              ldest + '/authors.' + lng + '.html' + ' ' \ +                + ldest + '/topics.' + lng + '.html' +          elsif @env.output_dir_structure.by? == :filename +            files= +              l_rel + '/authors.' + lng + '.html' + ' ' \ +                + l_rel + '/topics.' + lng + '.html' +          end +          remote="#{remote_conn[:name]}/#{@opt.base_stub}" +          if @opt.act[:harvest][:set] \ +          && @opt.act[:rsync][:set] +            (@env.output_dir_structure.by? == :filename) \ +            ? (SiSU_Env::SystemCall.new(files,remote).rsync) +            : (SiSU_Env::SystemCall.new(ldest,remote). +                rsync('--relative',l_rel)) +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "rsync_harvest: #{local} -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      def site_base                    #base site +        ldest='_sisu/*' +        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.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) +        end +      end +      def site_base_sync +        self.remote_host_base.each do |remote_conn| +          local=@source_path +          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 \ +          and @opt.cmd !~/U/ +            delete_extra_files='--delete' # '--delete-after' +            puts "begin rsync_base_sync: #{local} -> #{remote}" +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote). +              rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote). +              rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote). +              rsync(delete_extra_files) +          elsif @opt.cmd =~/U/ +            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +            puts "rsync_base_sync: #{local} -> #{remote}" +            puts "#{local}/_sisu/image_sys/ -> #{remote}" +            puts "#{local}/_sisu/image/ -> #{remote}" +            puts "#{local}/#{@env.path.style}/ -> #{remote}" +          else +            puts "permission not granted #{__FILE__} #{__LINE__}" \ +              if @opt.cmd =~/M/ +          end +        end +      end +      self +    end +    def rsync_sitemaps                 #sitemap directory +      self.remote_host_base.each do |remote_conn| +        local= +          @source_path + '/sitemapindex.xml' +        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) +        elsif @opt.cmd =~/U/ +          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ +          puts "rsync_sitemaps: #{local} -> #{remote}" +        else +          puts "permission not granted #{__FILE__} #{__LINE__}" \ +            if @opt.cmd =~/M/ +        end +      end +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_standardise_lang.rb b/lib/sisu/v6/se_standardise_lang.rb new file mode 100644 index 00000000..f4a6c046 --- /dev/null +++ b/lib/sisu/v6/se_standardise_lang.rb @@ -0,0 +1,182 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_standardise_lang.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +@@lang_info=nil +module SiSU_Standardise_Lang +  class StandardiseLanguage +    require_relative 'i18n'                  # i18n.rb +    def initialize(l='') +      @language=(l.nil? || l.empty?) \ +      ? SiSU_Env::InfoEnv.new.language_default_set +      : l +      @r=%{(?:#{Px[:lng_lst_rgx]})} +      @lang_info=SiSU_i18n::Languages.new +    end +    def lang_lst                       # from i18n +      @@lang_info ||=@lang_info.language.list +    end +    def lang(l='')                     # from i18n +      if l =~/^#{@r}$/ +        @lang_info.language.list[l] +      elsif @language =~/^#{@r}$/ +        @lang_info.language.list[@language] +      else nil +      end +    end +    def language +      lng={} +      case @language +      when /^am$|Amharic/i                    then d,c,l=false,lang_lst['am'][:c],    lang_lst['am'][:n] +      when /^bg$|Bulgarian/i                  then d,c,l=false,lang_lst['bg'][:c],    lang_lst['bg'][:n] +      when /^bn$|Bengali/i                    then d,c,l=false,lang_lst['bn'][:c],    lang_lst['bn'][:n] +      when /^br$|Breton/i                     then d,c,l=false,lang_lst['br'][:c],    lang_lst['br'][:n] +      when /^ca$|Catalan/i                    then d,c,l=false,lang_lst['ca'][:c],    lang_lst['ca'][:n] +      when /^cs$|Czech/i                      then d,c,l=false,lang_lst['cs'][:c],    lang_lst['cs'][:n] +      when /^cy$|Welsh/i                      then d,c,l=false,lang_lst['cy'][:c],    lang_lst['cy'][:n] +      when /^da$|Danish|Dansk/i               then d,c,l=false,lang_lst['da'][:c],    lang_lst['da'][:n] +      when /^de$|German/i                     then d,c,l=false,lang_lst['de'][:c],    lang_lst['de'][:n] +      when /^el$|Greek/i                      then d,c,l=false,lang_lst['el'][:c],    lang_lst['el'][:n] +      when /^en$|English/i                    then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] +      when /^eo$|Esperanto/i                  then d,c,l=false,lang_lst['eo'][:c],    lang_lst['eo'][:n] +      when /^es$|Spanish|Espanol/i            then d,c,l=false,lang_lst['es'][:c],    lang_lst['es'][:n] +      when /^et$|Estonian/i                   then d,c,l=false,lang_lst['et'][:c],    lang_lst['et'][:n] +      when /^eu$|Basque/i                     then d,c,l=false,lang_lst['eu'][:c],    lang_lst['eu'][:n] +      when /^fi$|Finnish|Finsk|Suomi/i        then d,c,l=false,lang_lst['fi'][:c],    lang_lst['fi'][:n] +      when /^fr$|French|Francais/i            then d,c,l=false,lang_lst['fr'][:c],    lang_lst['fr'][:n] +      when /^ga$|Irish/i                      then d,c,l=false,lang_lst['ga'][:c],    lang_lst['ga'][:n] +      when /^gl$|Galician/i                   then d,c,l=false,lang_lst['gl'][:c],    lang_lst['gl'][:n] +      when /^he$|Hebrew/i                     then d,c,l=false,lang_lst['he'][:c],    lang_lst['he'][:n] +      when /^hi$|Hindi/i                      then d,c,l=false,lang_lst['hi'][:c],    lang_lst['hi'][:n] +      when /^hr$|Croatian/i                   then d,c,l=false,lang_lst['hr'][:c],    lang_lst['hr'][:n] +      when /^hy$|Armenian/i                   then d,c,l=false,lang_lst['hy'][:c],    lang_lst['hy'][:n] +      when /^ia$|Interlingua/i                then d,c,l=false,lang_lst['ia'][:c],    lang_lst['ia'][:n] +      when /^is$|Icelandic/i                  then d,c,l=false,lang_lst['is'][:c],    lang_lst['is'][:n] +      when /^it$|Italian/i                    then d,c,l=false,lang_lst['it'][:c],    lang_lst['it'][:n] +      when /^la$|Latin/i                      then d,c,l=false,lang_lst['la'][:c],    lang_lst['la'][:n] +      when /^lo$|Lao/i                        then d,c,l=false,lang_lst['lo'][:c],    lang_lst['lo'][:n] +      when /^lt$|Lithuanian/i                 then d,c,l=false,lang_lst['lt'][:c],    lang_lst['lt'][:n] +      when /^lv$|Latvian/i                    then d,c,l=false,lang_lst['lv'][:c],    lang_lst['lv'][:n] +      when /^ml$|Malayalam/i                  then d,c,l=false,lang_lst['ml'][:c],    lang_lst['ml'][:n] +      when /^mr$|Marathi/i                    then d,c,l=false,lang_lst['mr'][:c],    lang_lst['mr'][:n] +      when /^nl$|Dutch/i                      then d,c,l=false,lang_lst['nl'][:c],    lang_lst['nl'][:n] +      when /^no$|Norwegian|Norsk/i            then d,c,l=false,lang_lst['no'][:c],    lang_lst['no'][:n] +      when /^nn$|Norwegian Nynorsk/i          then d,c,l=false,lang_lst['nn'][:c],    lang_lst['nn'][:n] +      when /^oc$|Occitan/i                    then d,c,l=false,lang_lst['oc'][:c],    lang_lst['oc'][:n] +      when /^pl$|Polish/i                     then d,c,l=false,lang_lst['pl'][:c],    lang_lst['pl'][:n] +      when /^pt$|Portuguese/i                 then d,c,l=false,lang_lst['pt'][:c],    lang_lst['pt'][:n] +      when /^pt_BR$|Portuguese Brazil/i       then d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] +      when /^ro$|Romanian/i                   then d,c,l=false,lang_lst['ro'][:c],    lang_lst['ro'][:n] +      when /^ru$|Russian/i                    then d,c,l=false,lang_lst['ru'][:c],    lang_lst['ru'][:n] +      when /^sa$|Sanskrit/i                   then d,c,l=false,lang_lst['sa'][:c],    lang_lst['sa'][:n] +      when /^se$|Sami/i                       then d,c,l=false,lang_lst['se'][:c],    lang_lst['se'][:n] +      when /^sk$|Slovak/i                     then d,c,l=false,lang_lst['sk'][:c],    lang_lst['sk'][:n] +      when /^sl$|Slovenian/i                  then d,c,l=false,lang_lst['sl'][:c],    lang_lst['sl'][:n] +      when /^sq$|Albanian/i                   then d,c,l=false,lang_lst['sq'][:c],    lang_lst['sq'][:n] +      when /^sr$|Serbian/i                    then d,c,l=false,lang_lst['sr'][:c],    lang_lst['sr'][:n] +      when /^sv$|Swedish|Svensk/i             then d,c,l=false,lang_lst['sv'][:c],    lang_lst['sv'][:n] +      when /^ta$|Tamil/i                      then d,c,l=false,lang_lst['ta'][:c],    lang_lst['ta'][:n] +      when /^te$|Telugu/i                     then d,c,l=false,lang_lst['te'][:c],    lang_lst['te'][:n] +      when /^th$|Thai/i                       then d,c,l=false,lang_lst['th'][:c],    lang_lst['th'][:n] +      when /^tk$|Turkmen/i                    then d,c,l=false,lang_lst['tk'][:c],    lang_lst['tk'][:n] +      when /^tr$|Turkish/i                    then d,c,l=false,lang_lst['tr'][:c],    lang_lst['tr'][:n] +      when /^uk$|Ukranian/i                   then d,c,l=false,lang_lst['uk'][:c],    lang_lst['uk'][:n] +      when /^ur$|Urdu/i                       then d,c,l=false,lang_lst['ur'][:c],    lang_lst['ur'][:n] +      when /^us|American$|/i                  then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] +      when /^vi$|Vietnamese/i                 then d,c,l=false,lang_lst['vi'][:c],    lang_lst['vi'][:n] +      else                                     d,c,l=true, lang_lst['en'][:c],    lang_lst['en'][:n] #default +      end +      lng[:d],lng[:c],lng[:n]=d,c,l +      lng +    end +    def name +      language[:n].downcase +    end +    def title +      language[:n] +    end +    def code +      language[:c] +    end +    def tex_name +      language[:xlp] +    end +    def file_to_language(file)         # used, fix and remove +      m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ +      @language=if file =~m ; file[m,1] +      else '' +      end +      language +    end +    def codes +      # Language List po4a +      #   <http://www.debian.org/international/l10n/po/> +      #   Px[:lng_lst] see constants.rb +      # see polyglossia for subset +      #   <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf> +      # also note ISO_639-2 +      #   <http://en.wikipedia.org/wiki/ISO_639-2> +      #   <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes> +      Px[:lng_lst] # constants.rb +    end +  end +end +__END__ diff --git a/lib/sisu/v6/se_version.rb b/lib/sisu/v6/se_version.rb new file mode 100644 index 00000000..8ad6bf49 --- /dev/null +++ b/lib/sisu/v6/se_version.rb @@ -0,0 +1,158 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +   2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, +   All Rights Reserved. + + * License: GPL 3 or later: + +   SiSU, a framework for document structuring, publishing and search + +   Copyright (C) Ralph Amissah + +   This program is free software: you can redistribute it and/or modify it +   under the terms of the GNU General Public License as published by the Free +   Software Foundation, either version 3 of the License, or (at your option) +   any later version. + +   This program is distributed in the hope that it will be useful, but WITHOUT +   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +   more details. + +   You should have received a copy of the GNU General Public License along with +   this program. If not, see <http://www.gnu.org/licenses/>. + +   If you have Internet connection, the latest version of the GPL should be +   available at these locations: +   <http://www.fsf.org/licensing/licenses/gpl.html> +   <http://www.gnu.org/licenses/gpl.html> + +   <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * SiSU uses: +   * Standard SiSU markup syntax, +   * Standard SiSU meta-markup syntax, and the +   * Standard SiSU object citation numbering and system + + * Hompages: +   <http://www.jus.uio.no/sisu> +   <http://www.sisudoc.org> + + * Download: +   <http://www.sisudoc.org/sisu/en/SiSU/download.html> + + * Git +   <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/se_version.rb;hb=HEAD> + + * Ralph Amissah +   <ralph@amissah.com> +   <ralph.amissah@gmail.com> + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Info_Version +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  require_relative 'se_info_env'                           # se_info_env.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class InfoVersion < SiSU_Info_Env::InfoEnv               # se_info_env.rb +    include Singleton +    begin +      require 'rbconfig' +      require 'yaml' +    rescue LoadError +      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +        error('rbconfig or yaml NOT FOUND (LoadError)') +    end +    @@lib_path=nil +    def get_version +      @version={} +      @pwd=ENV['PWD'] +      lib_path= +        @@lib_path \ +        ? @@lib_path +        : `echo $RUBYLIB`.split(':') +      @@lib_path ||=lib_path +      if File.exist?(SiSU_is[:version_info_path]) +        @version=YAML::load(File::open(SiSU_is[:version_info_path])) +      end +      @version[:install_method]=if SiSU_is[:run_from]==:gem_install +        spec = Gem::Specification.find_by_name("sisu") +        gem_root = spec.gem_dir +        (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ +        ? ' (ruby gem install)' : '' +      else '' +      end +      @version +    end +    def rbversion +      %x{ruby -v}.strip +    end +  end +end +module SiSU_Info_About +  require_relative 'constants'                             # constants.rb +  require_relative 'utils'                                 # utils.rb +  begin +    require 'singleton' +  rescue LoadError +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton NOT FOUND (LoadError)') +  end +  class InfoAbout +    def initialize(color='') +      @color=color +    end +    def sisu_version +      version=SiSU_Env::InfoVersion.instance.get_version +      rb_ver=SiSU_Env::InfoVersion.instance.rbversion +      if version[:version] +        opt_cmd=if defined? @color.cmd \ +        and @color.cmd =~/[ck]/ +          @color.cmd +        else '-v' +        end +        SiSU_Screen::Ansi.new( +          opt_cmd, +          version[:project], +          version[:version], +          version[:date_stamp], +          version[:date], +          version[:install_method], +          rb_ver +        ).version +      else puts 'SiSU (version information not available)' +      end +    end +    def sisu_about +      puts <<-WOK +     sisu: documents; markup, structuring, publishing in multiple standard formats, & search +     most (not all) useful commands (are made in a directory containing a sisu markup file &) take the form: +       sisu [action(s)] [filename(s)] +     where filename refers to a valid sisu marked up file, e.g.: +       cd /usr/share/doc/sisu/markup-samples/sisu_manual +       sisu --html --verbose sisu_commands.sst +       sisu --txt --html --epub --odt --pdf --sqlite --manpage --texinfo --concordance --qrcode --verbose sisu.ssm +       cd - +     See output produced, or see man pages: man sisu +     <http://www.sisudoc.org/> <http://www.jus.uio.no/sisu/> +        WOK +    end +  end +end +__END__ diff --git a/lib/sisu/v6/sitemaps.rb b/lib/sisu/v6/sitemaps.rb index 92e376ad..0b19314a 100644 --- a/lib/sisu/v6/sitemaps.rb +++ b/lib/sisu/v6/sitemaps.rb @@ -92,7 +92,11 @@ module SiSU_Sitemaps            @sitemap_idx_fn='sitemapindex.xml'            @env=SiSU_Env::InfoEnv.new            output_idx(sitemap_index) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'sitemap index:', +            "#{@env.path.output}/#{@sitemap_idx_fn}" +          ).result unless @opt.act[:quiet][:set]==:on          end        rescue          SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do @@ -104,7 +108,10 @@ module SiSU_Sitemaps      def make_file(path,filename)        (File.writable?("#{path}/.")) \        ? (File.new("#{path}/#{filename}",'w+')) -      : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn) +      : (SiSU_Screen::Ansi.new( +           '', +           "is the file or directory writable?, could not create #{filename}" +         ).warn)      end      def output_map(sitemap)        path=@md.file.output_path.sitemaps.dir diff --git a/lib/sisu/v6/src_kdissert_share.rb b/lib/sisu/v6/src_kdissert_share.rb index 9624e460..8d6e95fa 100644 --- a/lib/sisu/v6/src_kdissert_share.rb +++ b/lib/sisu/v6/src_kdissert_share.rb @@ -76,8 +76,16 @@ module SiSU_KdiSource        @output_path="#{@env.path.output}/#{@opt.fnb}"      end      def read -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.act[:quiet][:set]==:on -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'Share Kdissert Source Document!', +        @opt.fnb +      ).green_hi_blue unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "Copy kdissert file to output directory", +        "#{@opt.fnb} -> #{@output_path}" +      ).warn unless @opt.act[:quiet][:set]==:on        FileUtils::mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)        FileUtils::mkdir_p(@output_path) unless FileTest.directory?(@output_path)        if FileTest.directory?(@output_path) @@ -86,7 +94,11 @@ module SiSU_KdiSource            FileUtils::cp(@opt.fnb,@output_path)          end        else -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "Output directory does not exist", +          "#{@opt.fnb} -> #{@output_path}" +        ).warn unless @opt.act[:quiet][:set]==:on          exit        end      end diff --git a/lib/sisu/v6/src_share.rb b/lib/sisu/v6/src_share.rb index a94a1a8c..b132038a 100644 --- a/lib/sisu/v6/src_share.rb +++ b/lib/sisu/v6/src_share.rb @@ -103,7 +103,10 @@ module SiSU_Markup          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab +          SiSU_Screen::Ansi.new( +            '', +            "#{@opt.fno} not available" +          ).blue_tab          end        end      end diff --git a/lib/sisu/v6/src_sisupod_make.rb b/lib/sisu/v6/src_sisupod_make.rb index ccac91f8..a1319e32 100644 --- a/lib/sisu/v6/src_sisupod_make.rb +++ b/lib/sisu/v6/src_sisupod_make.rb @@ -76,15 +76,15 @@ module SiSU_Doc          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          ? SiSU_Screen::Ansi.new( -          @opt.act[:color_state][:set], -          'Assemble source for sisu document', -          "#{@opt.fns} -> file://#{pthinfo}"). -          cyan_hi_blue +            @opt.act[:color_state][:set], +            'Assemble source for sisu document', +            "#{@opt.fns} -> file://#{pthinfo}" +          ).cyan_hi_blue          : SiSU_Screen::Ansi.new( -          @opt.act[:color_state][:set], -          'Assemble source for sisu document', -          pthinfo). -          cyan_title_hi +            @opt.act[:color_state][:set], +            'Assemble source for sisu document', +            pthinfo +          ).cyan_title_hi        end      end      def sisupod_tar_xz diff --git a/lib/sisu/v6/sst_do_inline_footnotes.rb b/lib/sisu/v6/sst_do_inline_footnotes.rb index 6349a717..7affab1f 100644 --- a/lib/sisu/v6/sst_do_inline_footnotes.rb +++ b/lib/sisu/v6/sst_do_inline_footnotes.rb @@ -125,7 +125,10 @@ module SiSU_ConvertFootnotes    protected      def create_ao        ao_array=[] -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'convert footnotes').green_title_hi unless @opt.act[:quiet][:set]==:on +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'convert footnotes' +      ).green_title_hi unless @opt.act[:quiet][:set]==:on        file_array=IO.readlines(@opt.fns,'')        file_array.each do |l|          if l =~/\r\n/ then l.gsub!(/\r\n/,"\n") @@ -138,12 +141,23 @@ module SiSU_ConvertFootnotes        or @md.opt.mod.inspect =~/=footnotes-force/          meta=nil          ao=SiSU_ConvertFootnotes::Make.new(@md,file_array).song -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.fns}.fn").output if @md.opt.act[:verbose][:set]==:on -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          @opt.fns, +          "#{@md.fns}.fn" +        ).output if @md.opt.act[:verbose][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "#{@md.fns}.fn -> #{@md.fns}.fn" +        ).txt_red unless @md.opt.act[:quiet][:set]==:on          ao.each {|s| ao_array << "#{s.strip}\n\n" unless s.strip.empty?}          ao_array        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          '*WARN* no footnote conversion done, problem with source file', +          'to override use --convert=footnote-force (this is not advised)' +        ).warn unless @md.opt.act[:quiet][:set]==:on          ''        end      end diff --git a/lib/sisu/v6/sst_from_xml.rb b/lib/sisu/v6/sst_from_xml.rb index ee864b03..12919a17 100644 --- a/lib/sisu/v6/sst_from_xml.rb +++ b/lib/sisu/v6/sst_from_xml.rb @@ -76,7 +76,11 @@ module SiSU_sstFromXML        @ver=SiSU_Env::InfoVersion.instance.get_version      end      def tell(filename,type) -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        "XML #{type} to SiSU sst", +        "#{filename} --> #{filename}.sst" +      ).green_hi_blue      end      def read        xml_to_sisu diff --git a/lib/sisu/v6/sst_to_s_xml_sax.rb b/lib/sisu/v6/sst_to_s_xml_sax.rb index a82ce5cc..ecdfb94e 100644 --- a/lib/sisu/v6/sst_to_s_xml_sax.rb +++ b/lib/sisu/v6/sst_to_s_xml_sax.rb @@ -89,10 +89,19 @@ module SiSU_SimpleXML_ModelSax        begin          @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run          @env=@particulars.env -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'invert', +          'XML SAX', +          "#{@md.fns} -> #{@md.fn[:sxs]}" +        ).colorize unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{Dir.pwd}/#{@md.fn[:sxs]}" +          ).flow          end          unless @@fns==@opt.fns            @@fns=@opt.fns @@ -445,8 +454,18 @@ WOK          if @prog.tidy !=false #note values can be other than true            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'','','check document structure') +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              'invert', +              'Using XML Tidy', +              'check document structure' +            ).colorize unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              '', +              '', +              'check document structure' +            )              tell.grey_open unless @md.opt.act[:quiet][:set]==:on              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy =SiSU_Env::SystemCall.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile) diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 72aaf2b9..26ce7cdf 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -61,7169 +61,98 @@  =end  @@cX=nil -@@current_document=Dir.pwd #nil #'' -@@lang_info=nil  module SiSU_Env -  require_relative 'constants'                             # constants.rb -  require_relative 'utils'                                 # utils.rb +  require_relative 'constants'                         # constants.rb +  require_relative 'utils'                             # utils.rb +  require_relative 'se_date'                           # se_date.rb +  require_relative 'se_info_system'                    # se_info_system.rb +  require_relative 'se_load'                           # se_load.rb +  require_relative 'se_get_init'                       # se_get_init.rb +  require_relative 'se_envcall'                        # se_envcall.rb +  require_relative 'se_programs'                       # se_programs.rb +  require_relative 'se_standardise_lang'               # se_standardise_lang.rb +  require_relative 'se_info_env'                       # se_info_env.rb +  require_relative 'se_processing'                     # se_processing.rb +  require_relative 'se_filemap'                        # se_filemap.rb +  require_relative 'se_file_op'                        # se_file_op.rb +  require_relative 'se_cleanoutput'                    # se_cleanoutput.rb +  require_relative 'se_remotes'                        # se_remotes.rb +  require_relative 'se_version'                        # se_version.rb +  require_relative 'se_db'                             # se_db.rb +  require_relative 'se_css'                            # se_css.rb +  require_relative 'se_clear'                          # se_clear.rb +  require_relative 'se_createsite'                     # se_createsite.rb +  require_relative 'se_info_port'                      # se_info_port.rb    begin      require 'singleton'      require 'fileutils'        include FileUtils::Verbose    rescue LoadError -    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton or fileutils NOT FOUND (LoadError)') +    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). +      error('singleton or fileutils NOT FOUND (LoadError)')    end    @@noyaml=false -  class InfoDate -    begin -      require 'date' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('date NOT FOUND (LoadError)') -    end -    attr_accessor :dt,:t -    def initialize -      @dt,@t=Date.today.to_s,Time.now -    end -    def week -      w=@t.strftime('%W') -      "#{@t.year}w#{w}" -    end -    def month -      "#{@t.year}#{@t.month}" -    end -    def year -      @t.year -    end -    def weekonly -      @t.strftime('%W') -    end -    def monthonly -      @t.month -    end -    def year_static -      YEAR -    end +  class InfoDate < SiSU_Info_Date::InfoDate                # se_date.rb    end -  class InfoSystemGen -    begin -      require 'rbconfig' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)') -    end -    @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] -    out=Config::CONFIG['localstatedir'] -    etc=Config::CONFIG['sysconfdir'] + '/sisu' -    share=Config::CONFIG['datadir'] + '/sisu' -    data=Config::CONFIG['datadir'] + '/doc/sisu' -    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -    @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}/#{@base_markup_dir_stub}" -    if @@user -      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 -    processing_pth=tmp_processing_individual -    processing_dir=prcss_dir -    processing_git="#{Dir.pwd}/#{Gt[:grotto]}" -    #user=ENV['USER'] -    port_pgsql=if defined? ENV['PGPORT'] \ -    and not (ENV['PGPORT'].nil? \ -    || ENV['PGPORT'].empty?) \ -    and ENV['PGPORT']=~/^\d+$/ -      ENV['PGPORT'] -    else '5432' -    end -    IMAGES=:images -    SISU_ETC=:sisu_etc -    SISU_SHARE=:sisu_share -    SAMPLE_DATA_PATH=:sample_data_path -    IMAGE_STUB=:image_stub -    STYLESHEET_STUB=:stylesheet_stub -    IMAGE_LOCAL=:image_local -    WEBSERV_PATH=:webserv_path -    WEBSERV_MAN=:webserv_man -    WEBSERV_PHP=:webserv_php -    WEBSERV_CGI=:webserv_cgi -    WEBSERV_RSS=:webserv_rss -    WEBSERV_SQLITE=:webserv_sqlite -    OUTPUT_LOCAL=:output_local -    PROCESSING_DIR=:processing_dir -    PROCESSING_PATH=:processing_path -    PROCESSING_DIR_TMP_ROOT=:processing_dir_tmp_root -    PROCESSING_PATH_TMP_BASE=:processing_path_tmp_base -    PROCESSING_AO=:processing_ao -    PROCESSING_TUNE=:processing_tune -    PROCESSING_LATEX=:processing_latex -    PROCESSING_TEXINFO=:processing_texinfo -    PROCESSING_LOUT=:processing_lout -    PROCESSING_SQLITE=:processing_sqlite -    PROCESSING_POSTGRESQL=:processing_postgresql -    PROCESSING_ENCODING=:processing_encoding -    PROCESSING_GIT=:processing_git -    PAPERSIZE=:papersize -    #LANGUAGE=:language -    #LANGUAGE_CODE=:language_code -    MULTILINGUAL=:multilingual -    BUNDLE=:bundle -    CONCORD_MAX=:concord_max -    DIGEST=:digest -    WEBSERV_HOST_CGI=:webserv_host_cgi -    WEBSERV_PORT_CGI=:webserv_port_cgi -    POSTGRESQL_USER=:postgresql_user -    POSTGRESQL_PORT=:postgresql_port -    SQLITE_USER=:sqlite_user -    SQLITE_PATH=:sqlite_path -    SQLITE_PORT=:sqlite_port -    DEFAULT_DIR={ -      IMAGES =>                   '_sisu/image', -      SISU_ETC =>                 etc, -      SISU_SHARE =>               share, -      SAMPLE_DATA_PATH =>         data, -      IMAGE_STUB =>               '_sisu/image', -      STYLESHEET_STUB =>          '_sisu/css', -      IMAGE_LOCAL =>              @@pwd + '/_sisu/image', -      WEBSERV_PATH =>             out + '/www', -      #WEBSERV_DIR =>             www, # uncomment for urls... -      #WEBSERV_IMAGE =>            out + '/www/_sisu/image', -      WEBSERV_MAN =>              out + '/www/man', #alter -      WEBSERV_PHP =>              out + '/www/php', -      WEBSERV_CGI =>              '/usr/lib/cgi-bin', -      WEBSERV_RSS =>              out + '/www/feed', -      WEBSERV_SQLITE =>           out + '/www/sqlite', -      OUTPUT_LOCAL =>             @@home + '/sisu_www', -      PROCESSING_DIR =>           processing_dir, -      PROCESSING_PATH =>          processing_pth, -      PROCESSING_DIR_TMP_ROOT  => prcss_dir_tmp_root, -      PROCESSING_PATH_TMP_BASE => processing_pth, -      PROCESSING_AO =>            'ao', -      PROCESSING_TUNE =>          'tune', -      PROCESSING_LATEX =>         'tex', -      PROCESSING_TEXINFO =>       'texinfo', -      PROCESSING_SQLITE =>        'sqlite', -      PROCESSING_POSTGRESQL=>     'postgresql', -      PROCESSING_ENCODING =>      'encoding', -      PROCESSING_GIT =>           processing_git, -      #TEXINFO_STUB =>             'texinfo', -      PAPERSIZE =>                'A4', #A4, US_letter, book_b5, book_a5, US_legal -      #LANGUAGE =>                 'English', -      #LANGUAGE_CODE =>            'en', #change, unecessary duplication though currently used -      MULTILINGUAL =>             false, -      BUNDLE =>                   false, -      CONCORD_MAX =>              260000, -      DIGEST =>                   :sha256, -      WEBSERV_HOST_CGI =>         'http://localhost', -      WEBSERV_PORT_CGI =>         8081, #8111,8123,8081 -      POSTGRESQL_USER =>          @@user, #'ralph', # change user !!! -      POSTGRESQL_PORT =>          port_pgsql, -      #POSGRESQL_LINKS_PATH =>    '', -      SQLITE_USER =>              @@user, -      SQLITE_PATH =>              @@user, #?? -      SQLITE_PORT =>              '**', -    } -    @@default_dir=DEFAULT_DIR -    m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -    @@pwd=@pwd=SiSU_Utils::Path.new.base_markup -    attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path -    def initialize -      @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir=\ -      @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir -      #note rbver is duplicated in InfoVersion -    end +  class InfoSystemGen < SiSU_Info_Sys_Gen::InfoSystemGen   # se_info_system.rb    end -  class InfoSystem < InfoSystemGen -    include Singleton -    def initialize -      super() -    end +  class InfoSystem < SiSU_Info_Sys::InfoSystem             # se_info_system.rb    end -  class Load -    def initialize(prog,mandatory=false) -      @prog,@mandatory=prog,mandatory -    end -    def prog -      load_prog=false -      $:.each do |reqpath| -        if FileTest.exist?("#{reqpath}/#{@prog}.rb") -          load_prog=true -          #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).ok("#{reqpath}/#{@prog}.rb loaded") -          break -        #else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{reqpath}/#{@prog}.rb not found") -        end -      end -      if load_prog \ -      and @prog=~/dbi/ -        begin -          require 'dbi' -        rescue LoadError -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('dbi NOT FOUND (LoadError)') -        end -      end -      if load_prog -        begin -          require @prog -        rescue LoadError -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("#{@prog} NOT FOUND (LoadError)") -        end -      else -        @mandatory \ -        ? (SiSU_Screen::Ansi.new(@prog,"*WARN* module required: #{@prog}").warn) -        : '' #(SiSU_Screen::Ansi.new(@prog,"*WARN* #{@prog} load requested").warn) -      end -      load_prog -    end -    def prog? -      load_prog=false -      $:.each do |reqpath| -        if FileTest.exist?("#{reqpath}/#{@prog}.rb"); load_prog=true -          break -        end -      end -      load_prog -    end +  class Load < SiSU_Load::Load                             # se_load.rb    end -  class GetInit < InfoSystemGen -    @@noyaml=false -    @@rc,@@sisu_doc_makefile,@@sisurc_path,@@tx=nil,nil,nil,nil -    @@ad={ promo: nil, promo_list: nil, flag_promo: false } -    @@sdmd=nil -    attr_accessor :yaml -    def initialize -      super() -        @markup_dir_changed_=if @@sdmd==$sisu_document_markup_directory -          false -        else -          @@sdmd=$sisu_document_markup_directory -          true -        end -    end -    def tex -      @@tx ||=SiSU_Viz::TeX.new -    end -    def rc_path_options -      [ -        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", -        "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", -        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", -        "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", -        "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", -        "#{@@home}/.sisu", -        "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", -        "#{@@sisu_etc}", -      ] -    end -    def sisu_document_make -      def makefile_name -        S_CONF[:header_make] -      end -      def makefile -        rc_path_options.each do |v| -          if FileTest.exist?("#{v}/#{makefile_name}") -            @sisu_make_path=v -            break -          end -        end -        @sisu_make_file_path=@sisu_make_path \ -        ? "#{@sisu_make_path}/#{makefile_name}" -        : nil -      end -      def makefile_read -        if makefile -          sisu_doc_makefile=IO.read(makefile, mode: 'r:utf-8') -          @sisu_doc_makefile=sisu_doc_makefile.split(/\s*\n\s*\n/m) -        end -        @sisu_doc_makefile -      end -      self -    end -    def sisu_yaml -      def rc -        if @markup_dir_changed_ -          rc_path_options.each do |v| -            if @@noyaml \ -            or FileTest.exist?("#{v}/noyaml") -              STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml -              @@noyaml=true -              break -            else -              f=S_CONF[:rc_yml] -              p_f="#{v}/#{f}" -              if FileTest.exist?(p_f) -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@sisurc_path=v -                @@rc=YAML::load(File::open(p_f)) -                break -              end -              unless @@rc -                f='sisurc.yaml' -                p_f="#{v}/#{f}" -                if FileTest.exist?(p_f) -                  begin -                    require 'yaml' -                  rescue LoadError -                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                  end -                  @@sisurc_path=v -                  @@rc=YAML::load(File::open(p_f)) -                  break -                end -              end -            end -          end -        end -        @@rc -      end -      def rc_path -        rc -        @@sisurc_path -      end -      self -    end -    def ads #WORK AREA -      tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' -      if @markup_dir_changed_ -        @ad_path=[ -          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", -          "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", -          "#{@@home}/.sisu/skin/yml", -          "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", -          "#{@@sisu_etc}/skin/yml", -        ] -        @ad_path.each do |v| -          if @@noyaml \ -          or FileTest.exist?("#{v}/noyaml") -            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml -            @@noyaml=true -            break -          else -            if FileTest.exist?("#{v}/list.yml") -              unless @@ad[:promo_list] -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@ad[:promo_list] ||= YAML::load(File::open("#{v}/list.yml")) -              end -              @@ad[:flag_promo]=true -              break -            end -            @@ad[:flag_promo]=false -          end -        end -        @ad_path.each do |v| -          if @@noyaml \ -          or FileTest.exist?("#{v}/noyaml") -            puts tell_no_yaml + "\n\t#{v}/noyaml\n" unless @@noyaml -            @@noyaml=true -            break -          else -            if FileTest.exist?("#{v}/promo.yml") -              unless @@ad[:promo] -                begin -                  require 'yaml' -                rescue LoadError -                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('yaml NOT FOUND (LoadError)') -                end -                @@ad[:promo] ||= YAML::load(File::open("#{v}/promo.yml")) -              end -              @@ad[:flag_promo]=true -              break -            end -            @@ad[:flag_promo]=false -          end -        end -      end -      @@ad -    end +  class GetInit < SiSU_Get_Init::GetInit                   # se_get_init.rb    end -  class EnvCall -    @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil -    @@ad={} -    attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad -    def initialize(fns='') -      @fns=fns -      @sys=InfoSystem.instance -      get_init=SiSU_Env::GetInit.new -      @rc=get_init.sisu_yaml.rc -      @ad=get_init.ads -      if @fns \ -      and @fns != '' \ -      and @fns !=@@fns -        @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil -      end -      if @fns \ -      and @fns != '' #watch -        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ -        @@fnn ||=@fns[m,1] -        @@fnb ||=@fns[m,2] -        @@fnt ||=@fns[m,3] -        @@flv ||=document_language_versions_found[:f] -        unless @@fns =~/\S+?\.txz/ -          @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' -          elsif @@fnb; @@fnb + '.sst.txz' -          else '' # e.g. termsheet -          end -        end -      end -      @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz -    end -    def default_language? -      if @rc \ -      && defined? @rc['language_default'] -        if (@rc['language_default'].is_a?(String)) \ -        && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/) -          @rc['language_default'] -        else 'en' -        end -      else 'en' -      end -    end -    def mono_multi_lingual? -      if @rc \ -      && defined? @rc['lingual'] -        if (@rc['lingual'].is_a?(String)) \ -        && (@rc['lingual'] =~/mono(?:lingual)?/) -          :mono -        elsif  (@rc['lingual'].is_a?(String)) \ -        && (@rc['lingual'] =~/multi(?:lingual)?/) -          :multi -        else :multi -        end -      else :multi -      end -    end -    def output_dir_structure -      def by? -        output_structure=:filename #set default output structure -        if @rc \ -        && defined? @rc['output_dir_structure_by'] -          output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ -          or ((defined? @rc['output_structure']['dump']) \ -          && @rc['output_structure']['dump'] ==true) -            :dump -          elsif (@rc['output_dir_structure_by'] =~/redirect/) \ -          or ((defined? @rc['output_structure']['redirect']) \ -          && @rc['output_structure']['redirect'] ==true) -            :redirect -          elsif (@rc['output_dir_structure_by'] =~/language/) \ -          or ((defined? @rc['output_structure']['by_language']) \ -          && @rc['output_structure']['by_language'] ==true) -            :language -          elsif (@rc['output_dir_structure_by'] =~/filetype/) \ -          or ((defined? @rc['output_structure']['by_filetype']) \ -          && @rc['output_structure']['by_filetype'] ==true) -            :filetype -          elsif (@rc['output_dir_structure_by'] =~/filename/) \ -          or ((defined? @rc['output_structure']['by_filename']) \ -          && @rc['output_structure']['by_filename'] ==true) -            :filename -          else #set default -            :language -          end -        else #set default -          :language -        end -      end -      def dump? -        ((by?) ==:dump) \ -        ? true -        : false -      end -      def redirect? -        ((by?) ==:redirect) \ -        ? true -        : false -      end -      def by_language_code? -        ((by?) ==:language) \ -        ? true -        : false -      end -      def by_filetype? -        ((by?) ==:filetype) \ -        ? true -        : false -      end -      def by_filename? -        ((by?) ==:filename) \ -        ? true -        : false -      end -      def multilingual? -        by_language_code? -      end -      self -    end -    def document_language_versions_found #REVISIT -      @fn={} -      filename=(@fns =~/\.ssm\.sst$/) \ -      ? @fns.gsub(/\.ssm\.sst$/,'.ssm') -      : @fns -      if filename.is_a?(String) \ -      and not filename.empty? -        if output_dir_structure.by_language_code? -          m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/ -          @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3] -        else m=/(.+?)\.(sst|ssm)$/ -          @fn[:b]=@fn[:m]=filename[m,1] -          @fn[:t]=filename[m,2] -        end -      end -      lng_base=SiSU_Env::InfoEnv.new.language_default_set -      lang=SiSU_Env::StandardiseLanguage.new -      langs=lang.codes -      x=[] -      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") -        n=@fn[:m].gsub(/^.+?\//,'') -        n =n + '.' + @fn[:t] -        x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } -      end -      langs.each do |l| -        lng=SiSU_Env::StandardiseLanguage.new(l) -        if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -          x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } -        elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") -          x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } -        end -        if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -          if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } -          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } -          end -        end -        if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -          if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } -          elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") -            x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } -          end -        end -      end -      @fn[:f]=x -      @fn -    end -    def published_manifests?(output_base) -      @fn={} -      @m=[] -      unless (@fns.nil? \ -      or @fns.empty?) -        if output_dir_structure.by_language_code? -          m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ -          @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] -        else m=/(.+?)\.((?:-|ssm\.)?sst$)/ -          @fn[:b]=@fn[:m]=@fns[m,1] -          @fn[:t]=@fns[m,2] -        end -      end -      lang=SiSU_Env::StandardiseLanguage.new -      langs=lang.codes -      x=[] -      if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" -      end -      dir=SiSU_Env::InfoEnv.new(@fns) -      @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language -      langs.each do |l| -        lng=SiSU_Env::StandardiseLanguage.new(l) -        fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" -        fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" -        if FileTest.file?(fns_c) -          fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_c) #reconsider file_to_language -          lng=fn_set_lang[:n] -          fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) -          @m << { m: fn[:manifest], l: lng } -        elsif FileTest.file?(fns_l) -          fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_l) #reconsider file_to_language -          @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) -          fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) -          @m << { m: fn[:manifest], l: lng } -        end -      end -      @m=@m.uniq -    end -    def filename(code,name,suffix) -      "#{name}#{suffix}" -    end -    def lang(code) -      { -        html:            filename(code,'','.html'), -        book_index:      filename(code,'book_index','.html'), -        concordance:     filename(code,'concordance','.html'), -        sax:             filename(code,'sax','.xml'), -        dom:             filename(code,'dom','.xml'), -        docbook:         filename(code,'docbook','.xml'), -        xhtml:           filename(code,'scroll','.xhtml'), -        pdf_l:           filename(code,'','.pdf'), -        pdf_p:           filename(code,'','.pdf'), -        pdf_l_a4:        filename(code,"a4",'.pdf'), -        pdf_p_a4:        filename(code,"a4",'.pdf'), -        pdf_l_a5:        filename(code,"a5",'.pdf'), -        pdf_p_a5:        filename(code,"a5",'.pdf'), -        pdf_l_b5:        filename(code,"b5",'.pdf'), -        pdf_p_b5:        filename(code,"b5",'.pdf'), -        pdf_l_letter:    filename(code,"letter",'.pdf'), -        pdf_p_letter:    filename(code,"letter",'.pdf'), -        pdf_l_legal:     filename(code,"legal",'.pdf'), -        pdf_p_legal:     filename(code,"legal",'.pdf'), -        toc:             filename(code,'toc','.html'), -        doc:             filename(code,fnb,'.html'), -        index:           filename(code,'index','.html'), -        po:              filename(code,@fns,'.po'), -        pot:             filename(code,@fns,'.pot'), -        odf:             filename(code,'','.odt'), -        epub:            filename(code,'','.epub'), -        plain:           filename(code,'','.txt'), -        qrcode:          filename(code,'','.jpg'), -        manpage:         filename(code,'','.1'),          #fix, section number -        wiki:            filename(code,'wiki','.txt'), -        digest:          filename(code,'digest','.txt'), -        metadata:        filename(code,'metadata','.html'), #chk -        manifest:        filename(code,'manifest','.html'), -        oai_pmh:         filename(code,'oai_pmh','.xml'), -        sitemap:         filename(code,'sitemap','.xml'), -        sitemap_touch:   filename(code,"sitemap_#{fnb}",'.xml'), -        sxs:             filename(code,fnb,'.sxs.xml'), -        sxd:             filename(code,fnb,'.sxd.xml'), -        sxn:             filename(code,fnb,'.sxn.xml'), -        sisupod:         filename(nil,@fnz,''), -        book_idx_html:   filename(code,'book_index','.html'), -        book_idx_epub:   filename(code,'book_index','.xhtml'), -        epub_concord:    filename(code,'concordance','.xhtml'), -      } -    end +  class EnvCall < SiSU_Env_Call::EnvCall                   # se_envcall.rb    end -  class SystemCall -    @@locale_flag=false -    def initialize(input='',output='',opt_or_cmd='') -      @input,@output=input,output -      (opt_or_cmd.is_a?(SiSU_Commandline::Options)) \ -      ? (@cmd,@opt=opt_or_cmd.cmd,opt_or_cmd) -      : (@cmd,@opt=opt_or_cmd,nil) #cmd.is_a?(String) -      @prog=SiSU_Env::InfoProgram.new -      @sys=InfoSystem.instance -    end -    def program_found?(program) -      found=`which #{program}` #`whereis #{program}` -      (found =~/bin\/#{program}\b/) ? true : false -    end -    def locale                                                                 #locales utf8 or other -      unless @@locale_flag -        @@locale_flag=true -      end -      @sys.locale -    end -    def file_encoding(filename,cmd='')                                         #file encoding -      program='file' -      fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path -      if program_found?(program) -        encoding=%x{file -L #{fnsp}}.strip -        encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'') -        encoding=if encoding \ -        and not encoding.empty? -          encoding -        else 'UTF-8 assumed, encoding undetermined' -        end -        puts encoding if cmd =~/[VM]/ -        encoding -      else encoding='UTF-8 assumed, file encoding check program unavailable' -      end -    end -    def wc                                                                     #word count -      program='wc' -      if program_found?(program) \ -      and locale !~/utf-?8/i -        true -      else -        program_ref="(not available)" unless program_found?(program) -        program_ref="(UTF-8)" if locale =~/utf-?8/i -        false -      end -    end -    def rcs                                                                    #rcs for document markup data -      program='rcs' -      program_ref="\n\t\tdocument version information requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def cvs                                                                    #cvs for document markup data -      program='cvs' -      program_ref="\n\t\tdocument version information requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def zip                                                                    #zip -      program='zip' -      program_ref="\n\t\tused to in the making of number of file formats, odf, epub" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("*WARN* #{program} is not installed #{program_ref}") -        false -      end -    end -    def openssl                                                                #openssl for digests -      program='openssl' -      program_ref="\n\t\tused to generate requested source document identification digest" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def md5(filename)                                                          #md5 dgst -      program='openssl' -      program_ref="\n\t\tmd5 digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def sha256(filename)                                                       #sha dgst -      program='openssl' -      program_ref="\n\t\tsha digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def sha512(filename)                                                       #sha dgst -      program='openssl' -      program_ref="\n\t\tsha digest requested" -      if program_found?(program) -        pwd=Dir.pwd -        Dir.chdir(File.dirname(filename)) -        dgst=%x{openssl dgst -sha512 #{File.basename(filename)}}.strip #use file name without file path -        Dir.chdir(pwd) -        dgst.scan(/\S+/) -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def psql                                                                   #psql -      program='psql' -      program_ref="\n\t\tpsql requested" -      if program_found?(program); true -      else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn("#{program} is not installed #{program_ref}") -        false -      end -    end -    def create_pg_db(dbname_stub=nil)                                          #createdb -      unless dbname_stub -        @pwd ||=Dir.pwd -        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m -        dbname_stub=@pwd[m,1] -      end -      program='createdb' -      db_name="#{Db[:name_prefix]}#{dbname_stub}" -      program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" -      (program_found?(program)) \ -      ? system("#{program} #{dbname_name}") -      : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") -    end -    def relaxng(cmd='')                                                        #trang - convert between different schema languages for XML -      program='trang' -      program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" -      (program_found?(program)) \ -      ? system("#{program} #{@input} #{@output}") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) -    end -    def qrencode                                                               #qrcode - for generating QR code -      program='qrencode' -      program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" -      found=(program_found?(program)) ? true : false -      found \ -      ? (system(%{ -          echo "#{@input}" | #{program} -s 3 -o #{@output} -        })) -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if @cmd =~/V/) -      #found -    end -    def imagemagick                                                            #imagemagick is a image manipulation program -      program='identify' -      #program_ref="\n\t\tsee <http://www.imagemagick.org/>" -      found=(program_found?(program)) ? true : false -      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found -      found -    end -    def graphicksmagick                                                        #graphicsmagick is a image manipulation program -      program='gm' -      #program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" -      found=(program_found?(program)) ? true : false -      #STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found -      found -    end -    def well_formed?                                                           #tidy - check for well formed xml xhtml etc. -      program=@prog.tidy -      program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" -      (program_found?(program)) \ -      ? system("#{@prog.tidy} -xml #{@input} > #{@output}") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") -    end -    def tex2pdf_engine -      progs=['xetex','xelatex','pdflatex','pdfetex','pdftex'] -      @pdfetex_flag=false -      @cmd ||='' -      @texpdf=nil -      progs.each do |program| -        if program_found?(program) -          @texpdf=program if program =~/xetex|xelatex|pdftex|pdflatex/ -          @pdfetex_flag=true -          break -        end -      end -      if @pdfetex_flag==false -        @texpdf=progs.join(', ') -      end -      @texpdf -    end -    def latex2pdf(md,papersize='a4')                                           #convert from latex to pdf -      tell=if @cmd =~/[MV]/ -        '' -      elsif @cmd =~/[v]/ -        %q{2>&1 | grep -v ' WARNING '} -      else %q{2>&1 | grep -v '$'} -      end -      mode='batchmode' #mode='nonstopmode' -      texpdf=tex2pdf_engine -      if @pdfetex_flag -        texpdf_cmd=case texpdf -        when /xetex/ -          %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} -        when /xelatex/ -          %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} -        when /pdftex/ -          "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" -        when /pdflatex/ -          "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" -        end -        system(texpdf_cmd) -      else STDERR.puts "\t*WARN* none of the following programs are installed: #{@texpdf}" -      end -    end -    def makeinfo                                                               #texinfo -      program='makeinfo' -      options='' #'--force' #'' -      program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" -      (program_found?(program)) \ -      ? system("#{program} #{options} #{@input}\n") -      : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") -    end -    def scp -      puts "scp -Cr #{@input} #{@output}" if @cmd =~/[vVM]/ -      puts "scp disabled" -    end -    def rsync(action='',chdir=nil) -      program='rsync' -      if program_found?(program) -        vb=if @cmd =~/q/; 'q' -        elsif @cmd =~/v/; 'v' -        else              '' -        end -        cX=SiSU_Screen::Ansi.new(@cmd).cX -        msg=(@cmd =~/q/) ? '' : %{ && echo " #{cX.grey}OK: #{@input} -> #{@output}#{cX.off}"} -        amp=(@opt \ -        && @opt.files.length > 1) \ -        ? '' -        : ((@cmd =~/[vVM]/) ? '' : '&') -        rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}" -        puts rsync_cmd if @cmd =~/[vVM]/ -        dir_change,dir_return='','' -        if not chdir.nil? \ -        && chdir != Dir.pwd -          dir_change=Dir.chdir(chdir) -          dir_return=Dir.pwd -        end -        dir_change #check -        system(" -          #{rsync_cmd} #{msg} #{amp} -        ") -        dir_return -      else STDERR.puts "\t*WARN* #{program} not found" -      end -    end -    def rm -      if @cmd =~/^-Z[mMvVq]*$/;      FileUtils::rm_rf(@input) -      elsif @cmd =~/V/;              FileUtils::rm(@input) -      elsif @cmd !~/q/;              FileUtils::rm(@input) -      elsif @cmd =~/q/;              FileUtils::rm(@input) -      else                           STDERR.puts "\t*WARN* operation ignored" -      end -    end +  class SystemCall < SiSU_Sys_Call::SystemCall             # se_programs.rb    end -  class StandardiseLanguage -    require_relative 'i18n'                  # i18n.rb -    def initialize(l='') -      @language=(l.nil? || l.empty?) \ -      ? SiSU_Env::InfoEnv.new.language_default_set -      : l -      @r=%{(?:#{Px[:lng_lst_rgx]})} -      @lang_info=SiSU_i18n::Languages.new -    end -    def lang_lst                              # from i18n -      @@lang_info ||=@lang_info.language.list -    end -    def lang(l='')                              # from i18n -      if l =~/^#{@r}$/ -        @lang_info.language.list[l] -      elsif @language =~/^#{@r}$/ -        @lang_info.language.list[@language] -      else nil -      end -    end -    def language -      lng={} -      case @language -      when /^am$|Amharic/i                    then d,c,l=false,lang_lst['am'][:c],    lang_lst['am'][:n] -      when /^bg$|Bulgarian/i                  then d,c,l=false,lang_lst['bg'][:c],    lang_lst['bg'][:n] -      when /^bn$|Bengali/i                    then d,c,l=false,lang_lst['bn'][:c],    lang_lst['bn'][:n] -      when /^br$|Breton/i                     then d,c,l=false,lang_lst['br'][:c],    lang_lst['br'][:n] -      when /^ca$|Catalan/i                    then d,c,l=false,lang_lst['ca'][:c],    lang_lst['ca'][:n] -      when /^cs$|Czech/i                      then d,c,l=false,lang_lst['cs'][:c],    lang_lst['cs'][:n] -      when /^cy$|Welsh/i                      then d,c,l=false,lang_lst['cy'][:c],    lang_lst['cy'][:n] -      when /^da$|Danish|Dansk/i               then d,c,l=false,lang_lst['da'][:c],    lang_lst['da'][:n] -      when /^de$|German/i                     then d,c,l=false,lang_lst['de'][:c],    lang_lst['de'][:n] -      when /^el$|Greek/i                      then d,c,l=false,lang_lst['el'][:c],    lang_lst['el'][:n] -      when /^en$|English/i                    then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] -      when /^eo$|Esperanto/i                  then d,c,l=false,lang_lst['eo'][:c],    lang_lst['eo'][:n] -      when /^es$|Spanish|Espanol/i            then d,c,l=false,lang_lst['es'][:c],    lang_lst['es'][:n] -      when /^et$|Estonian/i                   then d,c,l=false,lang_lst['et'][:c],    lang_lst['et'][:n] -      when /^eu$|Basque/i                     then d,c,l=false,lang_lst['eu'][:c],    lang_lst['eu'][:n] -      when /^fi$|Finnish|Finsk|Suomi/i        then d,c,l=false,lang_lst['fi'][:c],    lang_lst['fi'][:n] -      when /^fr$|French|Francais/i            then d,c,l=false,lang_lst['fr'][:c],    lang_lst['fr'][:n] -      when /^ga$|Irish/i                      then d,c,l=false,lang_lst['ga'][:c],    lang_lst['ga'][:n] -      when /^gl$|Galician/i                   then d,c,l=false,lang_lst['gl'][:c],    lang_lst['gl'][:n] -      when /^he$|Hebrew/i                     then d,c,l=false,lang_lst['he'][:c],    lang_lst['he'][:n] -      when /^hi$|Hindi/i                      then d,c,l=false,lang_lst['hi'][:c],    lang_lst['hi'][:n] -      when /^hr$|Croatian/i                   then d,c,l=false,lang_lst['hr'][:c],    lang_lst['hr'][:n] -      when /^hy$|Armenian/i                   then d,c,l=false,lang_lst['hy'][:c],    lang_lst['hy'][:n] -      when /^ia$|Interlingua/i                then d,c,l=false,lang_lst['ia'][:c],    lang_lst['ia'][:n] -      when /^is$|Icelandic/i                  then d,c,l=false,lang_lst['is'][:c],    lang_lst['is'][:n] -      when /^it$|Italian/i                    then d,c,l=false,lang_lst['it'][:c],    lang_lst['it'][:n] -      when /^la$|Latin/i                      then d,c,l=false,lang_lst['la'][:c],    lang_lst['la'][:n] -      when /^lo$|Lao/i                        then d,c,l=false,lang_lst['lo'][:c],    lang_lst['lo'][:n] -      when /^lt$|Lithuanian/i                 then d,c,l=false,lang_lst['lt'][:c],    lang_lst['lt'][:n] -      when /^lv$|Latvian/i                    then d,c,l=false,lang_lst['lv'][:c],    lang_lst['lv'][:n] -      when /^ml$|Malayalam/i                  then d,c,l=false,lang_lst['ml'][:c],    lang_lst['ml'][:n] -      when /^mr$|Marathi/i                    then d,c,l=false,lang_lst['mr'][:c],    lang_lst['mr'][:n] -      when /^nl$|Dutch/i                      then d,c,l=false,lang_lst['nl'][:c],    lang_lst['nl'][:n] -      when /^no$|Norwegian|Norsk/i            then d,c,l=false,lang_lst['no'][:c],    lang_lst['no'][:n] -      when /^nn$|Norwegian Nynorsk/i          then d,c,l=false,lang_lst['nn'][:c],    lang_lst['nn'][:n] -      when /^oc$|Occitan/i                    then d,c,l=false,lang_lst['oc'][:c],    lang_lst['oc'][:n] -      when /^pl$|Polish/i                     then d,c,l=false,lang_lst['pl'][:c],    lang_lst['pl'][:n] -      when /^pt$|Portuguese/i                 then d,c,l=false,lang_lst['pt'][:c],    lang_lst['pt'][:n] -      when /^pt_BR$|Portuguese Brazil/i       then d,c,l=false,lang_lst['pt_BR'][:c], lang_lst['pt_BR'][:n] -      when /^ro$|Romanian/i                   then d,c,l=false,lang_lst['ro'][:c],    lang_lst['ro'][:n] -      when /^ru$|Russian/i                    then d,c,l=false,lang_lst['ru'][:c],    lang_lst['ru'][:n] -      when /^sa$|Sanskrit/i                   then d,c,l=false,lang_lst['sa'][:c],    lang_lst['sa'][:n] -      when /^se$|Sami/i                       then d,c,l=false,lang_lst['se'][:c],    lang_lst['se'][:n] -      when /^sk$|Slovak/i                     then d,c,l=false,lang_lst['sk'][:c],    lang_lst['sk'][:n] -      when /^sl$|Slovenian/i                  then d,c,l=false,lang_lst['sl'][:c],    lang_lst['sl'][:n] -      when /^sq$|Albanian/i                   then d,c,l=false,lang_lst['sq'][:c],    lang_lst['sq'][:n] -      when /^sr$|Serbian/i                    then d,c,l=false,lang_lst['sr'][:c],    lang_lst['sr'][:n] -      when /^sv$|Swedish|Svensk/i             then d,c,l=false,lang_lst['sv'][:c],    lang_lst['sv'][:n] -      when /^ta$|Tamil/i                      then d,c,l=false,lang_lst['ta'][:c],    lang_lst['ta'][:n] -      when /^te$|Telugu/i                     then d,c,l=false,lang_lst['te'][:c],    lang_lst['te'][:n] -      when /^th$|Thai/i                       then d,c,l=false,lang_lst['th'][:c],    lang_lst['th'][:n] -      when /^tk$|Turkmen/i                    then d,c,l=false,lang_lst['tk'][:c],    lang_lst['tk'][:n] -      when /^tr$|Turkish/i                    then d,c,l=false,lang_lst['tr'][:c],    lang_lst['tr'][:n] -      when /^uk$|Ukranian/i                   then d,c,l=false,lang_lst['uk'][:c],    lang_lst['uk'][:n] -      when /^ur$|Urdu/i                       then d,c,l=false,lang_lst['ur'][:c],    lang_lst['ur'][:n] -      when /^us|American$|/i                  then d,c,l=false,lang_lst['en'][:c],    lang_lst['en'][:n] -      when /^vi$|Vietnamese/i                 then d,c,l=false,lang_lst['vi'][:c],    lang_lst['vi'][:n] -      else                                     d,c,l=true, lang_lst['en'][:c],    lang_lst['en'][:n] #default -      end -      lng[:d],lng[:c],lng[:n]=d,c,l -      lng -    end -    def name -      language[:n].downcase -    end -    def title -      language[:n] -    end -    def code -      language[:c] -    end -    def tex_name -      language[:xlp] -    end -    def file_to_language(file) # used, fix and remove -      m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ -      @language=if file =~m ; file[m,1] -      else '' -      end -      language -    end -    def codes -      # Language List po4a -      #   <http://www.debian.org/international/l10n/po/> -      #   Px[:lng_lst] see constants.rb -      # see polyglossia for subset -      #   <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf> -      # also note ISO_639-2 -      #   <http://en.wikipedia.org/wiki/ISO_639-2> -      #   <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes> -      Px[:lng_lst] # constants.rb -    end +  class StandardiseLanguage < SiSU_Standardise_Lang::StandardiseLanguage # se_standardise_lang.rb    end -  class InfoEnv < EnvCall -    begin -      require 'pathname' -      require 'fileutils' -        include FileUtils -    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,: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) -      super() #you may not want to re-execute this static info so frequently! -      @init=SiSU_Env::GetInit.new -      @fns,@md=fns,md -      @env=SiSU_Env::EnvCall.new(fns) if fns -      fnb=if @md \ -      and defined? @md.fnb -        @md.fnb -      elsif defined? @env.fnb \ -      and @env.fnb -        @env.fnb -      elsif @fns.is_a?(String) \ -      and not @fns.empty? -        m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m -        @fns[m,1] if not @fns.empty? -      end -      if fnb; @@fb ||=fnb -      end -      @sys=InfoSystem.instance -      @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters -      @fixed_websev_root='' # @home -      @pwd=@@pwd=Dir.pwd -      @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] -        stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/ -          lng=pt.split[-1].to_s -          lng_part='/' + lng -          base=pt.split[0].split[-1].to_s -        else -          lng_part='/' + language_default_set -          base=pt.split[-1].to_s -        end -        base + lng_part -      elsif output_dir_structure.by_filetype? -        pt.split[-1].to_s -      elsif  output_dir_structure.by_filename? -        '' -      else -        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).warn('set output type, by: language, filetype or filename') -      end -      @stub_set_manifest=stub + '/manifest' -    end -    def user -      @sys.user -    end -    def hostname -      @sys.hostname -    end -    def host -      @sys.host -    end -    def arch -      @sys.arch -    end -    def rbver -      @sys.rbver -    end -    def locale -      @sys.locale -    end -    def concord_max -      ((defined? @rc['processing']['concord_max']) \ -      && @rc['processing']['concord_max']) \ -      ? @rc['processing']['concord_max'] -      : (defaults[:concord_max]) -    end -    def language_default_set #set directory (default) language -      ((defined? @rc['default']['language']) \ -      && @rc['default']['language'] =~/\S+/) \ -      ? @rc['default']['language'] -      : 'en' -    end -    def markup_emphasis -      if defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/bold/ -        'bold' -      elsif defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/italic/ -        'italics' -      elsif defined? @rc['default']['emphasis'] \ -      and @rc['default']['emphasis'] \ -      and @rc['default']['emphasis']=~/underscore/ -        'underscore' -      else 'bold' -      end -    end -    def plaintext_wrap -      ((defined? @rc['default']['text_wrap']) \ -      && (@rc['default']['text_wrap']) \ -      && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ -      && (@rc['default']['text_wrap'].to_i > 19) \ -      && (@rc['default']['text_wrap'].to_i < 201)) \ -      ? @rc['default']['text_wrap'].to_i -      : 78 -    end -    def current_document -      @@current_document||=Dir.pwd -      @@current_document -    end -    def base_markup_dir_stub                                                               #200412 -      @base_markup_dir_stub -    end -    def stub_md_harvest                                                        #watch -      @stub_set_manifest -    end -    def stub_src -      @stub_src -    end -    def stub_pod -      @stub_pod -    end -    def sisupod_v4(opt) -      #processing_path.processing -      #  sisupod -      #    doc/ -      #      manifest.txt -      #      en/content.sst                [file content] -      #      fr/content.sst -      #      _sisu -      #        sisu_document_make -      #        image@ (ln -s ../../image) -      #        audio@ (ln -s ../../audio) -      #        video@ (ln -s ../../video) -      #    image/                          [all images for specific document gathered here] -      #    audio/ -      #    video/ -      spp="#{processing_path.processing}/#{Gt[:sisupod]}" -      sppc="#{spp}/doc/_sisu" -      lng_dirs=[] -      if FileTest.directory?(spp) \ -      or FileTest.file?(spp) -        FileUtils::rm_rf(spp) -      end -      paths=[] -      flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found -      flv[:f].each {|l| lng_dirs << l[:l] } -      lng_dirs.uniq.each do |lng| -        paths << "#{spp}/doc/#{lng}" -      end -      paths \ -      << "#{spp}/image" -     #<< "#{spp}/audio" \ -     #<< "#{spp}/video" \ -      paths.each do |x| -        unless FileTest.directory?(x) -          FileUtils::mkdir_p(x) -        end -      end -      if FileTest.directory?(sppc) -        pwd=Dir.pwd -        Dir.chdir(sppc) -        FileUtils::ln_s('../../image', 'image') -       #FileUtils::ln_s('../../audio', 'audio') -       #FileUtils::ln_s('../../video', 'video') -        Dir.chdir(pwd) -      end -    end -    def sisupod_v3(opt) -      #processing_path.processing -      #  sisupod -      #    doc/ -      #      manifest.txt -      #      en/content.sst                [file content] -      #      fr/content.sst -      #      _sisu -      #        skin/ -      #          doc                       [relevant skin if any other than default] -      #        image@ (ln -s ../../image) -      #        audio@ (ln -s ../../audio) -      #        video@ (ln -s ../../video) -      #    image/                          [all images for specific document gathered here] -      #    audio/ -      #    video/ -      spp="#{processing_path.processing}/#{Gt[:sisupod]}" -      sppc="#{spp}/doc/_sisu" -      lng_dirs=[] -      if FileTest.directory?(spp) \ -      or FileTest.file?(spp) -        FileUtils::rm_rf(spp) -      end -      paths=[] -      flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found -      flv[:f].each {|l| lng_dirs << l[:l] } -      lng_dirs.uniq.each do |lng| -        paths << "#{spp}/doc/#{lng}" -      end -      paths \ -      << "#{spp}/image" \ -      << "#{sppc}/skin/doc" \ -      << "#{sppc}/skin/dir" \ -      << "#{sppc}/skin/site" -     #<< "#{spp}/audio" \ -     #<< "#{spp}/video" \ -      paths.each do |x| -        unless FileTest.directory?(x) -          FileUtils::mkdir_p(x) -        end -      end -      if FileTest.directory?(sppc) -        pwd=Dir.pwd -        Dir.chdir(sppc) -        FileUtils::ln_s('../../image', 'image') -       #FileUtils::ln_s('../../audio', 'audio') -       #FileUtils::ln_s('../../video', 'video') -        Dir.chdir(pwd) -      end -    end -    def sisupod_v2 -      #processing_path.processing -      #  sisupod -      #    content.sst              [file content] -      #    filename.sst             [link to content.sst] -      #    _sisu -      #      skin/ -      #        doc                  [relevant skin if any other than default] -      #      image                  [all images for specific document gathered here] -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      paths=[] -      paths=[ -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/doc", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/dir", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/skin/site", -        "#{processing_path.processing}/#{Gt[:sisupod]}/_sisu/image" -      ] -      paths.each {|x| FileUtils::mkdir_p(x) unless FileTest.directory?(x) } -    end -    def defaults #multiple default directories -      @default_dir ||=@sys.default_dir #DEFAULT_DIR -    end -    def html_seg_title_banner? -      ((defined? @rc['html']['seg_title_banner']) \ -      && @rc['html']['seg_title_banner']==true) \ -      ? @rc['html']['seg_title_banner'] -      : false -    end -    def html_quick_ref? -      ((defined? @rc['html']['quick_ref']) \ -      && @rc['html']['quick_ref']==true) \ -      ? @rc['html']['quick_ref'] -      : false -    end -    def html_minitoc? -      if defined? @rc['html']['minitoc'] \ -      and @rc['html']['minitoc'].is_a?(String) -        @rc['html']['minitoc'] -      else false -      end -    end -    def manifest_minitoc? -      if defined? @rc['manifest']['minitoc'] \ -      and @rc['manifest']['minitoc'].is_a?(String) -        @rc['manifest']['minitoc'] -      else false -      end -    end -    def build -      def omit_list -        @off_list ||=if defined? @rc['omit_list'] \ -        and @rc['omit_list'].is_a?(String) -          @rc['omit_list'] -        elsif defined? @rc['omit']['list'] \ -        and @rc['omit']['list'].is_a?(String) -          @rc['omit']['list'] -        else -          nil -        end -      end -      def listed?(test) #fix -        listed=if omit_list -          x=(omit_list.scan(/\b#{test}\b/)).join -          test==x \ -          ? true -          : false -        else -          false -        end -        listed -      end -      def ocn? -        if (defined? @rc['omit']['ocn'] \ -        and not @rc['omit']['ocn'].nil?) \ -        or listed?('ocn') -          :off -        else -          :na -        end -      end -      def toc? -        if (defined? @rc['omit']['toc'] \ -        and not @rc['omit']['toc'].nil?) \ -        or listed?('toc') -          :off -        else -          :na -        end -      end -      def manifest? -        if (defined? @rc['omit']['manifest'] \ -        and not @rc['omit']['manifest'].nil?) \ -        or listed?('manifest') -          :off -        else -          :na -        end -      end -      def links_to_manifest? -        if (defined? @rc['omit']['links_to_manifest'] \ -        and not @rc['omit']['links_to_manifest'].nil?) \ -        or (listed?('links_to_manifest') \ -        ||  listed?('manifest_links')) -          :off -        else -          :na -        end -      end -      def metadata? -        if (defined? @rc['omit']['metadata'] \ -        and not @rc['omit']['metadata'].nil?) \ -        or listed?('metadata') -          :off -        else -          :na -        end -      end -      def minitoc? -        if (defined? @rc['omit']['minitoc'] \ -        and not @rc['omit']['minitoc'].nil?) \ -        or (listed?('minitoc')) -          :off -        else -          :na -        end -      end -      def manifest_minitoc? -        if (defined? @rc['omit']['manifest_minitoc'] \ -        and not @rc['omit']['manifest_minitoc'].nil?) \ -        or listed?('manifest_minitoc') -          :off -        else -          :na -        end -      end -      def html_minitoc? -        if (defined? @rc['omit']['html_minitoc'] \ -        and not @rc['omit']['html_minitoc'].nil?) \ -        or (listed?('html_minitoc') \ -        || listed?('minitoc')) -          :off -        else -          :na -        end -      end -      def html_navigation? -        if (defined? @rc['omit']['html_navigation'] \ -        and not @rc['omit']['html_navigation'].nil?) \ -        or listed?('html_navigation') -          :off -        else -          :na -        end -      end -      def html_navigation_bar? -        if (defined? @rc['omit']['html_navigation_bar'] \ -        and not @rc['omit']['html_navigation_bar'].nil?) \ -        or listed?('html_navigation_bar') -          :off -        else -          :na -        end -      end -      def segsubtoc? -        if (defined? @rc['omit']['segsubtoc'] \ -        and not @rc['omit']['segsubtoc'].nil?) \ -        or listed?('segsubtoc') -          :off -        else -          :na -        end -      end -      def html_right_pane? -        if (defined? @rc['omit']['html_right_pane'] \ -        and not @rc['omit']['html_right_pane'].nil?) \ -        or listed?('html_right_pane') -          :off -        else -          :na -        end -      end -      def html_top_band? -        if (defined? @rc['omit']['html_top_band'] \ -        and not @rc['omit']['html_top_band'].nil?) \ -        or listed?('html_top_band') -          :off -        else -          :na -        end -      end -      def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line -        if (defined? @rc['omit']['search_form'] \ -        and not @rc['omit']['search_form'].nil?) \ -        or listed?('search_form') -          :off -        else -          :na -        end -      end -      def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line -        if (defined? @rc['omit']['html_search_form'] \ -        and not @rc['omit']['html_search_form'].nil?) \ -        or listed?('html_search_form') -          :off -        else -          :na -        end -      end -      self -    end -    def odt_ocn? -      ((defined? @rc['odt']['ocn']) \ -      && @rc['odt']['ocn']==false) \ -      ? @rc['odt']['ocn'] -      : true -    end -    def xml_docbook_ocn? -      ((defined? @rc['xml_docbook']['ocn']) \ -      && @rc['xml_docbook']['ocn']==false) \ -      ? @rc['xml_docbook']['ocn'] -      : true -    end -    def xml_fictionbook_ocn? -      ((defined? @rc['xml_fictionbook']['ocn']) \ -      && @rc['xml_fictionbook']['ocn']==false) \ -      ? @rc['xml_fictionbook']['ocn'] -      : true -    end -    def xml_scaffold_ocn? -      ((defined? @rc['xml_scaffold']['ocn']) \ -      && @rc['xml_scaffold']['ocn']==false) \ -      ? @rc['xml_scaffold']['ocn'] -      : true -    end -    def plaintext_ocn? -      ((defined? @rc['plaintext']['ocn']) \ -      && @rc['plaintext']['ocn']==false) \ -      ? @rc['plaintext']['ocn'] -      : true -    end -    def textile_ocn? -      ((defined? @rc['textile']['ocn']) \ -      && @rc['textile']['ocn']==true) \ -      ? @rc['textile']['ocn'] -      : false -    end -    def asciidoc_ocn? -      ((defined? @rc['asciidoc']['ocn']) \ -      && @rc['asciidoc']['ocn']==true) \ -      ? @rc['asciidoc']['ocn'] -      : false -    end -    def markdown_ocn? -      ((defined? @rc['markdown']['ocn']) \ -      && @rc['markdown']['ocn']==true) \ -      ? @rc['markdown']['ocn'] -      : false -    end -    def rst_ocn? -      ((defined? @rc['rst']['ocn']) \ -      && @rc['rst']['ocn']==true) \ -      ? @rc['rst']['ocn'] -      : false -    end -    def widget #needs (md) #move -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -      @ad=SiSU_Env::GetInit.new.ads -      @vz=SiSU_Viz::Defaults.new -      @flag={ ad: false, md: false, sk: false, rc: false } -      def promo? -        @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] -          @flag[:md]=true -          true -        elsif defined? @vz.widget_promo \ -        and not @vz.widget_promo.nil? \ -        and @vz.widget_promo.is_a?(Array) \ -        and @vz.widget_promo.length > 0 -          @flag[:sk]=true -          true -        elsif defined? @rc['html']['promo'] \ -        and not @rc['html']['promo'].nil? \ -        and @rc['html']['promo'].length > 0 -          @flag[:rc]=true -          true -        else false -        end -        @flag -      end -      def search? -        searches=['sisu'] -        flag=false -        if defined? @rc['search'] -          searches.each do |type| -            flag=if defined? @rc['search'][type] \ -            and defined? @rc['search'][type]['action'] \ -            and @rc['search'][type]['flag']==true \ -            and @rc['search'][type]['action'] =~/https?:\/\// -              flag=if promo?[:ad] -                false -              elsif defined? @vz.widget_search \ -              and @vz.widget_search==true -                true -              elsif defined? @rc['search'][type]['flag'] \ -              and @rc['search'][type]['flag']==true -                true -              else false -              end -            else false -            end -          end -        else false -        end -        flag -      end -      def search_fixed? -        searches=['sisu','hyperestraier'] -        flag=if defined? @rc['search'] -          searches.each do |type| -            if defined? @rc['search'][type] \ -            and defined? @rc['search'][type]['action'] \ -            and @rc['search'][type]['action'] =~/https?:\/\// \ -            and defined? @rc['search'][type]['db'] \ -            and @rc['search'][type]['db'] =~/\S+/ -              flag=if promo?[:ad] -                false -              elsif defined? @vz.widget_search \ -              and @vz.widget_search==true -                true -              elsif defined? @rc['search'][type]['flag'] \ -              and @rc['search'][type]['flag']==true -                true -              else false -              end -            else false -            end -          end -        else false -        end -      end -      def search_form(type='sisusearch',action=nil,db=nil,table=false) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form_sisu=if action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget.search? -          db=if rc['search']['sisu']['flag']==true \ -          and rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        elsif defined? rc['search']['sisu']['flag'] \ -        and defined? rc['search']['sisu']['action'] \ -        and rc['search']['sisu']['flag']==true \ -        and rc['search']['sisu']['action'] =~/https?:\/\// -          true -        else false -        end -        if table -          table_open='<td align="center" bgcolor="#ffffff">' -          table_close='</td>' -        else -          table_open='' -          table_close='<br />' -        end -        form=if create_form_sisu \ -        and type=~/sisusearch/ \ -        and defined? rc['search']['sisu'] \ -        and defined? rc['search']['sisu']['action'] -          <<WOK -<!-- SiSU Search --> -#{table_open} -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="ltd" value="1000" /> -<input type="hidden" name="off" value="0" /> -<input type="hidden" name="doc" value="#{@md.fnb}" /><br /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font></form> -#{table_close} -<!-- SiSU Search --> -WOK -        else '' -        end -        form -      end -      def search_form_static(action=nil,db=nil) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form=if rc['search']['sisu']['flag']==true \ -        and action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget.search_fixed? -          db=if rc['search']['sisu']['flag']==true \ -          and rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        else false -        end -        if create_form -          %{<td align="center" bgcolor="#ffffff"> -<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="ltd" value="1000" /> -<input type="hidden" name="off" value="0" /> -<input type="hidden" name="doc" value="#{@md.fnb}" /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> -</td> } -        else '' -        end -      end -      def search_action #check -        if search? -        else '' -        end -      end -      self -    end -    def widget_static -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -      @vz=SiSU_Viz::Defaults.new -      @flag={ ad: false, md: false, sk: false, rc: false } -      def search? -        flag=if defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\// \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ -          flag=if defined? @vz.widget_search \ -          and @vz.widget_search==true -            true -          elsif defined? @rc['search']['sisu']['flag'] \ -          and @rc['search']['sisu']['flag']==true -            true -          else -            false -          end -        else -          false -        end -      end -      def search_fixed? -        flag=if defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\// \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ \ -        and defined? @rc['search']['sisu']['db'] \ -        and @rc['search']['sisu']['db'] =~/\S+/ -          flag=if defined? @vz.widget_search \ -          and @vz.widget_search==true -            true -          elsif defined? @rc['search']['sisu']['flag'] \ -          and @rc['search']['sisu']['flag']==true -            true -          else -            false -          end -        else -          false -        end -      end -      def search_form(action=nil,db=nil) -        rc=SiSU_Env::GetInit.new.sisu_yaml.rc -        create_form=if defined? rc['search']['sisu']['flag'] \ -        and rc['search']['sisu']['flag']==true \ -        and action \ -        and db \ -        and action =~/https?:\/\// \ -        and db =~/\S+/ -          true -        elsif widget_static.search? \ -        and rc['search']['sisu']['flag']==true -          db=if rc['search']['sisu']['db']=~/\S+/ -            (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ -            ? rc['search']['sisu']['db'] -            : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" -          else nil -          end -          action=rc['search']['sisu']['action'] -          true -        else false -        end -        if create_form \ -        and @fnb \ -        and @fnb=~/\S+/ -          %{<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="hidden" name="doc" value="#{@fnb}" /> -<input type="submit" name="search" value="search doc" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> } -        elsif create_form -          %{<!-- SiSU Search --> -<a name="search"></a> -<form method="get" action="#{rc['search']['sisu']['action']}" target="_top"> -<font size="2"> -<input type="text" name="s1" size="24" maxlength="255" /> -<br /> -<input type="hidden" name="db" value="#{db}" /> -<input type="submit" name="search" value="search db" /> -</font> -</form> -<!-- SiSU Search --> } -        else '' -        end -      end -      def search_action #check -        if search? -        else '' -        end -      end -      self -    end -    def source_file_path -      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') -      unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" -      else "#{processing_path.composite_file}" -      end -    end -    def source_file_with_path -      file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') -      "#{source_file_path}/#{file}" -    end -    def texpdf_hyperlinks(cli) -      @cli=cli -      @hyplnks=if cli != :na -        cli -      elsif (defined? @rc['default']['pdf_hyperlinks']) \ -      && (@rc['default']['pdf_hyperlinks']=~/color/) -        :color -      elsif (defined? @rc['default']['pdf_hyperlinks']) \ -      && (@rc['default']['pdf_hyperlinks']=~/(?:no-color|color-off|mono(?:chrome)?)/) -        :mono -      else :na -      end -      def landscape -        if @cli != :na -          @cli -        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ -        && (@rc['default']['pdf_hyperlinks_landscape']=~/color/) -          :color -        elsif (defined? @rc['default']['pdf_hyperlinks_landscape']) \ -        && (@rc['default']['pdf_hyperlinks_landscape']=~/(?:no-color|color-off|mono(?:chrome)?)/) -          :mono -        elsif @hyplnks != :na -          @hyplnks -        else :na -        end -      end -      def portrait -        if @cli != :na -          @cli -        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ -        && (@rc['default']['pdf_hyperlinks_portrait']=~/color/) -          :color -        elsif (defined? @rc['default']['pdf_hyperlinks_portrait']) \ -        && (@rc['default']['pdf_hyperlinks_portrait']=~/(?:no-color|color-off|mono(?:chrome)?)/) -          :mono -        elsif @hyplnks != :na -          @hyprlnks -        else :na -        end -      end -      self -    end -    def font -      def size(pt=nil) -        if pt && pt != :na -          pt -        elsif defined? @rc['default']['fontsize'] \ -        && @rc['default']['fontsize']=~/\d{1,2}/ -          @rc['default']['fontsize'] -        else :na -        end -      end -      def texpdf -        # you may wish to check selected font against available fonts: -        # fc-list :outline -f "%{family}\n" -        # fc-list :lang=ja -        def main -          (defined? @rc['default']['texpdf_fontface']) \ -          && (@rc['default']['texpdf_fontface']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface'] -          : 'Liberation Sans' -        end -        def sans                                                               # not used -          (defined? @rc['default']['texpdf_fontface_sans']) \ -          && (@rc['default']['texpdf_fontface_sans']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_sans'] -          : 'Liberation Sans' -        end -        def serif                                                              # not used -          (defined? @rc['default']['texpdf_fontface_serif']) \ -          && (@rc['default']['texpdf_font_serif']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_serif'] -          : 'Liberation Serif' -        end -        def mono -          (defined? @rc['default']['texpdf_fontface_mono']) \ -          && (@rc['default']['texpdf_fontface_mono']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_mono'] -          : 'Liberation Mono' -        end -        def cjk -          (defined? @rc['default']['texpdf_fontface_cjk']) \ -          && (@rc['default']['texpdf_fontface_cjk']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk'] -          : 'IPAGothic' # 'IPAGothic' # 'IPAMincho' # 'TakaoMincho' # 'VL Gothic' -        end -        def cjk_zh -          (defined? @rc['default']['texpdf_fontface_cjk_zh']) \ -          && (@rc['default']['texpdf_fontface_cjk_zh']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_zh'] -          : 'IPAGothic' -        end -        def cjk_ja -          (defined? @rc['default']['texpdf_fontface_cjk_ja']) \ -          && (@rc['default']['texpdf_fontface_cjk_ja']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_ja'] -          : 'IPAGothic' -        end -        def cjk_ko -          (defined? @rc['default']['texpdf_fontface_cjk_ko']) \ -          && (@rc['default']['texpdf_fontface_cjk_ko']=~/\S{3,}/)  \ -          ? @rc['default']['texpdf_fontface_cjk_ko'] -          : 'IPAGothic' -        end -        def size(pt=nil) -          if pt && pt != :na -            pt -          elsif (defined? @rc['default']['texpdf_fontsize']) \ -          && (@rc['default']['texpdf_fontsize']=~/\d{1,2}/) -            @rc['default']['texpdf_fontsize'] -          elsif (defined? @rc['default']['fontsize']) \ -          && (@rc['default']['fontsize']=~/\d{1,2}/) -            @rc['default']['fontsize'] -          else -            :na -          end -        end -        self -      end -      self -    end -    def path_rel_links -      def html_scroll_2 -        if @env.output_dir_structure.by_language_code? -          '../../' -        elsif @env.output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_seg_2 -        if @env.output_dir_structure.by_language_code? -          '../../../' -        elsif @env.output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def html_scroll_1 -        if @env.output_dir_structure.by_language_code? -          '../' -        elsif @env.output_dir_structure.by_filetype? -          '../' -        else -          './' -        end -      end -      def html_seg_1 -        if @env.output_dir_structure.by_language_code? -          '../../' -        elsif @env.output_dir_structure.by_filetype? -          '../../' -        else -          './' -        end -      end -      self -    end -    def read_source_file_array(fns) -      (fns !~/\.ssm.sst$/) \ -      ? (IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)) -      : (IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) -    end -    def read_source_file(fns) -      read_source_file_array(fns) -    end -    def read_source_file_string(fns) -      (fns !~/\.ssm.sst$/) \ -      ? (IO.read(fns, mode: 'r:utf-8', cr_newline: true)) -      : (IO.read("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)) -    end -    def source_file_processing_array(fns) -      read_source_file_string(fns).split(/\s*\n\s*\n/m) -    end -    def path                                                                     #dir -      def home -        @sys.home -      end -      def sisurc_path -        GetInit.new.sisu_yaml.rc_path -      end -      def pwd -        @sys.pwd -      end -      def base_markup_dir_stub -        @base_markup_dir_stub -      end -      def stub_epub -        @stub_epub -      end -      def stub_src -        @stub_src -      end -      def stub_pod -        @stub_pod -      end -      def etc -        defaults[:sisu_etc]                                                      #live/dynamic -      end -      def arch -        @sys.dir_arch -      end -      def sitearch -        @sys.dir_sitearch -      end -      def bin -        @sys.dir_bin -      end -      def share                                                                #shared data repository source directory -        defaults[:sisu_share] #; p __LINE__.to_s + ':' + __FILE__ + ' ' + defaults[:sisu_share] -      end -      def style -        if @md \ -        && ((@md.opt.opt_act[:dump][:bool] \ -        &&   @md.opt.opt_act[:dump][:inst]) \ -        ||  (@md.opt.opt_act[:redirect][:bool] \ -        &&   @md.opt.opt_act[:redirect][:inst])) -          'css' -        else -         defaults[:stylesheet_stub] -        end -      end -      def sample_data                                                          #sample data repository source directory -        defaults[:sample_data_path] -      end -      def rc -        @init.rc_path -      end -      def yamlrc -        GetInit.new.sisu_yaml.rc_path -      end -      def man #check use -        (defined? @rc['webserv']['man']) \ -        ? "#{webserv}/#{@rc['webserv']['man']}" -        : defaults[:webserv_man] -      end -      def webserv_path #testing, check need, remove -        webserv -      end -      def webserv                                                              #separation required for webrick which cannot use path.output (different requirements as no file is passed) -        man_path=if @@man_path.nil? -          man_path=if defined? @rc['webserv']['path'] \ -          and @rc['webserv']['path'] =~/\S\S+/ -            pwd=Dir.pwd -            Dir.chdir(SiSU_Utils::Path.new.base_markup) -            man_path=@@man_path=File.expand_path(@rc['webserv']['path']) -            Dir.chdir(pwd) -            man_path -          else defaults[:webserv_path] -          end -        else @@man_path -        end -        man_path_head=man_path.gsub(/(\S+)\/[^\/\s]+$/,'\1') -        unless FileTest.directory?(man_path) -          FileUtils::mkdir_p(man_path) if File.writable?("#{man_path_head}/.") -        end -        @webserv_path=if defined? man_path \ -        and File.writable?("#{man_path}/.") -          man_path #web server path as configured in rc file -        elsif FileTest.directory?(defaults[:webserv_path]) \ -        and File.writable?("#{defaults[:webserv_path]}/.") #web server path default -          defaults[:webserv_path] -        else #create default directory under home and place output there -          unless FileTest.directory?(defaults[:output_local]) -            FileUtils::mkdir_p(defaults[:output_local]) -          end -          defaults[:output_local] -        end -      end -      def webserv_stub_ensure -        FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) -        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}/#{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] -      end -      def webserv_image                                                        #web/presentation directory, subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) -        images=if defined? @rc['webserv']['images'] -          @rc['webserv']['images'] -        else defaults[:images] -        end -        "#{path.webserv}/#{images}" -      end -      def output                                                               #web/webserv output directory... subdirectory into which further subdirectories are made based on file names -        r=Px[:lng_lst_rgx] -        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -        base_stub=@sys.pwd.gsub(u,'\1') -        if Dir.pwd =~/\/#{Gt[:sisupod]}\/[^\/]+\/#{Gt[:pod]}\/#{Gt[:doc]}/ -          "#{path.webserv}/#{Gt[:doc]}" -        else -          "#{path.webserv}/#{base_stub}" -        end -      end -      def feed -        (defined? @rc['webserv']['feed']) \ -        ? ("#{public_output}/#{@rc['webserv']['feed']}") -        : (defaults[:webserv_feed]) -      end -      def feed_home -        "#{public_output}/#{@rc['webserv']['feed_home']}" -      end -      def scripts                                                                #used previously only to include tla version info -        if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}" -        end -      end -      def cgi -        (defined? @rc['webserv']['cgi']) \ -        ? "#{@rc['webserv']['cgi']}" -        : (defaults[:webserv_cgi]) -      end -      def php -        (defined? @rc['webserv']['php']) \ -        ? "#{public_output}/#{@rc['webserv']['php']}" -        : (defaults[:webserv_php]) -      end -                                                                                 # programs -      def output_tell -        url.webserv_map_pwd -      end -      def image_source                                                           #image repository source directory -        if defined? @rc['image']['path'] \ -        and defined? @rc['image']['public'] -          pth="#{@rc['image']['path']}" -          "#{pth}/#{@rc['image']['public']}" -        else -          "#{share}/image" -        end -      end -      def image_source_sisu_includes -        "#{share}/image" -      end -      def image_source_include                                                       #image repository source directory -        if defined? @rc['image']['path'] \ -        and defined? @rc['image']['public'] \ -        and FileTest.directory?("#{@rc['image']['path']}/#{@rc['image']['public']}")==true -          "#{@rc['image']['path']}/#{@rc['image']['public']}" -        elsif FileTest.directory?("#{@@pwd}/#{defaults[:image_stub]}")==true -          "#{@@pwd}/#{defaults[:image_stub]}" -        elsif FileTest.directory?("#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}")==true -          "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" -        else -          "#{share}/image" -        end -      end -      def image_external -        "#{processing}/external_document/image" -      end -      def image_source_include_local -        if FileTest.directory?(defaults[:image_local]); defaults[:image_local] -        end -      end -      def image_source_include_remote -        if FileTest.directory?(image_external); image_external -        end -      end -      self -    end -    def processing_path -      def encoding -        pth="#{processing}/#{defaults[:processing_encoding]}" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def processing_base_tmp -        defaults[:processing_path_tmp_base] -      end -      def tmp_root_dir -        defaults[:processing_dir_tmp_root] -      end -      def root_dir -        proposed_path_base=if defined? @rc['processing']['path'] \ -        and not @rc['processing']['path'].nil? \ -        and not @rc['processing']['path'].empty? -          x=if @rc['processing']['path'] =~/^(?:~|home)$/ -            home #fix -          else @rc['processing']['path'] -          end -        else nil -        end -        proposed_dir=if defined? @rc['processing']['dir'] \ -        and not @rc['processing']['dir'].nil? \ -        and not @rc['processing']['dir'].empty? -          @rc['processing']['dir'] -        else defaults[:processing_dir] -        end -        v=SiSU_Env::InfoVersion.instance.get_version -        v_dev=(DEVELOPER[:maintenance]==:true) \ -        ? "_#{v[:version]}" -        : '' -        path=if proposed_path_base \ -        and FileTest.directory?(proposed_path_base) \ -        and File.writable?("#{proposed_path_base}/.") -          x=proposed_dir \ -          ? "#{proposed_path_base}/#{proposed_dir}" -          : "#{proposed_path_base}/#{defaults[:processing_dir]}" -        else defaults[:processing_dir_tmp_root] -        end -        path = path + v_dev -      end -      def usr_dir? -        case root_dir -        when /^\/home/ then false -        else                true -        end -      end -      def stub_dir -        (usr_dir?) \ -        ? ("#{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}/#{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 -        def paths -          processing_path_usr="#{root_dir}/#{user}" -          processing_path_fnb=processing_path_usr + '/' + Gt[:pods] + '/' + @opt.fng -          processing_path_sisupod=processing_path_fnb + '/' + Gt[:sisupod] -          { fnb: processing_path_fnb, sisupod: processing_path_sisupod } -        end -        def make -          unless FileTest.directory?(root_dir) -            FileUtils::mkdir_p(root_dir) -            File.chmod(0777,root_dir) -          end -          if usr_dir? -            processing_path_usr="#{root_dir}/#{user}" -            FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) -            File.chmod(0700,processing_path_usr) -          end -          sisupod_processing_path=paths[:sisupod] -          FileUtils::mkdir_p(sisupod_processing_path) unless FileTest.directory?(sisupod_processing_path) -          sisupod_processing_path_lng=if defined? @opt.lng -            sisupod_processing_path + '/' + Gt[:doc] + '/' + @opt.lng -          else -            sisupod_processing_path + '/' + Gt[:doc] -          end -          unless FileTest.directory?(sisupod_processing_path_lng) -            #puts "a processing directory (#{sisupod_processing_path_lng}) is being created for use by sisu" -            FileUtils::mkdir_p(sisupod_processing_path_lng) -            File.chmod(0700,sisupod_processing_path_lng) -          end -          sisupod_processing_path -        end -        self -      end -      def processing                                                             #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) -        unless FileTest.directory?(root_dir) -          FileUtils::mkdir_p(root_dir) -          File.chmod(0777,root_dir) -        end -        if usr_dir? -          processing_path_usr="#{root_dir}/#{user}" -          FileUtils::mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) -          File.chmod(0700,processing_path_usr) -        end -        FileUtils::mkdir_p(stub_dir) unless FileTest.directory?(stub_dir) -        File.chmod(0700,stub_dir) -        path_processing=[stub_dir,defaults[:processing_path],defaults[:processing_path_home]] -        processing=nil -        path_processing.each do |v|                                              # -          processing=v -          unless FileTest.directory?(processing) -            FileUtils::mkdir_p(processing) -            File.chmod(0700,processing) -          end -          break -        end -        processing -      end -      def ao -        pth=if defined? @rc['processing']['dal'] \ -          and @rc['processing']['dal'].is_a?(String) -          "#{processing}/#{@rc['processing']['dal']}" -        else "#{processing}/#{defaults[:processing_ao]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def tune -        pth=if defined? @rc['processing']['tune'] \ -          and @rc['processing']['tune'].is_a?(String) -          "#{processing}/#{@rc['processing']['tune']}" -        else "#{processing}/#{defaults[:processing_tune]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def composite_file -        pth=processing_path.ao  #"#{processing}/composite" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def git -        pth=if defined? @rc['git']['dir'] \ -        and @rc['git']['dir'].is_a?(String) -          (@rc['git']['dir'] =~/^(?:~|home)$/) \ -          ? home + '/' + Gt[:git] -          : @rc['git']['dir'] + '/' + Gt[:git] -        else defaults[:processing_git] -        end -        unless FileTest.directory?(pth) -          FileUtils::mkdir_p(pth) -          File.chmod(0700,pth) -        end -        pth -      end -      def odf_pth -        pth="#{processing}/odf/#{@fns}" -        pth -      end -      def odf -        odt -      end -      def odt -        pth=odf_pth + '/odt' -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def odf -        pth="#{processing}/odf" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def odt_bld -        FileUtils::rm_rf(processing_path.odt) -        FileUtils::mkdir_p(processing_path.odt) unless FileTest.directory?(processing_path.odt) -        FileUtils::mkdir_p("#{processing_path.odt}/Configurations2") unless FileTest.directory?("#{processing_path.odt}/Configurations2") -        FileUtils::mkdir_p("#{processing_path.odt}/META-INF") unless FileTest.directory?("#{processing_path.odt}/META-INF") -        FileUtils::mkdir_p("#{processing_path.odt}/Pictures") unless FileTest.directory?("#{processing_path.odt}/Pictures") -        FileUtils::mkdir_p("#{processing_path.odt}/Thumbnails") unless FileTest.directory?("#{processing_path.odt}/Thumbnails") -        processing_path.odt -      end -      def epub -        "#{processing}/epub/#{@fnb}" -      end -      def epub_bld #(md) -        FileUtils::rm_rf(processing_path.epub) if FileTest.directory?(processing_path.epub) -        FileUtils::mkdir_p(processing_path.epub) unless FileTest.directory?(processing_path.epub) -        FileUtils::mkdir_p("#{processing_path.epub}/META-INF") unless FileTest.directory?("#{processing_path.epub}/META-INF") -        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/image") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/image") -        FileUtils::mkdir_p("#{processing_path.epub}/#{Ep[:d_oebps]}/css") unless FileTest.directory?("#{processing_path.epub}/#{Ep[:d_oebps]}/css") -        processing_path.epub -      end -      def epub_cp_images(md) -        pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        src="#{path.share}/image" -        images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] -        images.each do |i| #move to avoid repeated tests -          if FileTest.file?("#{src}/#{i}") -            FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} -          end -        end -        pth -      end -      def tex -        pth=if defined? @rc['processing']['latex'] \ -        and @rc['processing']['latex'].is_a?(String) -          "#{processing}/#{@rc['processing']['latex']}" -        else "#{processing}/#{defaults[:processing_latex]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def texi -        pth=if defined? @rc['processing']['texinfo'] \ -        and @rc['processing']['texinfo'].is_a?(String) -          "#{processing}/#{@rc['processing']['texinfo']}" -        else "#{processing}/#{defaults[:processing_texinfo]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def texinfo                                                                #texinfo webserv, check -        "#{processing}/#{defaults[:processing_texinfo]}" -      end -      def manpage -        "#{path.output}/man" -      end -      def lout -        pth=if defined? @rc['processing']['lout'] \ -        and @rc['processing']['lout'].is_a?(String) -          "#{processing}/#{@rc['processing']['lout']}" -        else "#{processing}/#{defaults[:processing_lout]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def sql -        pth="#{processing}/sql" -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def sqlite -        pth=if defined? @rc['processing']['sqlite'] \ -        and @rc['processing']['sqlite'].is_a?(String) -          "#{processing}/#{@rc['processing']['sqlite']}" -        else "#{processing}/#{defaults[:processing_sqlite]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      def postgresql -        pth=if defined? @rc['processing']['postgresql'] \ -        and @rc['processing']['postgresql'].is_a?(String) -          "#{processing}/#{@rc['processing']['postgresql']}" -        else "#{processing}/#{defaults[:processing_postgresql]}" -        end -        FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -        pth -      end -      self -    end -    def url -      def hostname -        "http://#{@sys.hostname}" -      end -      def dir_url -        "file://#{path.webserv}/#{base_markup_dir_stub}" -      end -      def localhost -        "http://localhost/#{base_markup_dir_stub}" -      end -      def local -        "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']}/#{@base_markup_dir_stub}" -        elsif defined? @rc['webserv']['url_root'] \ -        and @rc['webserv']['url_root'] =~/localhost/ -          "http://localhost/#{@base_markup_dir_stub}" -        else "file://#{path.output}" -        end -      end -      def remote -        root -      end -      def txt -        "#{root}/txt" -      end -      def html -        "#{root}/html" -      end -      def epub -        "#{root}/epub" -      end -      def odt -        "#{root}/odt" -      end -      def pdf -        "#{root}/pdf" -      end -      def src_txt -        "#{root}/src" -      end -      def src_pod -        "#{root}/pod" -      end -      def pot -        "#{root}/po4a/pot" -      end -      def po -        "#{root}/po4a/po" -      end -      def webserv_host_base(opt=nil) -        if defined? @rc['webserv']['host'] -          case  @rc['webserv']['host'] -          when /https?:\/\// then @rc['webserv']['host'] -          when /\S+/         then "http://#{@rc['webserv']['host']}" -          else                    defaults[:webserv_host_cgi] -          end -        else                      defaults[:webserv_host_cgi] -        end -      end -      def webserv_cgi(opt=nil)                                                          #web url for local webserv (localhost, or hostname) -        http=if defined? @rc['webserv_cgi']['host'] \ -        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}/#{@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)}/#{@base_markup_dir_stub}" -          else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" -          end -        end -        http=http.strip -      end -      def webserv_base_cgi(opt=nil)                                                     #web url for local webserv (localhost, or hostname) -        http=if opt.mod.inspect =~/--webserv-(?:cgi|db|search)[=-]["']?(\S+)["']+/ -          m=$1 -          (m=~/http\/\/:/) ? m : %{http://#{m}} -        elsif defined? @rc['webserv_cgi']['host'] \ -        and @rc['webserv_cgi']['host'].is_a?(String) -          http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') -          if port.webserv_port_cgi(opt) -            "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi(opt)}" -          else "#{http}#{@rc['webserv_cgi']['host']}" -          end -        else -          http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') -          if port.webserv_port_cgi(opt) -            "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}" -          else "#{http}#{webserv_host_base}" -          end -        end -        http=http.strip -        #%q{http://#{ENV['HTTP_HOST']}} -      end -      def webrick #must have a port #REMOVE -        if defined? @rc['webserv_cgi']['host'] \ -        and @rc['webserv_cgi']['host'].is_a?(String) -          http=if @rc['webserv_cgi']['host'] =~/http:\/\// -            'http://' -          elsif @rc['webserv_cgi']['host'] =~/https:\/\// -            'https://' -          else defaults -          end -          "#{http}#{@rc['webserv_cgi']['host']}" -        elsif webserv_host_base \ -        and webserv_host_base.is_a?(String) -          "#{http}#{webserv_host_base}" -        else "#{http}localhost" end -      end -      def webserv                                                              #web url for local webserv (localhost, or hostname) -        if defined? @rc['webserv']['url_root'] \ -        and @rc['webserv']['url_root'] =~/http/ -          # needed for alternative output dir structures, fixes manifest url links, check may cause problems elsewhere -          @rc['webserv']['url_root'] -        elsif path.webserv_dir \ -        and path.webserv =~ /#{path.webserv_dir}/ #revisit -          "#{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}" -        elsif port.webserv_port_cgi =~/\S+/ -          "#{url.hostname}:#{port.webserv_port_cgi}" -        else -          url.hostname -        end -      end -      def webserv_base                                                         #web url for local webserv (localhost, or hostname) -        if path.webserv_dir \ -        and path.webserv =~ /#{path.webserv_dir}/ #revisit -          "#{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}" -        else "#{url.webrick_base}" -        end -      end -      def webserv_files_from_db(opt=nil) #sort this out, messy -        if opt.mod.inspect =~/--webserv-output[=-]["']?(\S+)["']+/ -          m=$1 -          (m=~/(?:http|file\/)\/\/:/) ? m : %{http://#{m}} -        else -          show_output_on=if defined? @rc['webserv_cgi']['show_output_on'] -            @rc['webserv_cgi']['show_output_on'] -          elsif  defined? @rc['webserv_cgi']['file_links'] -            @rc['webserv_cgi']['file_links'] -          else '' -          end -          m=case show_output_on -          when /webserv_cgi/ then url.webserv_base_cgi(opt) -          when /webserv/     then @rc['webserv']['url_root'] -          when /https?:\/\// then @rc['webserv_cgi']['file_links'] -          when /\S+/         then "http://#{@rc['webserv_cgi']['file_links']}" -          else                     webserv_base_cgi(opt) -          end -        end -        #%q{http://#{ENV['HTTP_HOST']}/cgi-bin} -      end -      def cgi_sample_search_form_name(opt=nil) -        if opt.mod.inspect =~/--(?:cgi-)?search-form-name[=-]["']?(\S+?\.cgi)/ -          $1 -        elsif not opt.mod.inspect =~/--db[=-]["']?sqlite/ \ -        and defined? @rc['search'] \ -        and defined? @rc['search']['sisu'] \ -        and defined? @rc['search']['sisu']['action'] \ -        and @rc['search']['sisu']['action'] =~/https?:\/\/\S+?\.cgi/ -          /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] -        else -          (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ -          ? "#{Db[:name_prefix_db]}sqlite.cgi" \ -          :  "#{Db[:name_prefix_db]}pg.cgi" -        end -      end -      def sample_search_form_title(organised_by=:language) -        title=if defined? @rc['search']['sisu']['title'] \ -        and @rc['search']['sisu']['title'] =~/\S+/ -          @rc['search']['sisu']['title'] -        else %{SiSU (generated sample) search form} -        end -        title=title + " (content organised by #{organised_by})" -      end -      def output_tell                                      #BROKEN Revisit 2011-02 -        output_type=if defined? @rc['show_output_on'] \ -        and @rc['show_output_on'] =~/^(?:filesystem|webserv|(?:local|remote)(?:_webserv)?|webrick)/ -          @rc['show_output_on'] -        else 'filesystem' -        end -        case output_type -        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 + '/' + 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 -        else                                   url.webserv_map_pwd -        end -      end -      def images -        "#{Xx[:html_relative2]}/_sisu/image" -      end -      #def images -      #  '../_sisu/image' -      #end -      def images_local -        if FileTest.directory?(path.image_source_include) -          path.image_source_include -        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/ -            @@local_image=false -          end -          url.images -        end -      end -      def images_external -        if FileTest.directory?(image_external) -          if @@image_flag -            images=Dir.glob("#{image_external}/*.{png,jpg,gif}") -            pth="#{path.webserv}/#{@base_markup_dir_stub}" -            FileUtils::mkdir_p("#{pth}/_sisu/image_external") \ -              unless FileTest.directory?("#{pth}/_sisu/image_external") -            images.each { |i| File.install(i,"#{pth}/#{i}") } \ -              unless images.length > 0 -            @@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/ -            @@local_image=false -          end -          url.images_external -        end -      end -      def images_epub -        './image' -      end -      self -    end -    def port -      def webrick_port -        if @md \ -        and @md.opt.cmd.inspect=~/-F/ \ -        and @md.opt.mod.inspect=~/port=(\d+)/ -           $1 -        else -          if defined? @rc['webserv_cgi']['port'] -            if @rc['webserv_cgi']['port'].nil? \ -            and (defined? @md.opt.mod \ -            and not @md.opt.mod.nil? \ -            and @md.opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            elsif not @rc['webserv_cgi']['port'].nil? -              @rc['webserv_cgi']['port'] -            else defaults[:webserv_port_cgi] -            end -          else   defaults[:webserv_port_cgi] -          end -        end -      end -      def webserv_port_cgi(opt=nil) -        port=if opt \ -        and opt.cmd.inspect=~/-F/ \ -        and opt.mod.inspect=~/port=(\d+)/ -           $1 -        else -          port=if defined? @rc['webserv_cgi']['port'] -            if @rc['webserv_cgi']['port'].nil? \ -            and (defined? opt.mod \ -            and not opt.mod.nil? \ -            and opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            elsif not @rc['webserv_cgi']['port'].nil? -              @rc['webserv_cgi']['port'] -            else nil -            end -          else -            if (defined? opt.mod \ -            and not opt.mod.nil? \ -            and opt.mod.inspect=~/webrick/) -              defaults[:webserv_port_cgi] -            else nil -            end -          end -        end -      end -      self -    end -    def digest_conf? -      if defined? @rc['default']['digest'] \ -      and @rc['default']['digest'] != nil -        case @rc['default']['digest'] -        when /^sha(?:5|512)?$/ then :sha512 -        when /^sha(?:2|256)?$/ then :sha256 -        when /^md5$/           then :md5 -        else                        :sha256 -        end -      else                          :sha256 -      end -    end -    def digest(opt=nil) -      @opt=opt -      def type -        if @opt -          case @opt.act[:hash_digest_algo] -          when :sha512 then :sha512 -          when :sha256 then :sha256 -          when :md5    then :md5 -          else digest_conf? -          end -        else digest_conf? -        end -      end -      def length -        case digest(@opt).type -        when :sha512 then 128 -        when :sha256 then  64 -        when :md5    then  32 -        else               64 -        end -      end -      def pattern -        "[0-9a-f]{#{digest(@opt).length}}" #/[0-9a-f]{#{digest.length}}/ -      end -      self -    end -    def program -      def text_editor -        if defined? @rc['program_select']['editor'] \ -        and @rc['program_select']['editor'] =~/\S\S+/ -          @rc['program_select']['editor'] -        elsif defined? @rc['program_select']['text_editor'] \ -        and @rc['program_select']['text_editor'] =~/\S\S+/ -          @rc['program_select']['text_editor'] -        else 'editor'                                                            #'gvim -c :R -c :S' -        end -      end -      def pdf_viewer -        ((defined? @rc['program_select']['pdf_viewer']) \ -        && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['pdf_viewer'] -        : 'pdf-viewer'                                                        #'evince' -      end -      def web_browser -        if defined? @rc['program_select']['www_browser'] \ -        and @rc['program_select']['www_browser'] =~/\S\S+/ -          @rc['program_select']['www_browser'] -        elsif defined? @rc['program_select']['web_browser'] \ -        and @rc['program_select']['web_browser'] =~/\S\S+/ -          @rc['program_select']['web_browser'] -        else 'x-www-browser'                                                      #'firefox' 'iceweasel' 'kazehakase' 'galeon' -        end -      end -      def www_browser -        web_browser -      end -      def console_web_browser -        if defined? @rc['program_select']['console_www_browser'] \ -        and @rc['program_select']['console_www_browser'] =~/\S\S+/ -          @rc['program_select']['console_www_browser'] -        elsif defined? @rc['program_select']['console_web_browser'] \ -        and @rc['program_select']['console_web_browser'] =~/\S\S+/ -          @rc['program_select']['console_web_browser'] -        else 'console-www-browser'                                             #'lynx' 'links' 'links2' 'elinks' 'w3m' -        end -      end -      def console_www_browser -        web_browser -      end -      def epub_viewer -        ((defined? @rc['program_select']['epub_viewer']) \ -        && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['epub_viewer'] -        : 'ebook-viewer'                                                    #'calibre' 'fbreader' -      end -      def xml_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def docbook_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def fictionbook_viewer -        ((defined? @rc['program_select']['xml_viewer']) \ -        && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['xml_viewer'] -        : text_editor -      end -      def xml_editor -        xml_viewer -      end -      def odf_viewer -        ((defined? @rc['program_select']['odf_viewer']) \ -        && @rc['program_select']['odf_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['odf_viewer'] -        : 'lowriter'                                                           #'odf-viewer','oowriter' -      end -      def manpage_viewer -        'man' -      end -      def manpage_generator -        ((defined? @rc['program_select']['man']) \ -        && @rc['program_select']['man'] =~/\S\S+/) \ -        ? @rc['program_select']['man'] -        : 'nroff -man'                                                        #'nroff -man' #'groff -man -Tascii' -      end -      def texinfo -        ((defined? @rc['program_select']['info_viewer']) \ -        && @rc['program_select']['info_viewer'] =~/\S\S+/) \ -        ? @rc['program_select']['info_viewer'] -        : 'pinfo -f'                                                          #'pinfo -f' 'info' 'tkinfo' -      end -      def file_encoding -        is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : '' -        (is.nil? || is==true) ? 'encoding' : is -      end -      def wc #wordcount -        is=(defined? @rc['program_set']['wc']) ? @rc['program_set']['wc'] : '' -        (is.nil? || is==true) ? 'wc' : is -      end -      def tidy -        is=(defined? @rc['program_set']['tidy']) ? @rc['program_set']['tidy'] : nil -        (is.nil? || is==true) ? 'tidy' : is -      end -      def rmagick -        is=(defined? @rc['program_set']['rmagick']) ? @rc['program_set']['rmagick'] : nil -        (is.nil? || is==true) ? 'rmagick' : is -      end -      def rexml                                                                  #should be part of ruby 1.8 but apparently not always -        is=(defined? @rc['program_set']['rexml']) ? @rc['program_set']['rexml'] : '' -        (is.nil? || is==true) ? 'rexml' : is -      end -      def pdflatex -        is=(defined? @rc['program_set']['pdflatex']) ? @rc['program_set']['pdflatex'] : '' -        (is.nil? || is==true) ? 'pdflatex' : is -      end -      def postgresql -        is=(defined? @rc['program_set']['postgresql']) ? @rc['program_set']['postgresql'] : '' -        (is.nil? || is==true) ? 'postgresql' : is -      end -      def sqlite -        is=(defined? @rc['program_set']['sqlite']) ? @rc['program_set']['sqlite'] : '' -        (is.nil? || is==true) ? 'sqlite' : is -      end -      self -    end -    def i18n -      def language                                                             # language settings -        m=/.+\/\S+?\~(\S+)/ -        pwd=Dir.pwd -        conf=(defined? @rc['default']['language']) ? @rc['default']['language'] : nil -        l=if pwd=~ m;                             pwd[m,1]                    #2 directory: by visible directory name -        elsif conf; @rc['default']['language']                                  #3 config: from sisurc.yaml -        else                                      defaults[:language]          #4 sisu: program default -        end                                                                     #1 document: param gets -        SiSU_Env::StandardiseLanguage.new(l) -      end -      #def multilingual -      #  x=(defined? @rc['output_structure']['multilingual'] \ -      #  && @rc['output_structure']['multilingual'] ==true) \ -      #  ? true : false -      #end -      #def bundle -      #  x=(defined? @rc['output_structure']['bundle'] \ -      #  && @rc['output_structure']['bundle'] ==true) \ -      #  ? true : false -      #end -      def lang_filename(l) -        @lang={} -        x=if output_dir_structure.by_language_code? -          (( defined? @rc['default']['language_file']) \ -          && @rc['default']['language_file'] != nil) \ -          ? @rc['default']['language_file'] -          : 1 -        else 0 -        end -        if (l != defaults[:language_code]) \ -        or (language.code != defaults[:language_code]) #watch -          if x==1;    @lang[:pre],@lang[:mid],@lang[:post]="#{l}.",'','' -          elsif x==2; @lang[:pre],@lang[:mid],@lang[:post]='',".#{l}",'' -          elsif x==3; @lang[:pre],@lang[:mid],@lang[:post]='','',".#{l}" -          else        @lang[:pre],@lang[:mid],@lang[:post]='','','' -          end -        else          @lang[:pre],@lang[:mid],@lang[:post]='','','' -        end -        @lang -      end -      self -    end -    def file_encoding -      is='' -      if defined? @rc['program_set']['file_encoding'];  is=@rc['program_set']['encoding'] -      end -      if is.nil? \ -      or is==true -        is='encoding' -      end -      is -    end -    def papersize                                                              # paper settings, default overidden in param if set within document -      (defined? @rc['default']['papersize']) \ -      ? @rc['default']['papersize'].downcase -      : (defaults[:papersize].downcase) -    end -    def odf_structure -      FileUtils::rm_rf(processing_path.processing_path.odf_pth) -      FileUtils::mkdir_p(processing_path.processing_path.odf_pth) -      system("unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d      #{processing_path.odf_pth}") -    end -    def sisupod_gen(fns_pod) -      sisupod_gen_v3(fns_pod) -    end -    def sisupod_gen_v3(fns_pod) -      pwd=Dir.pwd -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      unless FileTest.directory?(sisupod_processing_path) -        FileUtils::mkdir_p(sisupod_processing_path) -      end -      f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}") -        "#{Dir.pwd}/#{fns_pod}" -      elsif FileTest.file?(fns_pod) -        fns_pod -      end -      if f_pod \ -      && FileTest.file?(f_pod) -        (SiSU_Env::SystemCall.new.program_found?('tree')) \ -        ? "tree #{processing_path.processing}/#{Gt[:sisupod]}" -        : '' -        if FileTest.directory?(processing_path.processing) -          Dir.chdir(processing_path.processing) -          system(%{tar xJf #{f_pod}}) -          Dir.chdir(pwd) -        end -        #system(tree)                                                          #enable if (/[vVM]/) -      else -        SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/ -      end -      sisupod_processing_path -    end -    def sisupod_gen_v2(fns_pod) -      sisupod_processing_path="#{processing_path.processing}/#{Gt[:sisupod]}" -      if FileTest.directory?(sisupod_processing_path) \ -      or FileTest.file?(sisupod_processing_path) -        FileUtils::rm_rf(sisupod_processing_path) -      end -      unless FileTest.directory?(sisupod_processing_path) -        FileUtils::mkdir_p(sisupod_processing_path) -      end -      (FileTest.file?(fns_pod)) \ -      ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") -      : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/) -      sisupod_processing_path -    end +  class InfoEnv < SiSU_Info_Env::InfoEnv                   # se_info_env.rb    end -  class InfoProcessingFlag -    attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 -    def initialize -      @rc=GetInit.new.sisu_yaml.rc -    end -    def color                                                                  #processing flag shortcuts -      (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false -    end -    def cf_0                                                                   #processing flag shortcuts -      if defined? @rc['flag']['default'] \ -      and @rc['flag']['default'].is_a?(String) -        @rc['flag']['default'] -      else                               '-NQhewpotbxXdyYv' -      end -    end -    def cf_1                                                                   #processing flag shortcuts -      if defined? @rc['flag']['i'] \ -      and @rc['flag']['i'].is_a?(String) -        @rc['flag']['i'] -      else                               '-Qhewpoty' -      end -    end -    def cf_2                                                                   #processing flag shortcuts -      if defined? @rc['flag']['ii'] \ -      and @rc['flag']['ii'].is_a?(String) -        @rc['flag']['ii'] -      else                               '-NQhewpotbxXdy' -      end -    end -    def cf_3                                                                   #processing flag shortcuts -      if defined? @rc['flag']['iii'] \ -      and @rc['flag']['iii'].is_a?(String) -        @rc['flag']['iii'] -      else                               '-NQhewpotbxXdyY' -      end -    end -    def cf_4                                                                   #processing flag shortcuts -      if defined? @rc['flag']['iv'] \ -      and @rc['flag']['iv'].is_a?(String) -        @rc['flag']['iv'] -      else                               '-NQhewpotbxXdDyY --update' -      end -    end -    def cf_5                                                                   #processing flag shortcuts -      if defined? @rc['flag']['v'] \ -      and @rc['flag']['v'].is_a?(String) -        @rc['flag']['v'] -      else                               '-NQhewpotbxXdDyYv --update' -      end -    end +  class InfoProcessingFlag < SiSU_Info_Processing_Flag::InfoProcessingFlag # se_processing.rb    end -  class InfoSettings < InfoEnv -    def permission?(prog)                                                      #program defaults -      (defined? @rc['permission_set'][prog]) \ -      ? @rc['permission_set'][prog] -      : false -    end -    def program?(prog)                                                         #program defaults -      (defined? @rc['program_set'][prog]) \ -      ? @rc['program_set'][prog] -      : false -    end +  class InfoSettings < SiSU_Info_Set::InfoSettings         # se_programs.rb    end -  class FileMap < InfoEnv -    attr_accessor :local_sisu_source -    def initialize(opt='') #watch / REVIEW -      super() -      @opt=opt #,opt.fns,opt.cmd -      @env=(@opt.fns && !(@opt.fns.empty?) \ -      ? (SiSU_Env::InfoEnv.new(@opt.fns)) -      : (SiSU_Env::InfoEnv.new('dummy.sst'))) -      ft=[] -      if @opt.act[:ao][:set]==:on -        @md=SiSU_Param::Parameters.new(@opt).get -        if @md \ -        and defined? @md.fn \ -        and @md.fn        # used for by_language_code? -          if @md.opt.act[:html][:set]==:on                 #% --html, -h -H -            ft << @md.fn[:html] -          end -          if @md.opt.act[:concordance][:set]==:on          #% --concordance, -w -            ft << @md.fn[:concordance] -          end -          if @md.opt.act[:manifest][:set]==:on             #% --manifest, -y -            ft << @md.fn[:manifest] -          end -          if @md.opt.act[:txt][:set]==:on                  #% --txt, -t -a -            ft << @md.fn[:plain] -          end -          if @md.opt.act[:txt_textile][:set]==:on          #% --textile -            ft << @md.fn[:txt_textile] -          end -          if @md.opt.act[:txt_asciidoc][:set]==:on         #% --asciidoc -            ft << @md.fn[:txt_asciidoc] -          end -          if @md.opt.act[:txt_markdown][:set]==:on         #% --markdown -            ft << @md.fn[:txt_markdown] -          end -          if @md.opt.act[:txt_rst][:set]==:on              #% --rst, --rest -            ft << @md.fn[:txt_rst] -          end -          if @md.opt.act[:xhtml][:set]==:on                #% --xhtml, -b xhtml -            ft << @md.fn[:xhtml] -          end -          if @md.opt.act[:epub][:set]==:on                 #% --epub, -e -            ft << @md.fn[:epub] -          end -          if @md.opt.act[:manpage][:set]==:on              #% --manpage, -i -            ft << @md.fn[:manpage] -          end -          if @md.opt.act[:hash_digests][:set]==:on         #% --hash-digests, -N digest tree -            ft << @md.fn[:digest] -          end -          if @md.opt.act[:odt][:set]==:on                  #% --odt, -o opendocument -            ft << @md.fn[:odf] -          end -          if @md.opt.act[:pdf][:set]==:on                  #% --pdf-l --pdf, -p latex/ texpdf -            ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] -          end -          if @md.opt.act[:share_source][:set]==:on -            ft << @md.fns -          end -          if @md.opt.act[:sisupod][:set]==:on              #% --sisupod, -S make sisupod -            ft << @md.fn[:sisupod] -          end -          if @md.opt.act[:xml_sax][:set]==:on              #% --xml-sax, -x xml sax type -            ft << @md.fn[:sax] -          end -          if @md.opt.act[:xml_dom][:set]==:on              #% --xml-dom, -X xml dom type -            ft << @md.fn[:dom] -          end -          if @md.opt.act[:xml_docbook_book][:set]==:on     #% --xml-docbook-book -            ft << @md.fn[:xml_docbook_book] -          end -          if @md.opt.act[:xml_fictionbook][:set]==:on      #% --xml-fictionbook -            ft << @md.fn[:xml_fictionbook] -          end -          if @md.opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu -            ft << @md.fn[:xml_scaffold_structure_sisu] -          end -          if @md.opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse -            ft << @md.fn[:xml_scaffold_structure_collapse] -          end -          @fnb=@md.fnb -        else                                                                     # still needed where/when param is not parsed -          if @opt.act[:html][:set]==:on                    #% --html, -h -H -            ft << '.html' << '.html.??' -          end -          if @opt.act[:concordance][:set]==:on             #% --concordance, -w -            ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' -          end -          if @opt.act[:manifest][:set]==:on                #% --manifest, -y -            ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' -          end -          if @opt.act[:txt][:set]==:on                     #% --txt, -t -a -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_textile][:set]==:on             #% --textile -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_asciidoc][:set]==:on            #% --asciidoc -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_markdown][:set]==:on            #% --markdown -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:txt_rst][:set]==:on                 #% --rst, --rest -            ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' -          end -          if @opt.act[:xhtml][:set]==:on                   #% --xhtml, -b xhtml -            ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' -          end -          if @opt.act[:epub][:set]==:on                    #% --epub, -e -            ft  << @fnb << '.epub' -          end -          if @opt.act[:manpage][:set]==:on                 #% --manpage, -i -            ft << '.1' << '??.man.1' << 'man.??.1' -          end -          if @opt.act[:hash_digests][:set]==:on            #% --hash-digests, -N digest tree -            ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' -          end -          if @opt.act[:odt][:set]==:on                     #% --odt, -o opendocument -            ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' -          end -          if @opt.act[:pdf][:set]==:on                     #% --pdf-l --pdf, -p latex/ texpdf -            ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' -          end -          if @opt.act[:share_source][:set]==:on -            ft << '.sst' << '.ssi' << '.ssm' -          end -          if @opt.act[:sisupod][:set]==:on                 #% --sisupod, -S make sisupod -            ft << '.zip' -          end -          if @opt.act[:xml_sax][:set]==:on                 #% --xml-sax, -x xml sax type -            ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' -          end -          if @opt.act[:xml_dom][:set]==:on                 #% --xml-dom, -X xml dom type -            ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' -          end -          if @opt.act[:xml_docbook_book][:set]==:on        #% --xml-docbook-book -            ft << 'docbook.xml' << '??.docbook.xml' << 'docbook.??.xml' -          end -          if @opt.act[:xml_fictionbook][:set]==:on         #% --xml-fictionbook -            ft << 'fictionbook.xml' << '??.fictionbook.xml' << 'fictionbook.??.xml' -          end -          if @opt.act[:xml_scaffold_structure_sisu][:set]==:on          #% --xml-scaffold --xml-scaffold-sisu -            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' -          end -          if @opt.act[:xml_scaffold_structure_collapse][:set]==:on      #% --xml-scaffold-collapse -            ft << 'scaffold.xml' << '??.scaffold.xml' << 'scaffold.??.xml' -          end -        end -        ft=ft.uniq -        filetypes=ft.join(',') -        @filetypes=if filetypes !~/..+/;             ''   # -r called alone, copy all -        elsif @opt.cmd =~/u/;                        ''   # -u added, copy all, (used to create remote directory tree see output path), not the usual function of -u -        elsif filetypes =~/\S+?,\S+/;                '*{' + filetypes + '}' # more than one relevant file type -        else                                         '*' + filetypes # one relevant file type -        end -        @source_path=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/#{@fnb}" -        : @env.path.output) -        @source_path_epub=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/epub" -        : @env.path.output_epub) -        @source_path_src=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/src" -        : @env.path.output_src) -        @source_path_pod=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/pod" -        : @env.path.output_pod) -        @source_path_harvest=(@fnb && !(@fnb.empty?) \ -        ? "#{@env.path.output}/manifest" -        : @env.path.output_harvest) -        @local_sisu_source=(@filetypes =~/\S/) \ -        ? "#{@source_path}/#{@filetypes}" -        : @source_path -      end -      if @opt.act[:rsync][:set]==:on -      end -    end +  class FileMap < SiSU_File_Map::FileMap                   # se_filemap.rb    end -  class CleanOutput -    begin -      require 'fileutils' -        include FileUtils::Verbose -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)') -    end -    def initialize(opt) -      @opt=opt -      z=SiSU_Env::FileMap.new(opt) -      zap=z.local_sisu_source -      if opt.cmd =~ /h/i -        zap=Dir.glob(zap).join(' ') -        @zap=if opt.cmd !~ /w/ -          zap.gsub(/#{@source_path}\/concordance.html/,'') -        else zap -        end -      end -      @env=SiSU_Env::InfoEnv.new -    end -    def zap -      def deletion(fn) -        if FileTest.file?(fn)==true -          File.delete(fn) -          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove: ' + fn) -          tell.warn unless @opt.cmd =~/q/ -        end -      end -      def remove_output -        if @opt.act[:maintenance][:set] == :on -          m=InfoFile.new(@opt.fnc) -          tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns, 'remove maintenance files from: ' + @env.processing_path.ao) -          tell.warn unless @opt.cmd =~/q/ -          deletion(m.marshal.ao_content) -          deletion(m.marshal.ao_idx_sst_rel_html_seg) -          deletion(m.ao_idx_sst_rel) -          deletion(m.ao_idx_html) -          deletion(m.ao_idx_xhtml) -          deletion(m.ao_metadata) -          deletion(m.ao_map_nametags) -          deletion(m.ao_map_ocn_htmlseg) -          deletion(m.html_tune) -        end -        md=SiSU_Param::Parameters.new(@opt).get -        f=SiSU_Env::FileOp.new(md) -        deletion(f.place_file.html_segtoc.dir) -        deletion(f.place_file.html_scroll.dir) -        deletion(f.place_file.html_book_index.dir) -        deletion(f.place_file.html_concordance.dir) -        deletion(f.place_file.epub.dir) -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_letter}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_letter}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a4}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a4}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_a5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_a5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_b5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_l_b5}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") -        deletion("#{f.output_path.pdf.dir}/#{f.base_filename.pdf_p_legal}") -        deletion(f.place_file.odt.dir) -        deletion(f.place_file.xhtml.dir) -        deletion(f.place_file.xml_sax.dir) -        deletion(f.place_file.xml_dom.dir) -        deletion(f.place_file.xml_scaffold_structure_sisu.dir) -        deletion(f.place_file.xml_scaffold_structure_collapse.dir) -        deletion(f.place_file.info.dir) -        deletion(f.place_file.manpage.dir) -        deletion(f.place_file.sqlite_discrete.dir) -        deletion(f.place_file.txt.dir) -        deletion(f.place_file.hash_digest.dir) -        deletion(f.place_file.manifest.dir) -        deletion(f.place_file.qrcode_md.dir) -        deletion(f.place_file.qrcode_title.dir) -        deletion(f.place_file.src.dir) -        deletion(f.place_file.sisupod.dir) -      end -      self -    end +  class CleanOutput < SiSU_Clean_Output::CleanOutput       # se_cleanoutput.rb    end -  class InfoRemoteHost -    def initialize -      @rc=GetInit.new.sisu_yaml.rc -    end -    def remote_host #see InfoRemote remote_host_base_general -      r=[] -      r=if (defined? @rc['remote'] \ -      and @rc['remote'].is_a?(Array)) -        r_array=@rc['remote'] -        r_array.each_with_index do |renv,i| -          r[i]={} -          if defined? renv['user'] \ -          and defined? renv['host'] -          end -          r[i][:user]=renv['user'] -          r[i][:host]=renv['host'] -          r[i][:path]=if defined? renv['path'] -            renv['path'] -          else '' -          end -          r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" -        end -        r -      elsif (defined? @rc['remote'] \ -      and @rc['remote'].is_a?(Hash) \ -      and defined? @rc['remote']['user'] \ -      and defined? @rc['remote']['host']) -        r[0]={} -        r[0][:user]=@rc['remote']['user'] -        r[0][:host]=@rc['remote']['host'] -        r[0][:path]=if defined? @rc['remote']['path'] -          @rc['remote']['path'] -        else '' -        end -        r[0][:name]="#{r[0][:user]}@#{r[0][:host]}:#{r[0][:path]}" -        r -      else -        r[0]={} -        r[0][:name]='.' -        r[0][:user]='' -        r[0][:host]='' -        r[0][:path]='' -        #puts "no remote host or user" -        r -      end -    end -    def rhost -      def r1 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) -        : nil -      end -      def r2 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) -        : nil -      end -      def r3 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) -        : nil -      end -      def r4 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) -        : nil -      end -      def r5 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \ -        ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) -        : nil -      end -      def r6 -        (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \ -        ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) -         : nil -      end -      self -    end +  class InfoRemoteHost < SiSU_Info_Remote_Host::InfoRemoteHost # se_remotes.rb    end -  class InfoRemote < FileMap -    @@flag_remote=false -    begin -      require 'socket' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('socket NOT FOUND (LoadError)') -    end -    def initialize(opt) -      super(opt) # -      @opt=opt -      @rc=GetInit.new.sisu_yaml.rc -    end -    def remote_host_base_general -      SiSU_Env::InfoRemoteHost.new.remote_host -    end -    def remote_host_base -      remote_host_base_general.each do |remote_conn| -        @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ -      end -      remote_host_base_general -    end -    def scp                                                                    #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built -      def document -        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.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 -          local_pod=@source_path_pod -          remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." -          remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." -          remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." -          src_txt=@opt.fnc -          src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') -          if (local_gen =~/\S/ \ -          and local_gen !~/\/\//) \ -          and (remote_gen =~/\S/ \ -          and remote_gen !~/\/\//) \ -          and @@flag_remote==true \ -          and @opt.cmd !~/U/ -            SiSU_Env::SystemCall.new(local_gen,remote_gen).scp -            if FileTest.file?("#{local_src}/#{src_txt}") -              SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp -            end -            if FileTest.file?("#{local_pod}/#{src_pod}") -              SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp -            end -            if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") -              SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp -            end -          elsif  @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "#{local_gen} -> #{remote_gen}" -            if FileTest.file?("#{local_src}/#{src_doc}") -              puts "#{local_src}/#{src_doc}* -> #{remote_src}" -            end -            if FileTest.file?("#{local_pod}/#{src_doc}.txz") -              puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" -            end -          else -            puts 'suspect scp request, ignored' -            puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" -            puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base                                                               #base site -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            puts "begin scp_base: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "begin scp_base: #{local} -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base_all                                                           #base site -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            puts "begin scp_base_all: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp -            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "scp_base_all: #{local} -> #{remote}" -            puts "#{local}/_sisu/image_sys/ -> #{remote}" -            puts "#{local}/_sisu/image/ -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      self -    end -    def rsync -      def document -        f=(@opt.act[:ao][:set]==:on) \ -        ? SiSU_Env::FileOp.new(@md) -        : nil -        if f -          self.remote_host_base.each do |remote_conn| -            local_gen=@source_path -            #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/ \ -            and local_gen !~/\/\//) \ -            and (remote_gen =~/\S/ \ -            and remote_gen !~/\/\//) \ -            and @@flag_remote==true \ -            and @opt.cmd !~/U/ -#             SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync -              #delete_extra_files='--delete' # '--delete-after' -              inp=[] -              if (@opt.act[:html][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.html_scroll.dir) -                inp << f.output_path.html_seg.rel << f.place_file.html_scroll.rel -              end -              if (@opt.act[:concordance][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.html_concordance.dir) -                inp << f.place_file.html_concordance.rel -              end -              if (@opt.act[:epub][:set]==:on \ -              || @opt.cmd =~/^-R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.epub.dir) -                inp << f.place_file.epub.rel -              end -              if (@opt.act[:odt][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.odt.dir) -                inp << f.place_file.odt.rel -              end -              if (@opt.act[:xhtml][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xhtml.dir) -                inp << f.place_file.xhtml.rel -              end -              if (@opt.act[:xml_sax][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_sax.dir) -                inp << f.place_file.xml_sax.rel -              end -              if (@opt.act[:xml_dom][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_dom.dir) -                inp << f.place_file.xml_dom.rel -              end -              if (@opt.act[:xml_scaffold_structure_sisu][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_scaffold_structure_sisu.dir) -                inp << f.place_file.xml_scaffold_structure_sisu.rel -              end -              if (@opt.act[:xml_scaffold_structure_collapse][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.xml_scaffold_structure_collapse.dir) -                inp << f.place_file.xml_scaffold_structure_collapse.rel -              end -              if (@opt.act[:txt][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.txt.dir) -                inp << f.place_file.txt.rel -              end -              if (@opt.act[:manpage][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.manpage.dir) -                inp << f.place_file.manpage.rel -              end -              if (@opt.act[:texinfo][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.info.dir) -                inp << f.place_file.info.rel -              end -              if (@opt.act[:hash_digests][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.hash_digest.dir) -                inp << f.place_file.hash_digest.rel -              end -              if (@opt.act[:share_source][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.src.dir) -                inp << f.place_file.src.rel -              end -              if (@opt.act[:sisupod][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.sisupod.dir) -                inp << f.place_file.sisupod.rel -              end -              if (@opt.act[:pdf][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) -                inp <<=(@opt.dir_structure_by == :filename) \ -                ? (f.output_path.pdf.rel + '/*.pdf') -                : (f.output_path.pdf.rel + '/' + @opt.fnb + '*.pdf') -              end -              if (@opt.act[:sqlite_discrete][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.sqlite_discrete.dir) -                inp << f.place_file.sqlite_discrete.rel -              end -              if (@opt.act[:qrcode][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.qrcode_md.dir) -                inp << f.place_file.qrcode_md.rel << f.place_file.qrcode_title.rel -              end -              if (@opt.act[:manifest][:set]==:on \ -              || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ -              && FileTest.file?(f.place_file.manifest.dir) -                inp << f.place_file.manifest.rel -              end -              local_gen=if inp.length > 0 -                inp.join(' ') -              else '' -              end -              local_css,images,images_system='','','' -              images=images_skin=images_system=local_css='' -              if @opt.cmd =~/[hwbxX]/ \ -              && (defined? @md.ec[:image]) \ -              && (@md.ec[:image].length > 0) -                images=f.place_file.images.rel + '/' + @md.ec[:image].join(" #{f.output_path.images.rel}/") -              end -              if @opt.cmd =~/[yhwbxX]/ \ -              && (defined? @md.ec[:image]) \ -              && (@md.ec[:image].length > 0) -                local_css=f.output_path.css.rel -                images_system='_sisu/image_sys' -              end -              begin -                ##create file structure without copying files?: -                ##rsync -av -f"+ */" -f"- *" f.output_path.base.dir remote:./path/. -                #local_dirs=%{-f"+ */" -f"- *" #{f.output_path.base.dir}/*} -                #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync -                local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css -                SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',f.output_path.base.dir) -              rescue -                p __LINE__.to_s + ':' + __FILE__ -                local_dirs=%{--include='*/' --exclude='*' #{f.output_path.base.dir}} -                SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync -              end -            elsif @opt.cmd =~/U/ -              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -              puts "#{local_gen} -> #{remote_gen}" -              if FileTest.file?("#{local_src}/#{src_doc}") \ -              or FileTest.file?("#{local_src}/#{src_doc}.txz") -                puts "#{local_src}/#{src_doc}* -> #{remote_src}" -              end -            else -              puts 'suspect rsync request, ignored' -              puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" -              puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            end -          end -        end -      end -      def site_harvest -        self.remote_host_base.each do |remote_conn| -          local=@source_path_harvest -          l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" -          lng='en' -          if @env.output_dir_structure.by? == :language -            ldest="#{lng}/manifest" -            files="#{ldest}/authors.html #{ldest}/topics.html" -          elsif @env.output_dir_structure.by? == :filetype -            ldest="manifest" -            files="#{ldest}/authors.#{lng}.html #{ldest}/topics.#{lng}.html" -          elsif @env.output_dir_structure.by? == :filename -            files="#{l_rel}/authors.#{lng}.html #{l_rel}/topics.#{lng}.html" -          end -          remote="#{remote_conn[:name]}/#{@opt.base_stub}" -          if @opt.act[:harvest][:set] \ -          && @opt.act[:rsync][:set] -            (@env.output_dir_structure.by? == :filename) \ -            ? (SiSU_Env::SystemCall.new(files,remote).rsync) -            : (SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel)) -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "rsync_harvest: #{local} -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      def site_base                                                             #base site -        ldest='_sisu/*' -        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.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) -        end -      end -      def site_base_sync -        self.remote_host_base.each do |remote_conn| -          local=@source_path -          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 \ -          and @opt.cmd !~/U/ -            delete_extra_files='--delete' # '--delete-after' -            puts "begin rsync_base_sync: #{local} -> #{remote}" -            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) -            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) -            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) -          elsif @opt.cmd =~/U/ -            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -            puts "rsync_base_sync: #{local} -> #{remote}" -            puts "#{local}/_sisu/image_sys/ -> #{remote}" -            puts "#{local}/_sisu/image/ -> #{remote}" -            puts "#{local}/#{@env.path.style}/ -> #{remote}" -          else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          end -        end -      end -      self -    end -    def rsync_sitemaps                                                         #sitemap directory -      self.remote_host_base.each do |remote_conn| -        local="#{@source_path}/sitemapindex.xml" -        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) -        elsif @opt.cmd =~/U/ -          puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -          puts "rsync_sitemaps: #{local} -> #{remote}" -        else  puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ -        end -      end -    end +  class InfoRemote < SiSU_Info_Remote::InfoRemote          # se_remotes.rb    end -  class InfoVersion <InfoEnv -    include Singleton -    begin -      require 'rbconfig' -      require 'yaml' -    rescue LoadError -      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig or yaml NOT FOUND (LoadError)') -    end -    @@lib_path=nil -    def get_version -      @version={} -      @pwd=ENV['PWD'] -      lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') -      @@lib_path ||=lib_path -      if File.exist?(SiSU_is[:version_info_path]) -        @version=YAML::load(File::open(SiSU_is[:version_info_path])) #unless @@noyaml -      end -      @version[:install_method]=if SiSU_is[:run_from]==:gem_install -        spec = Gem::Specification.find_by_name("sisu") -        gem_root = spec.gem_dir -        (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ -        ? ' (ruby gem install)' : '' -      else '' -      end -      @version -    end -    def rbversion -      %x{ruby -v}.strip -    end +  class InfoVersion < SiSU_Info_Version::InfoVersion       # se_version.rb    end -  class InfoAbout -    def initialize(color='') -      @color=color -    end -    def sisu_version -      version=SiSU_Env::InfoVersion.instance.get_version -      rb_ver=SiSU_Env::InfoVersion.instance.rbversion -      if version[:version] -        opt_cmd=if defined? @color.cmd \ -        and @color.cmd =~/[ck]/ -          @color.cmd -        else '-v' -        end -        SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version -      else puts 'SiSU (version information not available)' -      end -    end -    def sisu_about -      puts <<-WOK -     sisu: documents; markup, structuring, publishing in multiple standard formats, & search -     most (not all) useful commands (are made in a directory containing a sisu markup file &) take the form: -       sisu [action(s)] [filename(s)] -     where filename refers to a valid sisu marked up file, e.g.: -       cd /usr/share/doc/sisu/markup-samples/sisu_manual -       sisu --html --verbose sisu_commands.sst -       sisu --txt --html --epub --odt --pdf --sqlite --manpage --texinfo --concordance --qrcode --verbose sisu.ssm -       cd - -     See output produced, or see man pages: man sisu -     <http://www.sisudoc.org/> <http://www.jus.uio.no/sisu/> -        WOK -    end +  class InfoAbout < SiSU_Info_About::InfoAbout             # se_version.rb    end -  class InfoFile <InfoEnv                                                  #todo unify with FileOp -    def initialize(fns) -      begin -        super(fns) -        @fns=fns -        @env=SiSU_Env::InfoEnv.new(@fns) -        m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss -        @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] -      rescue -        SiSU_Screen::Ansi.new('',$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def basefilename #Remove if possible -      m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m -      @fns[m,1] -    end -    def make_file(path,filename) -      (File.writable?("#{path}/.")) \ -      ? File.new("#{path}/#{filename}",'w+') -      : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn) -    end -    def touch_file(path,filename) -      if File.writable?("#{path}/."); -        FileUtils::touch("#{path}/#{filename}") -      else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn -      end -    end -    def make_path(path) -      FileUtils::mkdir_p(path) unless FileTest.directory?(path) -    end -    def marshal -      def ao_content -        "#{@env.processing_path.ao}/#{@fns}.content.rbm" -      end -      def ao_idx_sst_rel_html_seg -        "#{@env.processing_path.ao}/#{@fns}.idx_sst.rbm" -      end -      def ao_idx_sst_rel #used by tex & odf -        "#{@env.processing_path.ao}/#{@fns}.idx_raw.rbm" -      end -      def ao_idx_html -        "#{@env.processing_path.ao}/#{@fns}.idx_html.rbm" -      end -      def ao_idx_xhtml -        "#{@env.processing_path.ao}/#{@fns}.idx_xhtml.rbm" -      end -      def ao_metadata -        "#{@env.processing_path.ao}/#{@fns}.metadata.rbm" -      end -      def ao_map_nametags -        "#{@env.processing_path.ao}/#{@fns}.map_name_tags.rbm" -      end -      def ao_map_ocn_htmlseg -        "#{@env.processing_path.ao}/#{@fns}.map_ocn_htmlseg.rbm" -      end -      def html_tune -        "#{@env.processing_path.tune}/#{@fns}.marshal_tune" -      end -      self -    end -    def write_file_processing -      def html_tune -        File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+') -      end -      self -    end -    def mkdir #check moved from FileOp, existing mkdir -      def processing -        def ao -          FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) -        end -        def tune -          FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) -        end -        self -      end -    end +  class InfoFile < SiSU_Info_File::InfoFile                # se_file_op.rb    end -  class ProcessingSettings -    def initialize(md) -      @md=md -    end -    def cnf_rc #sisurc.yml -      @rc=SiSU_Env::GetInit.new.sisu_yaml.rc -    end -    def env_rc #env rc (including sisurc.yml) -      @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) -    end -    def doc_rc #document rc, make instructions -      (defined? @md.make) \ -      ? @md.make -      : nil -    end -    def cmd_rc_act #command-line rc -      @cmd_rc_act=@md.opt.opt_act -    end -    def build -      def ocn? -        if cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def plaintext_ocn? -        if cmd_rc_act[:txt_ocn][:set]==:on \ -        or cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:txt_ocn][:set]==:off \ -        or cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def odt_ocn? -        if cmd_rc_act[:odt_ocn][:set]==:on \ -        or cmd_rc_act[:ocn][:set]==:on -          true -        elsif cmd_rc_act[:odt_ocn][:set]==:off \ -        or cmd_rc_act[:ocn][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.ocn? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.ocn? ==:off -          false -        else -          true -        end -      end -      def html_strict? -        if cmd_rc_act[:html_strict][:set]==:on -          true -        elsif cmd_rc_act[:html_strict][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_strict? \ -        and doc_rc.html_strict? ==:on -          true -        else -          false -        end -      end -      def toc? -        if cmd_rc_act[:toc][:set]==:on -          true -        elsif cmd_rc_act[:toc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.toc? \ -        and doc_rc.toc? ==:off -          false -        elsif env_rc.build.toc? ==:off -          false -        else -          true -        end -      end -      def manifest? -        if cmd_rc_act[:manifest][:set]==:on -          true -        elsif cmd_rc_act[:manifest][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.manifest? \ -        and doc_rc.manifest? ==:off -          false -        elsif env_rc.build.manifest? ==:off -          false -        else -          true -        end -      end -      def links_to_manifest? -        if cmd_rc_act[:links_to_manifest][:set]==:on -          true -        elsif cmd_rc_act[:links_to_manifest][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.links_to_manifest? \ -        and doc_rc.links_to_manifest? ==:off -          false -        elsif env_rc.build.links_to_manifest? ==:off -          false -        else -          true -        end -      end -      def metadata? -        if cmd_rc_act[:metadata][:set]==:on -          true -        elsif cmd_rc_act[:metadata][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.metadata? \ -        and doc_rc.metadata? ==:off -          false -        elsif env_rc.build.metadata? ==:off -          false -        else -          true -        end -      end -      def minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.minitoc? \ -        and doc_rc.minitoc? ==:off -          false -        elsif env_rc.build.minitoc? ==:off -          false -        else -          true -        end -      end -      def manifest_minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:manifest_minitoc][:set]==:on \ -        || cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ -        || cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.manifest_minitoc? \ -        and (doc_rc.manifest_minitoc? ==:off \ -        || doc_rc.minitoc? ==:off) -          false -        elsif env_rc.build.manifest_minitoc? ==:off \ -        || env_rc.build.minitoc? ==:off -          false -        elsif minitoc? == false -          false -        else -          true -        end -      end -      def html_minitoc? -        if html_top_band? == false #one form of navigation necessary -          true -        elsif cmd_rc_act[:html_minitoc][:set]==:on \ -        || cmd_rc_act[:minitoc][:set]==:on -          true -        elsif cmd_rc_act[:html_minitoc][:set]==:off \ -        || cmd_rc_act[:minitoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_minitoc? \ -        and (doc_rc.html_minitoc? ==:off \ -        || doc_rc.minitoc? ==:off) -          false -        elsif env_rc.build.html_minitoc? ==:off \ -        || env_rc.build.minitoc? ==:off -          false -        elsif minitoc? == false -          false -        else -          true -        end -      end -      def html_top_band? -        if cmd_rc_act[:html_top_band][:set]==:on -          true -        elsif cmd_rc_act[:html_top_band][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_top_band? \ -        and doc_rc.html_top_band? ==:off -          false -        elsif env_rc.build.html_top_band? ==:off -          false -        else -          true -        end -      end -      def html_navigation? -        if cmd_rc_act[:html_navigation][:set]==:on -          true -        elsif cmd_rc_act[:html_navigation][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_navigation? \ -        and doc_rc.html_navigation? ==:off -          false -        elsif env_rc.build.html_navigation? ==:off -          false -        else -          true -        end -      end -      def html_navigation_bar? -        if cmd_rc_act[:html_navigation_bar][:set]==:on -          true -        elsif cmd_rc_act[:html_navigation_bar][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_navigation_bar? \ -        and doc_rc.html_navigation_bar? ==:off -          false -        elsif env_rc.build.html_navigation_bar? ==:off -          false -        else -          true -        end -      end -      def search_form? -        if cmd_rc_act[:search_form][:set]==:on -          true -        elsif cmd_rc_act[:search_form][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_search_form? \ -        and doc_rc.search_form? ==:off -          false -        elsif env_rc.build.search_form? ==:off -          false -        else -          true -        end -      end -      def html_search_form? -        if cmd_rc_act[:html_search_form][:set]==:on \ -        || cmd_rc_act[:search_form][:set]==:on -          true -        elsif cmd_rc_act[:html_search_form][:set]==:off \ -        || cmd_rc_act[:search_form][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_search_form? \ -        and (doc_rc.html_search_form? ==:off \ -        || doc_rc.search_form? ==:off) -          false -        elsif env_rc.build.html_search_form? ==:off \ -        || env_rc.build.search_form? ==:off -          false -        elsif search_form? == false -          false -        else -          true -        end -      end -      def html_right_pane? -        if cmd_rc_act[:html_right_pane][:set]==:on -          true -        elsif cmd_rc_act[:html_right_pane][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.html_right_pane? \ -        and doc_rc.html_right_pane? ==:off -          false -        elsif env_rc.build.html_right_pane? ==:off -          false -        else -          true -        end -      end -      def segsubtoc? -        if cmd_rc_act[:segsubtoc][:set]==:on -          true -        elsif cmd_rc_act[:segsubtoc][:set]==:off -          false -        elsif doc_rc.is_a?(Method) \ -        and defined? doc_rc.segsubtoc? \ -        and doc_rc.segsubtoc? ==:off -          false -        elsif env_rc.build.segsubtoc? ==:off -          false -        else -          true -        end -      end -      self -    end -    def ocn_html_identifier -      (build.html_strict?) \ -      ? Mx[:ocn_id_char] -      : '' -    end -    def output_dir_structure -      def by_language_code? -        if cmd_rc_act[:output_by][:set] == :language -          true -        elsif cmd_rc_act[:output_by][:set] == :filetype \ -        or cmd_rc_act[:output_by][:set] == :filename -          false -        elsif cmd_rc_act[:output_by][:set] == :language -          true -        else -          env_rc.output_dir_structure.by_language_code? -        end -      end -      def by_filetype? -        if cmd_rc_act[:output_by][:set] == :filetype -          true -        elsif cmd_rc_act[:output_by][:set] == :language \ -        or cmd_rc_act[:output_by][:set] == :filename -          false -        elsif cmd_rc_act[:output_by][:set] == :filetype -          true -        else -          env_rc.output_dir_structure.by_filetype? -        end -      end -      def by_filename? -        if cmd_rc_act[:output_by][:set] == :filename -          true -        elsif cmd_rc_act[:output_by][:set] == :language \ -        or cmd_rc_act[:output_by][:set] == :filetype -          false -        elsif cmd_rc_act[:output_by][:set] == :filename -          true -        else -          env_rc.output_dir_structure.by_filename? -        end -      end -      def multilingual? -        by_language_code? -      end -      def dump? -        ((cmd_rc_act[:dump][:bool] \ -        &&  cmd_rc_act[:dump][:inst]) \ -        || (env_rc.output_dir_structure.dump?)) \ -        ? true -        : false -      end -      def redirect? -        ((cmd_rc_act[:redirect][:bool] \ -        &&  cmd_rc_act[:redirect][:inst]) \ -        || (env_rc.output_dir_structure.redirect?)) \ -        ? true -        : false -      end -      def dump_or_redirect? -        ((dump?) || (redirect?)) \ -        ? true -        : false -      end -      def by? -        if dump? -          :dump -        elsif redirect? -          :redirect -        elsif by_language_code? -          :language -        elsif by_filetype? -          :filetype -        elsif by_filename? -          :filename -        else #recheck current default -          :language -        end -      end -      self -    end +  class ProcessingSettings < SiSU_Processing_Settings::ProcessingSettings # se_processing.rb    end -  class InfoDb < InfoEnv -    @@rc=nil -    def initialize -      @@pwd=@pwd=SiSU_Utils::Path.new.base_markup -      @env=SiSU_Env::InfoEnv.new -      pt=Pathname.new(@pwd) -      r=Px[:lng_lst_rgx] -      u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ -      @pwd_stub=pt.realpath.to_s[u,1] -      @rc=@@rc ||=GetInit.new.sisu_yaml.rc -      @defaults=SiSU_Env::InfoEnv.new.defaults -    end -    def share_source? -      ((defined? @rc['db']['share_source']) \ -      && @rc['db']['share_source']==true) \ -      ? @rc['db']['share_source'] -      : false -    end -    def engine -      def default -        ((defined? @rc['db']['engine']['default']) \ -        && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ -        ? @rc['db']['engine']['default'] -        : 'sqlite' -      end -      self -    end -    def psql -      def user(opt=nil) -        if opt \ -        and opt.mod.inspect =~/--db-user[=-]["']?(\S+)["']+/ -          $1 -        elsif opt \ -        and opt.mod =~/--webserv[=-]webrick/ -          @env.user -        else -          ((defined? @rc['db']['postgresql']['user']) \ -          && @rc['db']['postgresql']['user']=~/\S+/) \ -          ? @rc['db']['postgresql']['user'] -          : @env.user -        end -      end -      def db #db_name -        "#{Db[:name_prefix]}#{@pwd_stub}" -      end -      def port #PGPORT -        ((defined? @rc['db']['postgresql']['port']) \ -        && ( @rc['db']['postgresql']['port'] =~/\d+/ \ -        || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \ -        ? @rc['db']['postgresql']['port'] -        : (@defaults[:postgresql_port]) -      end -      def password -        ((defined? @rc['db']['postgresql']['password']) \ -        && @rc['db']['postgresql']['password']=~/\S+/) \ -        ? @rc['db']['postgresql']['password'] -        : '' -      end -      def host -        ((defined? @rc['db']['postgresql']['host']) \ -        && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ -        ? @rc['db']['postgresql']['host'] -        : '' -      end -      def dbi -        PG::Connection.open(:dbname =>  psql.db) -      end -      def dbi_ -        (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ -        ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" -        : "DBI:Pg:database=#{psql.db};port=#{psql.port}" -      end -      def conn_dbi -        DBI.connect(psql.dbi,psql.user,psql.db) -      end -      def conn_pg -        require 'pg' -        PG::Connection.new(dbname: psql.db, port: psql.port) -      end -     self -    end -    def sqlite -      def db -        "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" -      end -      def db_discrete(md) -        # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" -      end -      def dbi -        "DBI:SQLite3:#{sqlite.db}" #sqlite3 ? -      end -      def sqlite3 -        sqlite.db #sqlite3 ? -      end -      def conn_dbi -        DBI.connect(sqlite.dbi) -      end -      def conn_sqlite3 -        SQLite3::Database.new(sqlite.sqlite3) -      end -      self -    end +  class InfoDb < SiSU_Info_Db::InfoDb                      # se_db.rb    end -  class DbOp <InfoDb -    def initialize(md) -      begin -        @md=md -      rescue -        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def sqlite_discrete -      def db -        "#{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}" -      end -      def dbi -        "DBI:SQLite3:#{sqlite_discrete.db}" -      end -      def sqlite3 -        sqlite_discrete.db -      end -      def conn_dbi -        DBI.connect(sqlite_discrete.dbi) -      end -      def conn_sqlite3 -        begin -          $sqlite3=:yes -          require 'sqlite3' -          SQLite3::Database.new(sqlite_discrete.sqlite3) -        rescue LoadError -          $sqlite3=:no -          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)') -        end -      end -      self -    end +  class DbOp < SiSU_Db_Op::DbOp                            # se_db.rb    end -  class FileOp <InfoFile                                                    #todo unify with CreateFile -    def initialize(md,fno='') -      begin -        @md,@fno=md,fno -        @env=SiSU_Env::InfoEnv.new(@md.fns) -      rescue -        SiSU_Screen::Ansi.new(md.opt.cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def output_dir_structure -      ProcessingSettings.new(@md).output_dir_structure -    end -    def mkdir_initialize                                                       # not used but consider using -      FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) -      FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}") -      FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") -      FileUtils::mkdir_p(@env.processing_path.ao) unless FileTest.directory?(@env.processing_path.ao) -      FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune) -    end -    def path_rel_links -      def html_scroll_2 -        if output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_seg_2 -        if output_dir_structure.by_language_code? -          '../../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def html_scroll_1 -        if output_dir_structure.by_language_code? -          '../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          './' -        end -      end -      def html_seg_1 -        if output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          './' -        end -      end -      def default_output_css -        if (@md.opt.opt_act[:dump][:bool] \ -        &&  @md.opt.opt_act[:dump][:inst]) \ -        || (@md.opt.opt_act[:redirect][:bool] \ -        &&  @md.opt.opt_act[:redirect][:inst]) -          './' -        elsif output_dir_structure.by_language_code? -          '../../' -        elsif output_dir_structure.by_filetype? -          '../' -        else -          '../' -        end -      end -      def html_scroll_css -        default_output_css -      end -      def xhtml_css -        default_output_css -      end -      def xml_css -        default_output_css -      end -      def html_seg_css -        if output_dir_structure.by_language_code? -          '../../../' -        elsif output_dir_structure.by_filetype? -          '../../' -        else -          '../' -        end -      end -      def manifest_css -        if output_dir_structure.by_language_code? -          '../../_sisu/css' -        elsif output_dir_structure.by_filetype? -          '' -        else -          '../' -        end -      end -      self -    end -    def mkdir -      def output -        def base -          FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) -        end -        def css -          FileUtils::mkdir_p("#{output_path.base.dir}/#{@env.path.style}") unless FileTest.directory?("#{output_path.base.dir}/#{@env.path.style}") -        end -        def epub -          path=output_path.epub.dir -          make_path(path) -        end -        self -      end -      self -    end -    def mkfile #consider using more -      path="#{output_path.base.dir}/#{@md.fnb}" -      make_path(path) -      filename=@fno -      make_file(path,filename) -    end -    def mkfile_pwd -      path=Dir.pwd -      filename=@fno -      make_file(path,filename) -    end -    def write_file -      def txt -        path=output_path.txt.dir -        make_path(path) -        fn=base_filename.txt -        make_file(path,fn) -      end -      def textile -        path=output_path.textile.dir -        make_path(path) -        fn=base_filename.textile -        make_file(path,fn) -      end -      def asciidoc -        path=output_path.asciidoc.dir -        make_path(path) -        fn=base_filename.asciidoc -        make_file(path,fn) -      end -      def markdown -        path=output_path.markdown.dir -        make_path(path) -        fn=base_filename.markdown -        make_file(path,fn) -      end -      def rst -        path=output_path.rst.dir -        make_path(path) -        fn=base_filename.rst -        make_file(path,fn) -      end -      def html_scroll -        pth=output_path.html.dir -        make_path(pth) -        p_fn=place_file.html_scroll.dir -        @@filename_html_scroll=File.new(p_fn,'w+') -      end -      def html_seg_index -        pth=((output_dir_structure.by_filename?) \ -          || (output_dir_structure.dump?)) \ -        ? "#{output_path.html.dir}" -        : "#{output_path.html.dir}/#{@md.fnb}" -        make_path(pth) -        p_fn=place_file.html_seg_index.dir -        @@filename_html_index=File.new(p_fn,'w+') -      end -      def html_segtoc -        pth=((output_dir_structure.by_filename?) \ -          || (output_dir_structure.dump?) \ -          || (output_dir_structure.redirect?)) \ -        ? "#{output_path.html.dir}" -        : "#{output_path.html.dir}/#{@md.fnb}" -        make_path(pth) -        p_fn=place_file.html_segtoc.dir -        @@filename_html_index=File.new(p_fn,'w+') -      end -      def xhtml -        path=output_path.xhtml.dir -        make_path(path) -        fn=base_filename.xhtml -        make_file(path,fn) -      end -      def xml_sax -        path=output_path.xml.dir -        make_path(path) -        fn=base_filename.xml_sax -        make_file(path,fn) -      end -      def xml_dom -        path=output_path.xml.dir -        make_path(path) -        fn=base_filename.xml_dom -        make_file(path,fn) -      end -      def xml_docbook_book -        path=output_path.xml_docbook_book.dir -        make_path(path) -        fn=base_filename.xml_docbook_book -        make_file(path,fn) -      end -      def xml_fictionbook -        path=output_path.xml_fictionbook.dir -        make_path(path) -        fn=base_filename.xml_fictionbook -        make_file(path,fn) -      end -      def xml_scaffold_structure_sisu -        path=output_path.xml_scaffold_structure_sisu.dir -        make_path(path) -        fn=base_filename.xml_scaffold_structure_sisu -        make_file(path,fn) -      end -      def xml_scaffold_structure_collapse -        path=output_path.xml_scaffold_structure_collapse.dir -        make_path(path) -        fn=base_filename.xml_scaffold_structure_collapse -        make_file(path,fn) -      end -      def manpage -        path=output_path.manpage.dir -        make_path(path) -        fn=base_filename.manpage -        make_file(path,fn) -      end -      def texinfo -        path=output_path.texinfo.dir -        make_path(path) -        fn=base_filename.texinfo -        make_file(path,fn) -      end -      def info -        path=output_path.texinfo.dir -        make_path(path) -        fn=base_filename.info -        make_file(path,fn) -      end -      def hash_digest -        path=output_path.hash_digest.dir -        make_path(path) -        fn=base_filename.hash_digest -        make_file(path,fn) -      end -      def qrcode -        path=output_path.qrcode.dir -        make_path(path) -        fn=base_filename.qrcode -        make_file(path,fn) -      end -      def manifest -        path=output_path.manifest.dir -        make_path(path) -        fn=base_filename.manifest -        make_file(path,fn) -      end -      def manifest_txt -        path=output_path.manifest.dir -        make_path(path) -        fn=base_filename.manifest_txt -        make_file(path,fn) -      end -      def pot -        path=output_path.pot.dir -        make_path(path) -        fn=base_filename.pot -        make_file(path,fn) -      end -      def po -        path=output_path.po.dir -        make_path(path) -        fn=base_filename.po -        make_file(path,fn) -      end -      self -    end -    def place_file -      def txt -        def dir -          output_path.txt.dir + '/' + base_filename.txt -        end -        def rel -          output_path.txt.rel + '/' + base_filename.txt -        end -        self -      end -      def textile -        def dir -          output_path.textile.dir + '/' + base_filename.textile -        end -        def rel -          output_path.textile.rel + '/' + base_filename.textile -        end -        self -      end -      def asciidoc -        def dir -          output_path.asciidoc.dir + '/' + base_filename.asciidoc -        end -        def rel -          output_path.asciidoc.rel + '/' + base_filename.asciidoc -        end -        self -      end -      def markdown -        def dir -          output_path.markdown.dir + '/' + base_filename.markdown -        end -        def rel -          output_path.markdown.rel + '/' + base_filename.markdown -        end -        self -      end -      def rst -        def dir -          output_path.rst.dir + '/' + base_filename.rst -        end -        def rel -          output_path.rst.rel + '/' + base_filename.rst -        end -        self -      end -      def html_scroll -        def dir -          output_path.html_scroll.dir + '/' + base_filename.html_scroll -        end -        def rel -          output_path.html_scroll.rel + '/' + base_filename.html_scroll -        end -        self -      end -      def html_seg_index -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_seg_index -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_seg_index -        end -        self -      end -      def html_segtoc -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_segtoc -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_segtoc -        end -        self -      end -      def html_book_index -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_book_index -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_book_index -        end -        self -      end -      def html_concordance -        def dir -          output_path.html_seg.dir + '/' + base_filename.html_concordance -        end -        def rel -          output_path.html_seg.rel + '/' + base_filename.html_concordance -        end -        self -      end -      def odt -        def dir -          output_path.odt.dir + '/' + base_filename.odt -        end -        def rel -          output_path.odt.rel + '/' + base_filename.odt -        end -        self -      end -      def epub -        def dir -          output_path.epub.dir + '/' + base_filename.epub -        end -        def rel -          output_path.epub.rel + '/' + base_filename.epub -        end -        self -      end -      def pdf_p -        STDERR.puts 'ERROR not available due to multiple page format sizes' -      end -      def pdf_l -        STDERR.puts 'ERROR not available due to multiple page format sizes' -      end -      def xhtml -        def dir -          output_path.xhtml.dir + '/' + base_filename.xhtml -        end -        def rel -          output_path.xhtml.rel + '/' + base_filename.xhtml -        end -        self -      end -      def xml_sax -        def dir -          output_path.xml.dir + '/' + base_filename.xml_sax -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_sax -        end -        self -      end -      def xml_dom -        def dir -          output_path.xml.dir + '/' + base_filename.xml_dom -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_dom -        end -        self -      end -      def xml_docbook_book -        def dir -          output_path.xml_docbook.dir + '/' + base_filename.xml_docbook_book -        end -        def rel -          output_path.xml_docbook.rel + '/' + base_filename.xml_docbook_book -        end -        self -      end -      def xml_fictionbook -        def dir -          output_path.xml_fictionbook.dir + '/' + base_filename.xml_fictionbook -        end -        def rel -          output_path.xml_fictionbook.rel + '/' + base_filename.xml_fictionbook -        end -        self -      end -      def xml_scaffold_structure_sisu -        def dir -          output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_sisu -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_sisu -        end -        self -      end -      def xml_scaffold_structure_collapse -        def dir -          output_path.xml.dir + '/' + base_filename.xml_scaffold_structure_collapse -        end -        def rel -          output_path.xml.rel + '/' + base_filename.xml_scaffold_structure_collapse -        end -        self -      end -      def sqlite_discrete -        def dir -          output_path.sqlite_discrete.dir + '/' + base_filename.sqlite_discrete -        end -        def rel -          output_path.sqlite_discrete.rel + '/' + base_filename.sqlite_discrete -        end -        self -      end -      def hash_digest -        def dir -          output_path.hash_digest.dir + '/' + base_filename.hash_digest -        end -        def rel -          output_path.hash_digest.rel + '/' + base_filename.hash_digest -        end -        self -      end -      def src -        def dir -          output_path.src.dir + '/' + base_filename.src -        end -        def rel -          output_path.src.rel + '/' + base_filename.src -        end -        self -      end -      def sisupod -        def dir -          output_path.sisupod.dir + '/' + base_filename.sisupod -        end -        def rel -          output_path.sisupod.rel + '/' + base_filename.sisupod -        end -        self -      end -      def po -        def dir -          output_path.po.dir + '/' + base_filename.po -        end -        def rel -          output_path.po.rel + '/' + base_filename.po -        end -        self -      end -      def pot -        def dir -          output_path.pot.dir + '/' + base_filename.pot -        end -        def rel -          output_path.pot.rel + '/' + base_filename.pot -        end -        self -      end -      def po_git -        def dir -          output_path.po_git + '/' + base_filename.po -        end -        def rel -          #output_path.po_git + '/' + base_filename.po -        end -        self -      end -      def pot_git -        def dir -          output_path.pot_git + '/' + base_filename.pot -        end -        def rel -          #output_path.pot_git + '/' + base_filename.pot -        end -        self -      end -      def manpage -        def dir -          output_path.manpage.dir + '/' + base_filename.manpage -        end -        def rel -          output_path.manpage.rel + '/' + base_filename.manpage -        end -        self -      end -      def texinfo -        def dir -          output_path.texinfo.dir + '/' + base_filename.texinfo -        end -        def rel -          output_path.texinfo.rel + '/' + base_filename.texinfo -        end -        self -      end -      def info -        def dir -          output_path.texinfo.dir + '/' + base_filename.info -        end -        def rel -          output_path.texinfo.rel + '/' + base_filename.info -        end -        self -      end -      def qrcode_title -        def dir -          output_path.qrcode.dir + '/' + base_filename.qrcode_title -        end -        def rel -          output_path.qrcode.rel + '/' + base_filename.qrcode_title -        end -        self -      end -      def qrcode_md -        def dir -          output_path.qrcode.dir + '/' + base_filename.qrcode_md -        end -        def rel -          output_path.qrcode.rel + '/' + base_filename.qrcode_md -        end -        self -      end -      def manifest -        def dir -          output_path.manifest.dir + '/' + base_filename.manifest -        end -        def rel -          output_path.manifest.rel + '/' + base_filename.manifest -        end -        self -      end -      self -    end -    def base_filename -      def i18n(f) -        f=default_hash.merge(f) -        f[:lng] ||=@md.lang_code_insert -        f[:fn] + f[:lng] + f[:ft] -      end -      def default_hash -        { -          fn: @md.fnb, -          lng: @md.lang_code_insert, -        } -      end -      def default_hash_build(fh,sfx) -        if fh.is_a?(Hash) -          fh[:fn] ||=@md.fnb -          fh[:lng] ||= @md.lang_code_insert -          fh[:ft]=sfx -          fh -        else -          { -            fn: @md.fnb, -            lng: @md.lang_code_insert, -            ft: sfx, -          } -        end -      end -      def lang_code?(lng) -        (output_dir_structure.by_language_code?) \ -        ? '' -        : (lng ||=@md.lang_code_insert) -      end -      def txt(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def textile(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_textile]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def asciidoc(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_asciidoc]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def markdown(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_markdown]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def rst(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt_rst]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'plain', -            ft: fh[:ft], -            lng: fh[:lng], -           } -         else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_scroll(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_seg_index(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: 'index', -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def html_segtoc(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: fh[:fn] + '.toc', -            ft: fh[:ft], -          } -        else -          { -            fn: 'toc', -            ft: fh[:ft], -            lng: lang_code?(fh[:lng]), -          } -        end -        i18n(fnh) -      end -      def html_seg(fh) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def html_book_index(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: 'book_index', -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def html_concordance(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: 'concordance', -            ft: fh[:ft], -          } -        else -          { -            fn: 'concordance', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xhtml(fh=nil) -        fh=default_hash_build(fh,Sfx[:xhtml]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def epub(fh=nil) -        fh=default_hash_build(fh,Sfx[:epub]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def odt(fh=nil) -        fh=default_hash_build(fh,Sfx[:odt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'opendocument', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_sax(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_sax]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_dom(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_dom]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_docbook_book(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_docbook_book]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_fictionbook(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_fictionbook]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_scaffold_structure_sisu(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_sisu]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def xml_scaffold_structure_collapse(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml_scaffold_structure_collapse]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'scroll', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def pdf_p(fh=nil) -        fh=default_hash_build(fh,Sfx[:pdf]) -        fh[:lng]=lang_code?(fh[:lng]) -        if output_dir_structure.by_filename? -          'portrait' + fh[:lng] + '.' -        else -          fh[:fn] + '.portrait' + fh[:lng] + '.' -        end -      end -      def pdf_l(fh=nil) -        fh=default_hash_build(fh,Sfx[:pdf]) -        fh[:lng]=lang_code?(fh[:lng]) -        if output_dir_structure.by_filename? -          'landscape' + fh[:lng] + '.' -        else -          fh[:fn] + '.landscape' + fh[:lng] + '.' -        end -      end -      def pdf_p_a4(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_a4] -      end -      def pdf_p_a5(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_a5] -      end -      def pdf_p_b5(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_b5] -      end -      def pdf_p_letter(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_letter] -      end -      def pdf_p_legal(fh=nil) -        pdf_p(fh) + @md.fn[:pdf_p_legal] -      end -      def pdf_l_a4(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_a4] -      end -      def pdf_l_a5(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_a5] -      end -      def pdf_l_b5(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_b5] -      end -      def pdf_l_letter(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_letter] -      end -      def pdf_l_legal(fh=nil) -        pdf_l(fh) + @md.fn[:pdf_l_legal] -      end -      def manpage(fh=nil) -        fh=default_hash_build(fh,Sfx[:manpage]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def info(fh=nil) -        fh=default_hash_build(fh,Sfx[:info]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def texinfo(fh=nil) -        fh=default_hash_build(fh,Sfx[:texinfo]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def sqlite_discrete(fh=nil) -        fh=default_hash_build(fh,Sfx[:sql]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh={ -          fn: fh[:fn], -          ft: fh[:ft], -          lng: fh[:lng], -        } -        i18n(fnh) -      end -      def hash_digest(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_language_code? -          { -            fn: fh[:fn] + '.hash_digest', -            ft: fh[:ft], -          } -        elsif output_dir_structure.by_filetype? -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: 'digest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def sitemap(fh=nil) -        fh=default_hash_build(fh,Sfx[:xml]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_language_code? -          { -            fn: fh[:fn] + '.sitemap', -            ft: fh[:ft], -          } -        elsif output_dir_structure.by_filetype? -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: 'sitemap', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def qrcode_title(fh=nil) -        fh=default_hash_build(fh,'.title.png') -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def qrcode_md #check name below -        fh=default_hash_build(fh,'.md.png') -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def manifest_txt(fh=nil) -        fh=default_hash_build(fh,Sfx[:txt]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def manifest(fh=nil) -        fh=default_hash_build(fh,Sfx[:html]) -        fh[:lng]=lang_code?(fh[:lng]) -        fnh=if output_dir_structure.dump_or_redirect? -          { -            fn: fh[:fn] + '.manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        elsif output_dir_structure.by_filename? -          { -            fn: 'sisu_manifest', -            ft: fh[:ft], -            lng: fh[:lng], -          } -        else -          { -            fn: fh[:fn], -            ft: fh[:ft], -            lng: fh[:lng], -          } -        end -        i18n(fnh) -      end -      def src -        @md.fno -      end -      def po #check -        (@fno.empty?) \ -        ? (@md.fn[:po]) -        : (@fno + '.po') -      end -      def pot -        (@fno.empty?) \ -        ? (@md.fn[:pot]) -        : (@fno + '.pot') -      end -      def sisupod -        (@md.fns =~/\.ssm\.sst$/) \ -        ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz') -        : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz') -      end -      self -    end -    def set_path(ft) -      @ft=ft -      def dir -        def abc -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          elsif output_dir_structure.by_language_code? -            "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.base.dir}/#{@ft}" -          else -            "#{output_path.base.dir}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          elsif output_dir_structure.by_language_code? -            "#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.base.dir}/#{@ft}" -          end -        end -        def ab_src -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          else -            "#{output_path.base.dir}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -          end -        end -        def ab_pod -          if output_dir_structure.redirect? -            "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}" -          elsif output_dir_structure.dump? -            @md.opt.opt_act[:dump][:inst] -          else -            "#{output_path.base.dir}/#{@ft}" -          end -        end -        self -      end -      def url -        def abc -          if output_dir_structure.by_language_code? -            "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.base.url}/#{@ft}" -          else -            "#{output_path.base.url}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{output_path.base.url}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.base.url}/#{@ft}" -          end -        end -        def ab_src -          "#{output_path.base.url}/#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -        end -        def ab_pod -          "#{output_path.base.url}/#{@ft}" -        end -        self -      end -      def rel -        def abc -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{@ft}" -          else -            "#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          else -            "#{@ft}" -          end -        end -        def ab_src -          @ft -        end -        def ab_pod -          @ft -        end -        self -      end -      def rel_sm -        def abc -          if output_dir_structure.by_language_code? -            "#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{@ft}" -          else -            "#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? \ -          or output_dir_structure.by_filetype? -            '../' + @ft -          else '.' -          end -        end -        def ab_src -          locate="#{@ft}/#{@md.opt.fng}/#{Gt[:sisupod]}/#{Gt[:doc]}/#{@md.opt.lng}" -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? -            "../../#{locate}" -          else -            "../#{locate}" -          end -        end -        def ab_pod -          if output_dir_structure.dump_or_redirect? -            '.' -          elsif output_dir_structure.by_language_code? -            "../../#{@ft}" -          else -            "../#{@ft}" -          end -        end -        self -      end -      def rcp -        def abc -          if output_dir_structure.by_language_code? -            "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" -          elsif output_dir_structure.by_filetype? -            "#{output_path.stub.rcp}/#{@ft}" -          else -            "#{output_path.stub.rcp}/#{@md.fnb}" -          end -        end -        def ab -          if output_dir_structure.by_language_code? -            "#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}" -          else -            "#{output_path.stub.rcp}/#{@ft}" -          end -        end -        self -      end -      self -    end -    def output_path -      def web_base -        def dir -          @env.path.webserv -        end -        def url -          #"#{@env.url.root}" -        end -        def rel -          '.' -        end -        def rcp -          '.' -        end -        self -      end -      def stub -        def dir -          "#{@md.opt.f_pth[:pth_stub]}" -        end -        #def url -        #  "#{@env.url.root}" -        #end -        def rel -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        def rcp -          "#{@md.opt.f_pth[:pth_stub]}" -        end -        self -      end -      def webserver_path -        if output_dir_structure.dump? -          @md.opt.opt_act[:dump][:inst] -        elsif output_dir_structure.redirect? -          @md.opt.opt_act[:redirect][:inst] -        else -          @env.path.webserv -        end -      end -      def base -        def dir -          "#{webserver_path}/#{@md.opt.f_pth[:pth_stub]}" -        end -        def url -          "#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}" -        end -        def rel -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        def rcp -          "./#{@md.opt.f_pth[:pth_stub]}" -        end -        self -      end -      def sisugit -        def dir -          "#{output_path.base.dir}/git" -        end -        def url -          "#{output_path.base.url}/git" -        end -        def rel -          "#{output_path.base.rel}/git" -        end -        def rcp -          "#{output_path.base.rcp}/git" -        end -        self -      end -      #def pod -      #  ft='pod' -      #  path=set_path(ft).dir.ab -      #end -      def src -        def ft -          Gt[:src] -        end -        def dir -          set_path(ft).dir.ab_src -        end -        def url -          set_path(ft).url.ab_src -        end -        def rel -          set_path(ft).rel.ab_src -        end -        def rcp -          set_path(ft).rcp.ab_src -        end -        def rel_sm -          set_path(ft).rel_sm.ab_src -        end -        self -      end -      def sisupod -        def ft -          Gt[:src] -        end -        def dir -          set_path(ft).dir.ab_pod -        end -        def url -          set_path(ft).url.ab_pod -        end -        def rel -          set_path(ft).rel.ab_pod -        end -        def rcp -          set_path(ft).rcp.ab_pod -        end -        def rel_sm -          set_path(ft).rel_sm.ab_pod -        end -        self -      end -      def po -        def dir -          "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/po/#{@md.opt.lng}" -        end -        def url -          "#{output_path.base.url}/po4a/#{@md.fnb}/po/#{@md.opt.lng}" -        end -        self -      end -      def pot -        def dir -         "#{output_path.base.dir}/#{Gt[:src]}/#{@md.opt.fng}/po4a/pot" -        end -        def url -          "#{output_path.base.url}/po4a/#{@md.fnb}/pot" -        end -        def rcp -          #p "#{output_path.base.dir}/po4a/#{@md.fnb}/pot" -        end -        self -      end -      def po_git # consider !!! -        def ft -          Gt[:po] -        end -        def dir -          pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + @md.opt.lng -          FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) -          pth -        end -        self -      end -      def pot_git # consider !!! -        def ft -          Gt[:pot] -        end -        def dir -          @env.processing_path.git + '/' + @md.fnb + '/' + ft -        end -        self -      end -      def md_harvest -        manifest -        self -      end -      def txt -        def ft -         'txt' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def textile -        def ft -         'textile' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def asciidoc -        def ft -         'asciidoc' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def markdown -        def ft -         'markdown' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def rst -        def ft -         'rst' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def html_scroll -        def ft -         'html' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def html_seg -        def ft -          "html/#{@md.fnb}" -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def html_concordance -        html_seg -        self -      end -      def html -        def ft -         'html' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).url.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          if output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        self -      end -      def xhtml -        def ft -         'xhtml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def epub -        def ft -         'epub' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          './image' -        end -        self -      end -      def odt -        def ft -         'odt' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def xml -        def ft -         'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_sax -        xml -        self -      end -      def xml_dom -        xml -        self -      end -      def xml_docbook -        def ft -         'docbook' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_docbook_article -        def ft -         'docbook' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_docbook_book -        def ft -         'docbook' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_fictionbook -        def ft -         'fictionbook' + DEVELOPER[:under_construction] -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_scaffold_structure_sisu -        def ft -         'sisu.scaffold.xml' -         #'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def xml_scaffold_structure_collapse -        def ft -         'collapsed.scaffold.xml' -         #'xml' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        def rel_image -          '../../_sisu/image' -        end -        self -      end -      def pdf -        def ft -         'pdf' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def sqlite_discrete -        def ft -         'sql' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def hash_digest -        def ft -         'hashes' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def manifest -        def ft -         'manifest' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rel_image -          if output_dir_structure.dump_or_redirect? -            './image' -          elsif output_dir_structure.by_language_code? -            '../../_sisu/image' -          elsif output_dir_structure.by_filetype? -            '../_sisu/image' -          else -            '../_sisu/image' -          end -        end -        def rcp -          set_path(ft).rcp.abc -        end -        self -      end -      def qrcode -        def ft -         'manifest/qrcode' -        end -        def dir -          set_path(ft).dir.abc -        end -        def url -          set_path(ft).url.abc -        end -        def rel -          set_path(ft).rel.abc -        end -        def rcp -          set_path(ft).rcp.abc -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def harvest -        def ft -         'site_metadata' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          if output_dir_structure.by_language_code? -            '' -          elsif output_dir_structure.by_filetype? -            '' -          else -            '' -          end -        end -        self -      end -      def manpage -        def ft -         'man' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def texinfo -        def ft -         'texinfo' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        def rel_sm -          set_path(ft).rel_sm.ab -        end -        self -      end -      def sitemaps -        def ft -          'sitemaps' -        end -        def dir -          set_path(ft).dir.ab -        end -        def url -          set_path(ft).url.ab -        end -        def rel -          set_path(ft).rel.ab -        end -        def rcp -          set_path(ft).rcp.ab -        end -        self -      end -      def sqlite #check url -        def dir -          output_path.base.dir -        end -        def url -          output_path.base.url -        end -        def rel -          output_path.base.rel -        end -        def rcp -          output_path.base.rcp -        end -        self -      end -      #def cgi -      #end -      def css -        @d='_sisu/css' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          @d -          #output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.stub.rcp + '/' + @d -        end -        self -      end -      def images -        @d='_sisu/image' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          @d -          #output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.stub.rcp + '/' + @d -        end -        self -      end -      def images_external -        @d='_sisu/image_external' -        def dir -          output_path.base.dir + '/' + @d -        end -        def url -          output_path.base.url + '/' + @d -        end -        def rel -          output_path.base.rel + '/' + @d -        end -        def rcp -          output_path.base.rcp + '/' + @d -        end -        self -      end -      #def css -      #  #"#{@env.path.output}/#{@env.path.style}" -      #end -      self -    end +  class FileOp < SiSU_File_Op::FileOp                      # se_file_op.rb    end -  class FilenameLanguageCodeInsert -    def initialize(opt,lng=nil) -      @opt,@lng=opt,lng -      @opt=opt -      @lng=lng ||=@opt.lng -    end -    def language_code_insert -      if @opt.dir_structure_by ==:language \ -      or ((@opt.dir_structure_by ==:filetype \ -      || @opt.dir_structure_by ==:filename) \ -      and (@opt.lingual ==:mono \ -      && @lng == @opt.act[:default_language][:code])) -        '' -      elsif (@opt.dir_structure_by ==:filetype \ -      || @opt.dir_structure_by ==:filename) \ -      and not @opt.lingual ==:mono -        ".#{@lng}" -      else -        ".#{@lng}" -      end -    end +  class FilenameLanguageCodeInsert < SiSU_Filename_Lang::FilenameLanguageCodeInsert # se_file_op.rb    end -  class CreateFile <InfoEnv                                                  #todo unify with FileOp -    def initialize(fns) -      begin -        super(fns) -        @env=SiSU_Env::InfoEnv.new(fns) -      rescue -        SiSU_Screen::Ansi.new('',$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def html_root -      #@env.path.output -    end -    def mkdir_pdf -      Dir.mkdir(@env.processing_path.tex) unless FileTest.directory?(@env.processing_path.tex) -    end -    def file_generic(output_file='') -      filename="#{@env.path.output}/#{@fnb}/#{output_file}" -      File.new(filename,'w+') -    end -    def file_error -      File.new('/tmp/errorlog.sisu','w+') -    end -    def file_txt -      File.new("#{@env.processing_path.ao}/#{@fns}.txt",'w+') -    end -    def file_debug -      File.new("#{@env.processing_path.ao}/#{@fns}.debug.txt",'w+') -    end -    def metaverse -      def file_meta -        File.new("#{@env.processing_path.ao}/#{@fns}.meta",'w+') -      end -      def file_meta_idx_html -        File.new("#{@env.processing_path.ao}/#{@fns}.idx.html",'w+') -      end -      self -    end -    def file_note -      File.new("#{Dir.pwd}/#{@fns}.fn",'w+') -    end -    def meta -      "#{@env.processing_path.ao}/#{@fns}.meta" -    end -    def file_semantic -      filename_semantic="./semantic.yaml" -      @@filename_semantic=File.new(filename_semantic,'w+') -    end -    def file_rss -      filename_rss="./semantic.xml" -      @@filename_rss=File.new(filename_rss,'w+') -    end -    def epub -      @pth=@env.processing_path.epub -      def xhtml_index -        filename_index="#{@pth}/#{Ep[:d_oebps]}/index.xhtml" -        File.new(filename_index,'w+') -      end -      def xhtml_cover_image -        filename_index="#{@pth}/#{Ep[:d_oebps]}/cover_image.xhtml" -        File.new(filename_index,'w+') -      end -      def xhtml_segtoc -        filename_segtoc="#{@pth}/#{Ep[:d_oebps]}/toc.xhtml" -        File.new(filename_segtoc,'w+') -      end -      def mimetype  #fixed application/epub+zip ~/grotto/theatre/dbld/builds/epub_sample/mimetype -        File.new("#{@pth}/mimetype",'w') -      end -      def metadata #variable matadata ~/grotto/theatre/dbld/builds/epub_sample/metadata.opf -        File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_opf]}",'w') -      end -      def toc_ncx  #variable toc ~/grotto/theatre/dbld/builds/epub_sample/toc.ncx -        File.new("#{@pth}/#{Ep[:d_oebps]}/#{Ep[:f_ncx]}",'w') -      end -      def metainf_cont #variable content ~/grotto/theatre/dbld/builds/epub_sample/META-INF/container.xml -        File.new("#{@pth}/META-INF/container.xml",'w') -      end -      def xhtml_css #fixed epub xhtml css -        File.new("#{@pth}/#{Ep[:d_oebps]}/css/xhtml.css",'w') -      end -      self -    end -    def file_texinfo -      File.new("#{@env.processing_path.texinfo}/#{@fnb}.texinfo",'w+') -    end +  class CreateFile < SiSU_Create_File::CreateFile          # se_file_op.rb    end -  class Clear <InfoEnv                                                  #todo unify with FileOp -    def initialize(cmd,fns,operation='') -      @cmd=cmd -      begin -        super(fns) -        @env=SiSU_Env::InfoEnv.new(fns) -        InfoVersion.instance -        if operation.class.inspect =~/SiSU_Param/ -          @md=operation -        end -        case operation #watch -        when /pdf/                 then @env_out='' -        when /sql/ -        when /xml|plaintext|ascii/ then @env_out="#{@env.path.output}/#{@fnb}" #check change of name to plaintext from ascii -        else -          if defined? @md.sfx_src \ -          and @md.sfx_src =~/ss[ftsumc]/ -            @env_suf='lm' -            @env_out_root=@env.path.output -            @env_out="#{@env.path.output}/#{@fnb}" -            @@publisher='SiSU http://www.jus.uio.no/sisu' -            @env_pdf="#{@env_out_root}/pdf" -          end -        end -      rescue -        SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue do -          __LINE__.to_s + ':' + __FILE__ -        end -      ensure -      end -    end -    def param_instantiate -      @cX||=SiSU_Screen::Ansi.new(@cmd) -      @@date=SiSU_Env::InfoDate.new -      @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil -      @@publisher='SiSU scribe' -    end +  class Clear < SiSU_Clear::Clear                          # se_clear.rb    end -  class InfoPort < InfoEnv -    def initialize -      @env=SiSU_Env::InfoEnv.new -    end -    def webrick -      @env.port.webrick_port -    end +  class InfoPort < SiSU_Info_Port::InfoPort                # se_info_port.rb    end -  class InfoProgram < InfoEnv                                                #revisit -    attr_accessor :editor,:wc,:tidy,:rexml,:pdflatex,:postgresql,:sqlite -    def initialize -      prog=SiSU_Env::InfoEnv.new.program -      @editor,@wc,@tidy,@rexml,@pdflatex,@postgresql,@sqlite=prog.text_editor,prog.wc,prog.tidy,prog.rexml,prog.pdflatex,prog.postgresql,prog.sqlite -    end +  class InfoProgram < SiSU_Info_Program::InfoProgram       # se_programs.rb    end -  class CSS_Default -    def html -      'html.css' -    end -    def html_tables -      'html_tables.css' -    end -    def xhtml -      'xhtml.css' -    end -    def xml_sax -      'sax.css' -    end -    def xml_dom -      'dom.css' -    end -    def xml_docbook -      'docbook.css' -    end -    def homepage -      'homepage.css' -    end -    def harvest -      'harvest.css' -    end +  class CSS_Default < SiSU_CSS::CSS_Default                # se_css.rb    end -  class CSS_Select < InfoEnv -    def initialize(md) -      @md=md -      @env=SiSU_Env::InfoEnv.new('',@md) -    end -    def html -      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.base_markup_dir_stub}_html.css") -        "#{@env.path.base_markup_dir_stub}_html.css" -      else -        SiSU_Env::CSS_Default.new.html -      end -    end -    def html_tables -      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.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 -    def xhtml -      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.base_markup_dir_stub}_xhtml.css") -        "#{@env.path.base_markup_dir_stub}_xhtml.css" -      else SiSU_Env::CSS_Default.new.xhtml -      end -    end -    def xml_sax -      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.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 -    def xml_dom -      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.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 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.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.base_markup_dir_stub}_homepage.css") -        "#{@env.path.base_markup_dir_stub}_homepage.css" -      else SiSU_Env::CSS_Default.new.homepage -      end -    end +  class CSS_Select < SiSU_CSS::CSS_Select                  # se_css.rb    end -  class CSS_Stylesheet -    def initialize(md) -      @md=md -      @css=SiSU_Env::CSS_Select.new(@md) -      @env=SiSU_Env::InfoEnv.new('',@md) -      @file=SiSU_Env::FileOp.new(@md) -    end -    def html -      stylesheet="#{@file.path_rel_links.html_scroll_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def html_seg -      stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def html_tables -      stylesheet="#{@file.path_rel_links.html_seg_css}#{@env.path.style}/#{@css.html}" -      %{  <link rel="stylesheet" href="#{stylesheet}" type="text/css" />} -    end -    def xhtml_epub -      %{  <link rel="stylesheet" href="css/xhtml.css" type="text/css" />} -    end -    def epub -      xhtml_epub -    end -    def xhtml -      stylesheet="#{@file.path_rel_links.xhtml_css}#{@env.path.style}/#{@css.xhtml}" -      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} -    end -    def xml_sax -      stylesheet="#{@file.path_rel_links.xml_css}#{@env.path.style}/#{@css.xml_sax}" -      %{<?xml-stylesheet type="text/css" href="#{stylesheet}"?>} -    end -    def xml_dom -      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 +  class CSS_Stylesheet < SiSU_CSS::CSS_Stylesheet          # se_css.rb    end -  class CreateSite < InfoEnv -    require_relative 'css'                              # css.rb -      include SiSU_Style -    def initialize(opt) -      @opt=opt -      @env=SiSU_Env::InfoEnv.new -      @init=SiSU_Env::GetInit.new -      @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd -      @rc=GetInit.new.sisu_yaml.rc -      @vz=SiSU_Viz::Defaults.new -      @vz_home=SiSU_Viz::Home.new -    end -    def create_default_sisu_homepage(action=:none) -      if action==:none -        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.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 -        file_home_toc << @vz_home.homepage -        file_homepage.close -        file_home_toc.close -      end -    end -    def homepage -      home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") -      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.base_markup_dir_stub}") -        end -      else -        create_default_sisu_homepage(:none) -        #create_default_sisu_homepage(:default) -      end -    end -    def cp_images(src_path,dest_path) -      if FileTest.directory?(src_path) -        FileUtils::cd(src_path) -        source=Dir.glob("*.{png,jpg,gif,ico}") -        FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) -        FileUtils::chmod(0755,dest_path) -        source.each do |i| -          if FileTest.file?(i) -            FileUtils::cp(i,"#{dest_path}/#{i}") -            FileUtils::chmod(0644,"#{dest_path}/#{i}") -          else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} -          end -        end -        FileUtils::cd(@pwd) -      else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} -      end -    end -    def cp_local_images -      src="#{@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.base_markup_dir_stub}/_sisu/image_external" -      if FileTest.directory?(src) -        cp_images(src,dest) if FileTest.directory?(src) -      end -    end -    def cp_webserver_images -      src=@env.path.image_source -      dest_arr=[ -        "#{@env.path.webserv}/_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) -      end -    end -    def cp_webserver_images_local #this should not have been necessary -      src=@env.path.image_source -      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.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 -      if defined? @rc['permission_set']['css_modify'] \ -      and @rc['permission_set']['css_modify'] -        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) -            source=Dir.glob("*.{css}") -            source.each do |i| -              if FileTest.file?(i) -                FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") -              else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} -              end -            end -            FileUtils::cd(@pwd) -          end -        end -      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 @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 @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 @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 @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 @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 @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 @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 -      end -    end +  class CreateSite < SiSU_Create_Site::CreateSite          # se_createsite.rb    end  end  module SiSU_Screen @@ -7233,4 +162,3 @@ module SiSU_Errors    require_relative 'errors'                             # errors.rb  end  __END__ -https? intro check 2007-09-22 diff --git a/lib/sisu/v6/texinfo.rb b/lib/sisu/v6/texinfo.rb index 1f3df4e3..f17ab1ab 100644 --- a/lib/sisu/v6/texinfo.rb +++ b/lib/sisu/v6/texinfo.rb @@ -113,8 +113,16 @@ module SiSU_TexInfo          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \          && ! @opt.act[:quiet][:set]==:on \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'TexInfo', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'TexInfo', +            tool +          ).green_title_hi          @md=SiSU_Param::Parameters.new(@opt).get          directories          @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.ao_content diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb index 5654e6df..fd0e9691 100644 --- a/lib/sisu/v6/texpdf.rb +++ b/lib/sisu/v6/texpdf.rb @@ -119,16 +119,28 @@ module SiSU_TeX      def song        begin          @md=@particulars.md -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'LaTeX/PDF', +          "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" +        ).green_title_hi unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on)            @env.url.output_tell            if @md.opt.act[:pdf_l][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf" +            ).flow            end            if @md.opt.act[:pdf_p][:set]==:on -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf" +            ).flow            end          end          @md=@particulars.md @@ -183,7 +195,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} portrait ->").dark_grey_title_hi +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "#{papersize} portrait ->" +            ).dark_grey_title_hi            end            cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd)            tell.grey_open if @md.opt.cmd =~/[MVv]/ @@ -197,7 +212,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} landscape ->").dark_grey_title_hi +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "#{papersize} landscape ->" +            ).dark_grey_title_hi            end            cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd)            if (@md.opt.act[:verbose][:set]==:on \ @@ -253,7 +271,11 @@ module SiSU_TeX          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            @@n_lpdf, +            'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)' +          ).generic_number          end        end        def latexrun_selective @@ -323,7 +345,10 @@ module SiSU_TeX                end              end            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped" +            ).warn            end            lst=Dir["*.{aux,log,out}"]            lst.each {|file| File.unlink(file)} if lst @@ -378,7 +403,10 @@ module SiSU_TeX            if (@md.opt.act[:verbose][:set]==:on \            || @md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],txt_gen).txt_grey +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              txt_gen +            ).txt_grey            end            if defined? @md.rights.all \            and not @md.rights.all.empty? diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb index ce027718..ba99efb7 100644 --- a/lib/sisu/v6/texpdf_format.rb +++ b/lib/sisu/v6/texpdf_format.rb @@ -499,7 +499,12 @@ module SiSU_TeX_Pdf          @txt.gsub!(/<:=\s*(\S+?)\s*>/,            "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          "ERROR - image:", +          %{"#{image}" missing}, +          "search path: #{dir.path.image_source_include}" +        ).error2 unless @md.opt.act[:quiet][:set]==:on          @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile !        end      end @@ -511,7 +516,8 @@ module SiSU_TeX_Pdf          link,url=link.strip,url.strip          link.gsub!(/&/,"#{Xx[:protect]}&")          url="#{@env.url.root}/" + url -        str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") +        str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m, +          "#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}")        end        while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m          link,url=$1,$2 @@ -642,7 +648,10 @@ module SiSU_TeX_Pdf                hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace                caption=(c ?  "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" : '')              elsif images_hash[ps] =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/m -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @md.opt.act[:quiet][:set]==:on +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                %{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n} +              ).print_grey #unless @md.opt.act[:quiet][:set]==:on                images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]')              end              if image #most images fc etc. #% clean up ! @@ -694,7 +703,12 @@ module SiSU_TeX_Pdf                  end                  images_hash[ps]                else -                SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on +                SiSU_Screen::Ansi.new( +                  @md.opt.act[:color_state][:set], +                  "ERROR - image:", +                  %{"#{image}" missing}, +                  "search locations: #{dir.path.image_source_include_local}, #{dir.path.image_source_include_remote} and #{dir.path.image_source_include}" +                ).error2 unless @md.opt.act[:quiet][:set]==:on                  if images_hash[ps] =~url_image_rgx \                  or images_hash[ps] =~image_rgx                    images_hash[ps]='' @@ -1610,7 +1624,11 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\        sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png")          "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}"        else -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          'WARNING - image directory or image(s) missing:', +          %{"#{dir.path.image_source_include}"} +        ).warn unless @md.opt.act[:quiet][:set]==:on          " SiSU "        end        url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') diff --git a/lib/sisu/v6/txt_asciidoc.rb b/lib/sisu/v6/txt_asciidoc.rb index e8780ced..fd10b25c 100644 --- a/lib/sisu/v6/txt_asciidoc.rb +++ b/lib/sisu/v6/txt_asciidoc.rb @@ -90,11 +90,23 @@ module SiSU_Txt_AsciiDoc            (@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],'AsciiDoc (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'AsciiDoc (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'AsciiDoc (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'AsciiDoc (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.asciidoc.dir}/#{md.file.base_filename.asciidoc}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v6/txt_markdown.rb b/lib/sisu/v6/txt_markdown.rb index 2cab47fd..1fc488be 100644 --- a/lib/sisu/v6/txt_markdown.rb +++ b/lib/sisu/v6/txt_markdown.rb @@ -90,11 +90,22 @@ module SiSU_Txt_Markdown            (@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],'Markdown (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Markdown (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Markdown (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Markdown (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns,"#{md.file.output_path.markdown.dir}/#{md.file.base_filename.markdown}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v6/txt_plain.rb b/lib/sisu/v6/txt_plain.rb index a56f5ac9..3f54e749 100644 --- a/lib/sisu/v6/txt_plain.rb +++ b/lib/sisu/v6/txt_plain.rb @@ -91,11 +91,23 @@ module SiSU_Txt_Plain            (@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],'Plaintext',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Plaintext',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Plaintext', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Plaintext', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v6/txt_rst.rb b/lib/sisu/v6/txt_rst.rb index 6bfcd139..e60d5761 100644 --- a/lib/sisu/v6/txt_rst.rb +++ b/lib/sisu/v6/txt_rst.rb @@ -90,11 +90,23 @@ module SiSU_Txt_rST            (@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],'rST (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'rST (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'rST (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'rST (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.rst.dir}/#{md.file.base_filename.rst}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v6/txt_textile.rb b/lib/sisu/v6/txt_textile.rb index 4e137b3a..00baaa1f 100644 --- a/lib/sisu/v6/txt_textile.rb +++ b/lib/sisu/v6/txt_textile.rb @@ -90,11 +90,23 @@ module SiSU_Txt_Textile            (@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],'Textile (plaintext utf-8)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Textile (plaintext utf-8)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Textile (plaintext utf-8)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Textile (plaintext utf-8)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{md.file.output_path.textile.dir}/#{md.file.base_filename.textile}" +            ).flow            end          end          ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here diff --git a/lib/sisu/v6/update.rb b/lib/sisu/v6/update.rb index 7366e471..40817138 100644 --- a/lib/sisu/v6/update.rb +++ b/lib/sisu/v6/update.rb @@ -74,7 +74,11 @@ module SiSU_UpdateControlFlag          @env=SiSU_Env::InfoEnv.new(@md.fns)          out=@env.path.output          base_path="#{out}/#{@md.fnb}" -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Checking previous output',base_path).green_hi_blue unless @md.opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          'Checking previous output', +          base_path +        ).green_hi_blue unless @md.opt.act[:quiet][:set]==:on          SetCF.new(@md).set_flags        rescue          SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do diff --git a/lib/sisu/v6/urls.rb b/lib/sisu/v6/urls.rb index 29671dca..9cc47afd 100644 --- a/lib/sisu/v6/urls.rb +++ b/lib/sisu/v6/urls.rb @@ -144,121 +144,256 @@ module SiSU_Urls      def show        def source          def src(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}" +          ).result          end          def pod(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}" +          ).result          end          self        end        def generic(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}" +        ).result        end        def meta(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}" +        ).result        end        def text(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}" +        ).result        end        def textile(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.textile.dir}/#{@md.file.base_filename.textile}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.textile.dir}/#{@md.file.base_filename.textile}" +        ).result        end        def asciidoc(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.asciidoc.dir}/#{@md.file.base_filename.asciidoc}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.asciidoc.dir}/#{@md.file.base_filename.asciidoc}" +        ).result        end        def markdown(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.markdown.dir}/#{@md.file.base_filename.markdown}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.markdown.dir}/#{@md.file.base_filename.markdown}" +        ).result        end        def rst(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.rst.dir}/#{@md.file.base_filename.rst}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.rst.dir}/#{@md.file.base_filename.rst}" +        ).result        end        def epub(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" +        ).result        end        def html          def scroll(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}" +          ).result          end          def toc(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" +          ).result          end          def concordance(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" +          ).result          end          def manifest(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +          ).result          end          self        end        def qrcode(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +        ).result        end        def odt(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" +        ).result        end        def pdf          def portrait(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf" +          ).result          end          def landscape(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf" +          ).result          end          self        end        def manpage(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" +        ).result        end        def pinfo(x,y) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -" +        ).result        end        def po4a          def po(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}" +          ).result          end          def pot(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}" +          ).result          end          self        end        def xhtml(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" +        ).result        end        def xml          def sax(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" +          ).result          end          def dom(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" +          ).result          end          def docbook_book(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}" +          ).result          end          def fictionbook(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}" +          ).result          end          def scaffold_structure_sisu(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_sisu.dir}/#{@md.file.base_filename.xml_scaffold_structure_sisu}" +          ).result          end          def scaffold_structure_collapse(x) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_collapse.dir}/#{@md.file.base_filename.xml_scaffold_structure_collapse}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.xml_scaffold_structure_collapse.dir}/#{@md.file.base_filename.xml_scaffold_structure_collapse}" +          ).result          end          def sitemap(x) #BROKEN -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}" +          ).result          end          self        end        def hash_digest(x) -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").result +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          "[#{@opt.f_pth[:lng_is]}] -#{x}", +          "#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" +        ).result        end        def db          def psql(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}", +            y +          ).result          end          def sqlite(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite", +            "sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db" +          ).result          end          def sqlite_discrete(x,y) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}").result +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "[#{@opt.f_pth[:lng_is]}] -#{x}", +            "sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}" +          ).result          end          self        end @@ -274,13 +409,21 @@ module SiSU_Urls          if x =~/^m/ \          and @opt.cmd=~/m/ \          and x=~/^[#{opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta" +          ).maintenance          end          if x=~/^([hw])/ \          and @opt.cmd=~/[hw]/ \          and x=~/^[#{@opt.cmd}]/ \          and x !~/segmented/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune" +          ).maintenance          end          if x=~/^p/ \          and @opt.cmd=~/p/ \ @@ -289,8 +432,17 @@ module SiSU_Urls            fns=@opt.fns.gsub(/~/,'-')            unless @opt.cmd =~/q/              tell=if x =~/landscape/ -              SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex") -            else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex") +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                "-#{x}", +                "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex" +              ) +            else +              SiSU_Screen::Ansi.new( +                @opt.act[:color_state][:set], +                "-#{x}", +                "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex" +              )              end              tell.maintenance            end @@ -303,25 +455,45 @@ module SiSU_Urls          if x=~/^e/ \          and @opt.cmd=~/e/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml" +          ).maintenance          end          if x=~/^o/ \          and @opt.cmd=~/o/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "-#{x}", +            "#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml" +          ).maintenance          end        end      end      def urls_select        unless @opt.cmd =~/q/ -        i1="[#{@opt.f_pth[:lng_is]}]" -        i2="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" +        i1='[' + @opt.f_pth[:lng_is] + ']' +        i2='file://' \ +        + @md.file.output_path.manifest.dir + '/' \ +        + @md.file.base_filename.manifest          (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \ -        ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URLs').green_title_hi -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URL (output manifest)',i1, i2).grey_title_grey_blue -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/ +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'URLs' +          ).green_title_hi +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'URL (output manifest)', +            i1, i2 +          ).grey_title_grey_blue +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          i1, i2, +        ).flow if @opt.cmd =~/[MVv]/        end        m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m        @pwd_stub="#{@env.url.output_tell}"[m,1] @@ -486,7 +658,11 @@ module SiSU_Urls      end      def urls_all        i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html" -      SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URLs',i).grey_title_hi +      SiSU_Screen::Ansi.new( +        @opt.act[:color_state][:set], +        'URLs', +        i +      ).grey_title_hi        @u.each do |x,y|          case x          when /^m/ diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 4e7cb6e3..6c34a55a 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -123,7 +123,9 @@ module SiSU_Utils        h      end      def message(msg='') -      @message=(msg.empty?) ? '' : " #{msg}" +      @message=(msg.nil? || msg.empty?) \ +      ? '' +      : ' ' + msg      end      def set(v=nil,x=nil)        v=var(v,x) diff --git a/lib/sisu/v6/wikispeak.rb b/lib/sisu/v6/wikispeak.rb index 43313b11..a7f00dee 100644 --- a/lib/sisu/v6/wikispeak.rb +++ b/lib/sisu/v6/wikispeak.rb @@ -86,10 +86,18 @@ module SiSU_Wikispeak          || @opt.act[:maintenance][:set]==:on) \          ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}"          : '' -        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Wikispeak',tool).green_hi_blue unless @opt.act[:quiet][:set]==:on +        SiSU_Screen::Ansi.new( +          @opt.act[:color_state][:set], +          'Wikispeak', +          tool +        ).green_hi_blue unless @opt.act[:quiet][:set]==:on          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}" +          ).flow          end          @ao_array=SiSU_AO::Source.new(@opt).get # ao file drawn here          SiSU_Wikispeak::Source::Scroll.new(@ao_array,@md).songsheet diff --git a/lib/sisu/v6/xhtml.rb b/lib/sisu/v6/xhtml.rb index 44b20198..3201834b 100644 --- a/lib/sisu/v6/xhtml.rb +++ b/lib/sisu/v6/xhtml.rb @@ -95,11 +95,23 @@ module SiSU_XHTML            (@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],'XHTML',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XHTML',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XHTML', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XHTML', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" +            ).flow            end          end          SiSU_XHTML::Source::Songsheet.new(@particulars).song @@ -428,8 +440,18 @@ WOK            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on)              unless @md.opt.act[:quiet][:set]==:on -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'Using XML Tidy', +                'check document structure' +              ).colorize +              tell=SiSU_Screen::Ansi.new( +                     @md.opt.act[:color_state][:set], +                     'invert', +                     '', +                     '' +                   )                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v6/xhtml_epub2.rb b/lib/sisu/v6/xhtml_epub2.rb index 3164e575..62cd9caa 100644 --- a/lib/sisu/v6/xhtml_epub2.rb +++ b/lib/sisu/v6/xhtml_epub2.rb @@ -100,11 +100,23 @@ module SiSU_XHTML_EPUB2            (@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],'EPUB',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'EPUB',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'EPUB', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'EPUB', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" +            ).flow            end          end          @env.processing_path.epub_bld #(@md) @@ -206,7 +218,10 @@ module SiSU_XHTML_EPUB2          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Toc' +          ).txt_grey          end          toc=nil          @@firstseg=nil @@ -587,7 +602,10 @@ module SiSU_XHTML_EPUB2          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Scroll & Segtoc' +          ).txt_grey          end          format_head_toc=SiSU_XHTML_EPUB2_Format::HeadToc.new(@md)          dochead=format_head_toc.head diff --git a/lib/sisu/v6/xhtml_epub2_concordance.rb b/lib/sisu/v6/xhtml_epub2_concordance.rb index 80dd0c1b..2fb8fb91 100644 --- a/lib/sisu/v6/xhtml_epub2_concordance.rb +++ b/lib/sisu/v6/xhtml_epub2_concordance.rb @@ -83,10 +83,16 @@ module SiSU_XHTML_EPUB2_Concordance            if @md.wc_words < wordmax              SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet            else -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              "*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})" +            ).warn unless @md.opt.act[:quiet][:set]==:on            end          else -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            "*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words" +          ).warn unless @md.opt.act[:quiet][:set]==:on            SiSU_XHTML_EPUB2_Concordance::Source::Words.new(@particulars).songsheet          end        rescue diff --git a/lib/sisu/v6/xhtml_epub2_segments.rb b/lib/sisu/v6/xhtml_epub2_segments.rb index 8b9254d4..7910a746 100644 --- a/lib/sisu/v6/xhtml_epub2_segments.rb +++ b/lib/sisu/v6/xhtml_epub2_segments.rb @@ -178,7 +178,10 @@ WOK        if (@md.opt.act[:verbose][:set]==:on \        || @md.opt.act[:verbose_plus][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on) -        SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length) +        SiSU_Screen::Ansi.new( +          @md.opt.act[:color_state][:set], +          @@seg_name.length +        )        end        SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob| diff --git a/lib/sisu/v6/xhtml_epub2_tune.rb b/lib/sisu/v6/xhtml_epub2_tune.rb index fd90ae54..9222f58b 100644 --- a/lib/sisu/v6/xhtml_epub2_tune.rb +++ b/lib/sisu/v6/xhtml_epub2_tune.rb @@ -126,7 +126,10 @@ module SiSU_XHTML_EPUB2_Tune          if (@md.opt.act[:verbose][:set]==:on \          || @md.opt.act[:verbose_plus][:set]==:on \          || @md.opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey +          SiSU_Screen::Ansi.new( +            @md.opt.act[:color_state][:set], +            'Tune' +          ).txt_grey          end          data=SiSU_XHTML_EPUB2_Tune::Tune.new(@data,@md).amp_angle_brackets          data=SiSU_XHTML_EPUB2_Tune::Tune.new(data,@md).endnotes_html diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index f105eab9..0a86b0c9 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -102,11 +102,23 @@ module SiSU_XML_Docbook_Book          (@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],'DocBook',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'DocBook',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'DocBook', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'DocBook', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.xml_docbook_book.dir}/#{@md.file.base_filename.xml_docbook_book}" +          ).flow          end        end      end diff --git a/lib/sisu/v6/xml_dom.rb b/lib/sisu/v6/xml_dom.rb index 7960e126..7532a7f8 100644 --- a/lib/sisu/v6/xml_dom.rb +++ b/lib/sisu/v6/xml_dom.rb @@ -96,11 +96,23 @@ module SiSU_XML_DOM            (@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],'XML DOM',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML DOM',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML DOM', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML DOM', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" +            ).flow            end          end          SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet @@ -545,8 +557,18 @@ WOK          if @prog.tidy !=false            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on -            tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +            SiSU_Screen::Ansi.new( +              @md.opt.act[:color_state][:set], +              'invert', +              'Using XML Tidy', +              'check document structure' +            ).colorize unless @md.opt.act[:quiet][:set]==:on +            tell=SiSU_Screen::Ansi.new( +                   @md.opt.act[:color_state][:set], +                   'invert', +                   '', +                   '' +                 )              tell.grey_open unless @md.opt.act[:quiet][:set]==:on              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy=SiSU_Env::SystemCall.new(@file,tidyfile) diff --git a/lib/sisu/v6/xml_fictionbook2.rb b/lib/sisu/v6/xml_fictionbook2.rb index 4e580b84..0029b281 100644 --- a/lib/sisu/v6/xml_fictionbook2.rb +++ b/lib/sisu/v6/xml_fictionbook2.rb @@ -99,11 +99,23 @@ module SiSU_XML_Fictionbook          (@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],'Fictionbook',tool).green_hi_blue -        : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Fictionbook',tool).green_title_hi +        ? SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Fictionbook', +            tool +          ).green_hi_blue +        : SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'Fictionbook', +            tool +          ).green_title_hi          if (@opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) -          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}").flow +          SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            @opt.fns, +            "#{@md.file.output_path.xml_fictionbook.dir}/#{@md.file.base_filename.xml_fictionbook}" +          ).flow          end        end      end diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb index 0fe880c0..e42776a2 100644 --- a/lib/sisu/v6/xml_odf_odt.rb +++ b/lib/sisu/v6/xml_odf_odt.rb @@ -96,11 +96,23 @@ module SiSU_XML_ODF_ODT            (@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],'Opendocument (ODF:ODT)',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Opendocument (ODF:ODT)',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Opendocument (ODF:ODT)', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'Opendocument (ODF:ODT)', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" +            ).flow            end          end          SiSU_XML_ODF_ODT::Source::Scroll.new(@particulars).songsheet @@ -236,7 +248,12 @@ module SiSU_XML_ODF_ODT            if FileTest.file?("#{img_src}/#{i}")              img_src            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          elsif @md.fns =~/\.ss[tm]$/ \ @@ -249,7 +266,12 @@ module SiSU_XML_ODF_ODT          and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")            @env.path.image_source_include_remote          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        end diff --git a/lib/sisu/v6/xml_sax.rb b/lib/sisu/v6/xml_sax.rb index ee369721..8e3dec22 100644 --- a/lib/sisu/v6/xml_sax.rb +++ b/lib/sisu/v6/xml_sax.rb @@ -95,11 +95,23 @@ module SiSU_XML_SAX            (@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],'XML SAX',tool).green_hi_blue -          : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML SAX',tool).green_title_hi +          ? SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML SAX', +              tool +            ).green_hi_blue +          : SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              'XML SAX', +              tool +            ).green_title_hi            if (@opt.act[:verbose_plus][:set]==:on \            || @opt.act[:maintenance][:set]==:on) -            SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow +            SiSU_Screen::Ansi.new( +              @opt.act[:color_state][:set], +              @opt.fns, +              "file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" +            ).flow            end          end          SiSU_XML_SAX::Source::Songsheet.new(@particulars).song @@ -469,8 +481,18 @@ WOK            if (@md.opt.act[:verbose_plus][:set]==:on \            || @md.opt.act[:maintenance][:set]==:on)              unless @md.opt.act[:quiet][:set]==:on -              SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') +              SiSU_Screen::Ansi.new( +                @md.opt.act[:color_state][:set], +                'invert', +                'Using XML Tidy', +                'check document structure' +              ).colorize +              tell=SiSU_Screen::Ansi.new( +                     @md.opt.act[:color_state][:set], +                     'invert', +                     '', +                     '' +                 )                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags diff --git a/lib/sisu/v6/zap.rb b/lib/sisu/v6/zap.rb index 6d200159..5e30842c 100644 --- a/lib/sisu/v6/zap.rb +++ b/lib/sisu/v6/zap.rb @@ -73,13 +73,20 @@ module SiSU_Zap        z=SiSU_Env::CleanOutput.new(@opt)        if SiSU_Env::InfoSettings.new.permission?('zap')          unless @opt.act[:quiet][:set]==:on -          tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{zap_path}") +          tell=SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            "Clean files related to processing #{@opt.cmd} ->", +            "#{@opt.fns} -> #{zap_path}" +          )            tell.warn          end          z.zap.remove_output        else          unless @opt.act[:quiet][:set]==:on -          tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'use of -Z (zap) has not enabled in sisurc.yml') +          tell=SiSU_Screen::Ansi.new( +            @opt.act[:color_state][:set], +            'use of -Z (zap) has not enabled in sisurc.yml' +          )            tell.warn          end        end  | 
