diff options
| author | Ralph Amissah <ralph@amissah.com> | 2011-04-20 21:10:04 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2011-04-20 21:10:04 -0400 | 
| commit | 0f740e9c185b6aaed05e193828545ce7664fdbec (patch) | |
| tree | d27e2672ad3a816c743ad65ac3de85e1eb237f46 /lib | |
| parent | debian/changelog (3.0.6-1) (diff) | |
| parent | v2 v3: sisu-mode.el, header notes copyright assignment to FSF (GNU EMACS) (diff) | |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
57 files changed, 1111 insertions, 631 deletions
| diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v2/cgi_pgsql.rb index 416a7d88..2cac69f6 100644 --- a/lib/sisu/v2/cgi_pgsql.rb +++ b/lib/sisu/v2/cgi_pgsql.rb @@ -172,11 +172,11 @@ module  SiSU_CGI_pgsql      def search_query1        <<-'WOK_SQL'            @search_text,@search_endnotes=[],[] -          search[:text].each{|x| @search_text << "#{x} AND " } -          @search_text=@search_text.join.gsub!(/AND\s+$/,'') #watch +          search[:text].flatten.each {|x| @search_text << "#{x} AND " } +          @search_text=@search_text.join.gsub!(/AND\s+$/m,'') #watch            @search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') -          search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') #watch +          search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'') #watch            @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')          end        WOK_SQL diff --git a/lib/sisu/v2/cgi_sqlite.rb b/lib/sisu/v2/cgi_sqlite.rb index d7e131d3..8ef65015 100644 --- a/lib/sisu/v2/cgi_sqlite.rb +++ b/lib/sisu/v2/cgi_sqlite.rb @@ -163,12 +163,12 @@ module  SiSU_CGI_sqlite      def search_query1        <<-'WOK_SQL'            @search_text,@search_endnotes=[],[] -          search[:text].each{|x| @search_text << "#{x} AND " } -          @search_text=@search_text.join.gsub!(/AND\s+$/,'') +          search[:text].flatten.each{|x| @search_text << "#{x} AND " } +          @search_text=@search_text.join.gsub!(/AND\s+$/m,'')            @search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') -          search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') -          @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +          search[:endnotes].flatten.each{|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/m,'') +          @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')          end        WOK_SQL      end diff --git a/lib/sisu/v2/options.rb b/lib/sisu/v2/options.rb index 72db8207..4997e35d 100644 --- a/lib/sisu/v2/options.rb +++ b/lib/sisu/v2/options.rb @@ -125,39 +125,39 @@ module SiSU_commandline        unless m.empty?          m.each do |m|            case m -          when /^(?:--color-toggle)$/;                       c=c+'c' -          when /^(?:--configure)$/;                          c=c+'CC' -          when /^(?:--dal?|--machine|--abstraction|--abs)$/; c=c+'m' -          when /^(?:--txt|--text|--plaintext)$/;             c=c+'t' -          when /^(?:--html)$/;                               c=c+'h' -          when /^(?:--epub)$/;                               c=c+'e' -          when /^(?:--od[ft])$/;                             c=c+'o' -          when /^(?:--pdf)$/;                                c=c+'p' -          when /^(?:--concordance|--wordmap)$/;              c=c+'w' -          when /^(?:--manpage)$/;                            c=c+'i' -          when /^(?:--texinfo)$/;                            c=c+'I' -          when /^(?:--xhtml)$/;                              c=c+'b' -          when /^(?:--xml-sax)$/;                            c=c+'x' -          when /^(?:--xml-dom)$/;                            c=c+'X' -          when /^(?:--digest)$/;                             c=c+'N' -          when /^(?:--termsheet)$/;                          c=c+'T' -          when /^(?:--manifest)$/;                           c=c+'y' -          when /^(?:--sqlite)$/;                             c=c+'d' -          when /^(?:--pg|--pg?sql|--postgresql)$/;           c=c+'D' -          when /^(?:--remote|--rsync)$/;                     c=c+'R' -          when /^(?:--scp)$/;                                c=c+'r' -          when /^(?:--source)$/;                             c=c+'s' -          when /^(?:--sisupod|--pod)$/;                      c=c+'S' -          when /^(?:--git)$/;                                c=c+'g' -          when /^(?:--urls)$/;                               c=c+'U' -          when /^(?:--zap|--delete)$/;                       c=c+'Z' -          when /^(?:--sample-search-form)$/;                 c=c+'F' -          when /^(?:--webserv|--webrick)$/;                  c=c+'W' -          when /^(?:--maintenance)$/;                        c=c+'M' -          when /^(?:--verbose[=-]3)$/;                       c=c+'VM' -          when /^(?:--verbose[=-]2|--Verbose|--VERBOSE)$/;   c=c+'V' -          when /^(?:--verbose(?:[=-]1)?)$/;                  c=c+'v' -          when /^(?:--verbose[=-]0|--quiet|--silent)$/;      c=c+'q' +          when /^--(?:color-toggle)$/;                       c=c+'c' +          when /^--(?:configure)$/;                          c=c+'CC' +          when /^--(?:dal?|machine|abstraction|abs)$/;       c=c+'m' +          when /^--(?:txt|text|plaintext)$/;                 c=c+'t' +          when /^--(?:html)$/;                               c=c+'h' +          when /^--(?:epub)$/;                               c=c+'e' +          when /^--(?:od[ft])$/;                             c=c+'o' +          when /^--(?:pdf)$/;                                c=c+'p' +          when /^--(?:concordance|wordmap)$/;                c=c+'w' +          when /^--(?:manpage)$/;                            c=c+'i' +          when /^--(?:texinfo)$/;                            c=c+'I' +          when /^--(?:xhtml)$/;                              c=c+'b' +          when /^--(?:xml-sax)$/;                            c=c+'x' +          when /^--(?:xml-dom)$/;                            c=c+'X' +          when /^--(?:digest)$/;                             c=c+'N' +          when /^--(?:termsheet)$/;                          c=c+'T' +          when /^--(?:manifest)$/;                           c=c+'y' +          when /^--(?:sqlite)$/;                             c=c+'d' +          when /^--(?:pg|pg?sql|postgresql)$/;               c=c+'D' +          when /^--(?:remote|rsync)$/;                       c=c+'R' +          when /^--(?:scp)$/;                                c=c+'r' +          when /^--(?:source)$/;                             c=c+'s' +          when /^--(?:sisupod|pod)$/;                        c=c+'S' +          when /^--(?:git)$/;                                c=c+'g' +          when /^--(?:urls)$/;                               c=c+'U' +          when /^--(?:zap|delete)$/;                         c=c+'Z' +          when /^--(?:sample-search-form)$/;                 c=c+'F' +          when /^--(?:webserv|webrick)$/;                    c=c+'W' +          when /^--(?:maintenance|keep-processing-files)$/;  c=c+'M' +          when /^--(?:verbose[=-]3)$/;                       c=c+'VM' +          when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/;       c=c+'V' +          when /^--(?:verbose(?:[=-]1)?)$/;                  c=c+'v' +          when /^--(?:verbose[=-]0|quiet|silent)$/;          c=c+'q'            else @mod << m            end          end diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index 3821f402..48211068 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -171,12 +171,12 @@ module  SiSU_CGI_pgsql      end      def search_query1        <<-'WOK_SQL' -          @search_text,@search_endnotes=[],[] -          search[:text].each {|x| @search_text << "#{x} AND " } -          @search_text=@search_text.join.gsub!(/AND\s+$/,'') #watch +          @search_text,@search_endnotes='','' +          search[:text].flatten.each {|x| @search_text << "#{x} AND " } +          @search_text=@search_text.gsub!(/AND\s+$/m,'') #watch            @search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') -          search[:endnotes].each {|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') #watch +          search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') #watch            @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')          end        WOK_SQL diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 0ca9dca2..924b1533 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -299,9 +299,9 @@ module SiSU_CGI_sql          end          def text_to_match(identifier='')            m={ -            :string => /#{identifier}\s*(.+?)/, -            :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/, -            :word => /#{identifier}[\s(]*(\S+)/ +            string: /#{identifier}\s*(.+?)/, +            string: /#{identifier}\s*(.+?)(?:;|\n|\r|$)/, +            word: /#{identifier}[\s(]*(\S+)/            }            search_string=if @search_field =~m[:word]              search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1] @@ -328,10 +328,10 @@ module SiSU_CGI_sql          def initialize(conn,search_for,q,c)            @conn=conn            @text_search_flag=false -          @sql_statement={ :body=>'',:endnotes=>'',:range=>'' } +          @sql_statement={ body: '', endnotes: '',range: '' }            #@offset||=@@offset            #@offset+=@@limit -          search={ :text => [],:endnotes => [] } +          search={ text: [], endnotes: [] }            cse=(c =~/\S/) ? true : false            st=Dbi_search_string.new('doc_objects.clean',search_for.text1,q['s1'],cse).string            se=Dbi_search_string.new('endnotes.clean',search_for.text1,q['s1'],cse).string @@ -645,7 +645,7 @@ module SiSU_CGI_sql        @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''        FCGI.each_cgi do |cgi|          begin # all code goes in begin section -          @search={ :text => [],:endnotes => [] } +          @search={ text: [], endnotes: [] }            q=CGI.new            @db=if cgi['db'] =~/\S+/;              @stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1] @@ -656,13 +656,13 @@ module SiSU_CGI_sql            end            checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''            result_type=(cgi['view']=~/text/) \ -          ? result_type={:index=>'',:text=>'checked'} \ -          : result_type={:index=>'checked',:text=>''} +          ? result_type={ index: '', text: 'checked'} \ +          : result_type={ index: 'checked', text: ''}            @@limit=if cgi['sql_match_limit'].to_s=~/2500/ -            checked_sql_limit={:l1000=>'',:l2500=>'checked'} +            checked_sql_limit={ l1000: '', l2500: 'checked'}              '2500'            else -            checked_sql_limit={:l1000=>'checked',:l2500=>''} +            checked_sql_limit={ l1000: 'checked', l2500: ''}              '1000'            end            checked_echo='checked' if cgi['echo'] =~/\S/ diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index 7251c81a..5a415b0d 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -162,13 +162,13 @@ module  SiSU_CGI_sqlite      end      def search_query1        <<-'WOK_SQL' -          @search_text,@search_endnotes=[],[] -          search[:text].each {|x| @search_text << "#{x} AND " } -          @search_text=@search_text.join.gsub!(/AND\s+$/,'') +          @search_text,@search_endnotes='','' +          search[:text].flatten.each {|x| @search_text << "#{x} AND " } +          @search_text=@search_text.gsub!(/AND\s+$/m,'')            @search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') -          search[:endnotes].each {|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') -          @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +          search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } +          @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') +          @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')          end        WOK_SQL      end diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index d979a6c9..8b70fdc5 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -76,24 +76,24 @@ module SiSU_Concordance        begin          @env,@md=@particulars.env,@particulars.md          loc=@env.url.output_tell -        unless @md.cmd =~/q/ -          tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : @md.fns -          @md.cmd=~/[MVvz]/ \ -          ? SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi \ -          : SiSU_Screen::Ansi.new(@md.cmd,'Concordance',tool).green_title_hi +        unless @md.opt.cmd =~/q/ +          tool=(@md.opt.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : @md.fns +          @md.opt.cmd=~/[MVvz]/ \ +          ? SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi \ +          : SiSU_Screen::Ansi.new(@md.opt.cmd,'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.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/ +            SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/            end          else -          SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/            SiSU_Concordance::Source::Words.new(@particulars).songsheet          end -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end @@ -197,7 +197,7 @@ WOK            @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#{@dp}|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!            @rgx_splitlist=%r{[—.,;:#{Mx[:nbsp]}-]}mi            @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|\w+|[a-zA-Z]+}mi -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end        def songsheet @@ -205,7 +205,7 @@ WOK            mkdir_p(@file.output_path.html_concordance) unless FileTest.directory?(@file.output_path.html_concordance)            @file_concordance=File.open(@file.place_file.html_concordance,'w')            map_para -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure            @file_concordance.close          end @@ -337,7 +337,7 @@ WOK          end          credits=@vz.credits_sisu          @file_concordance << %{</div></body>\n</html>} # footer -        SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}").flow if @md.cmd =~/[MV]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}").flow if @md.opt.cmd =~/[MV]/        end      end    end diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index 13414826..a25f0f99 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -379,7 +379,7 @@ module SiSU_DAL        end      end      def hard_output -      if @md.cmd =~/M/ +      if @md.opt.cmd =~/M/          filename_meta=@cf.metaverse.file_meta          @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier          filename_txt=@cf.metaverse.file_txt @@ -426,7 +426,7 @@ module SiSU_DAL      end      def idx_html_hard_output        if @md.book_idx \ -      and @md.cmd =~/M/ +      and @md.opt.cmd =~/M/          filename_meta=@cf.file_meta_idx_html          unless @data.nil? #REMOVE earliest possible            @data.each {|s| p s.inspect + "\n" unless s.class==String} @@ -485,7 +485,7 @@ module SiSU_DAL        data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_idx  # dal_idx.rb        data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes                                                # dal_endnotes.rb        outputdata=data -      if @md.cmd =~/[mM]/ +      if @md.opt.cmd =~/[mM]/          SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output          SiSU_DAL::Output.new(@fn,@md,outputdata).make_marshal_content          SiSU_DAL::Output.new(@fn,@md,metadata).make_marshal_metadata diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index 09635066..61348d28 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -948,7 +948,7 @@ module SiSU_document_structure_extract        hs=[0,false,false,false]        t={ lv: @s[0], status: 'open' }        tuned_file << tags(t) -      if @md.cmd =~/V/ +      if @md.opt.cmd =~/V/          puts "\nXML sisu structure outline --->\n"          puts "<#{@s[0]}>"        end @@ -958,7 +958,7 @@ module SiSU_document_structure_extract            when 1              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -966,7 +966,7 @@ module SiSU_document_structure_extract            when 2              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -974,7 +974,7 @@ module SiSU_document_structure_extract            when 3              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -982,7 +982,7 @@ module SiSU_document_structure_extract            when 4              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -990,7 +990,7 @@ module SiSU_document_structure_extract            when 5              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -998,7 +998,7 @@ module SiSU_document_structure_extract            when 6              tuned_file << tag_close(o.ln,hs)              tuned_file << tag_open(o,@s) -            if @md.cmd =~/V/ +            if @md.opt.cmd =~/V/                puts_tag_close(o.ln,hs)                puts_tag_open(o,@s)              end @@ -1007,7 +1007,7 @@ module SiSU_document_structure_extract          end          tuned_file << o        end -      puts_tag_close(0,hs) if @md.cmd =~/V/ +      puts_tag_close(0,hs) if @md.opt.cmd =~/V/        tuned_file << tag_close(0,hs)        tuned_file.flatten!        tuned_file diff --git a/lib/sisu/v3/dal_endnotes.rb b/lib/sisu/v3/dal_endnotes.rb index e0b4a57d..58ac8d0c 100644 --- a/lib/sisu/v3/dal_endnotes.rb +++ b/lib/sisu/v3/dal_endnotes.rb @@ -68,10 +68,10 @@ module SiSU_endnotes        endnote_no,endnote_ref=1,1        data.each do |dob|                                                                                 # manually numbered endnotes <!e(\d)!> <!e_(\d)!> --> -        if @md.mod.inspect =~/--no-asterisk|--no-annotate/ +        if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/            dob.obj.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')          end -        if @md.mod.inspect =~/--no-dagger|--no-annotate/ +        if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/            dob.obj.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')          end          if defined? dob.obj \ diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb index dd2b1331..ad1b5efb 100644 --- a/lib/sisu/v3/dal_idx.rb +++ b/lib/sisu/v3/dal_idx.rb @@ -216,7 +216,7 @@ module SiSU_book_index              @t=idx[:sst_rel].index(idx[:sst_rel].last)              @q=idx[:html].index(idx[:html].last)              @r=idx[:xhtml].index(idx[:xhtml].last) -            print "\n" + x + ', ' if @md.cmd =~/V/ +            print "\n" + x + ', ' if @md.opt.cmd =~/V/            elsif x.class==Array              p 'array error? -->'              print x @@ -228,13 +228,13 @@ module SiSU_book_index                    idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }                    idx[:html][@q]=idx[:html][@q] + %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:range]}</a>, }                    idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, } -                  print a[:range] + ', ' if @md.cmd =~/V/ +                  print a[:range] + ', ' if @md.opt.cmd =~/V/                  elsif a[:ocn]                    idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }                    idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }                    idx[:html][@q]=idx[:html][@q] + %{<a href="#{a[:seg]}.html##{a[:ocn]}">#{a[:ocn]}</a>, }                    idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, } -                  print a[:ocn] + ', ' if @md.cmd =~/V/ +                  print a[:ocn] + ', ' if @md.opt.cmd =~/V/                  else p 'error'                  end                end @@ -251,20 +251,20 @@ module SiSU_book_index                    idx[:html][@q]=idx[:html][@q] + %{\n<p class="book_index_lev2">#{k}, }                    c=clean_xml(k.dup)                    idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n<p class="book_index_lev2">#{c}, } -                  print "\n\t" + k + ', ' if @md.cmd =~/V/ +                  print "\n\t" + k + ', ' if @md.opt.cmd =~/V/                    y.each do |z|                      if z[:range]                        idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }                        idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }                        idx[:html][@q]=idx[:html][@q] + %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:range]}</a>, }                        idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, } -                      print z[:range] + ', ' if @md.cmd =~/V/ +                      print z[:range] + ', ' if @md.opt.cmd =~/V/                      elsif z[:ocn]                        idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, }                        idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, }                        idx[:html][@q]=idx[:html][@q] + %{<a href="#{z[:seg]}.html##{z[:ocn]}">#{z[:ocn]}</a>, }                        idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, } -                      print z[:ocn] + ', ' if @md.cmd =~/V/ +                      print z[:ocn] + ', ' if @md.opt.cmd =~/V/                      else p 'error'                      end                    end @@ -278,7 +278,7 @@ module SiSU_book_index            end          end        end -      print "\n" if @md.cmd =~/V/ +      print "\n" if @md.opt.cmd =~/V/        idx      end      def screen_print(the_idx) diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb index 8c7e9f94..c2088874 100644 --- a/lib/sisu/v3/dal_images.rb +++ b/lib/sisu/v3/dal_images.rb @@ -75,8 +75,8 @@ module SiSU_images            @rmgk=false          end        else -        if @md.cmd =~/[vVM]/ -          SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml').warn +        if @md.opt.cmd =~/[vVM]/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,'use of RMagick is not enabled in sisurc.yml').warn          end        end        data.each do |dob| @@ -101,8 +101,8 @@ module SiSU_images                        img=Magick::ImageList.new("#{image_path}/#{image}")                        img_col,img_row=img.columns,img.rows                      else -                      if @md.cmd =~/[vVM]/ -                        SiSU_Screen::Ansi.new(@md.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn +                      if @md.opt.cmd =~/[vVM]/ +                        SiSU_Screen::Ansi.new(@md.opt.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn                        end                        imgk=SiSU_Env::System_call.new.imagemagick                        gmgk=SiSU_Env::System_call.new.graphicksmagick @@ -139,7 +139,7 @@ module SiSU_images                  end                else                  images=dob.obj.scan(m) do |image| -                  SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ +                  SiSU_Screen::Ansi.new(@md.opt.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/                  end                end              end diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb index 7a0c4365..0a49c3da 100644 --- a/lib/sisu/v3/dal_numbering.rb +++ b/lib/sisu/v3/dal_numbering.rb @@ -282,7 +282,7 @@ module SiSU_numbering        tags={}        art_filename_auto=1        @counter=1 -      if not @md.seg_autoname_safe and @md.cmd =~/[MV]/ +      if not @md.seg_autoname_safe and @md.opt.cmd =~/[MV]/          puts 'manual segment names, numbers used as names, risk warning (segmented html)'        end        ocn_html_seg=[] @@ -305,7 +305,7 @@ module SiSU_numbering                dob.name=possible_seg_name                dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/                @md.seg_names << possible_seg_name -            else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/ +            else puts 'warn, there may be a conflicting numbering scheme' if @md.opt.cmd =~/[VM]/              end            end            if dob.ln==4 \ @@ -399,7 +399,7 @@ module SiSU_numbering      end      def set_heading_top(data)                                                          #% make sure no false positives        unless @md.set_heading_top -        puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          @tuned_file=[]          data.each do |t_o|            unless @md.set_heading_top @@ -423,7 +423,7 @@ module SiSU_numbering      end      def set_heading_seg(data)                                                          #% make sure no false positives        unless @md.set_heading_seg -        puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          @tuned_file=[]          data.each do |dob|            unless @md.set_heading_seg @@ -444,7 +444,7 @@ module SiSU_numbering      end      def set_header_title(data)                                                         #% make sure no false positives        unless @md.set_header_title -        puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          @tuned_file=[]          data.each do |t_o|            unless @md.set_header_title diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb index 268463e2..8b669b12 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v3/db_columns.rb @@ -64,8 +64,8 @@ module SiSU_DB_columns      def initialize(md=nil)        @md=md        @db=SiSU_Env::Info_db.new #watch -      if defined? md.mod \ -      and md.mod.inspect=~/import|update/ \ +      if defined? md.opt.mod \ +      and md.opt.mod.inspect=~/import|update/ \        and FileTest.exist?(md.fns)          txt_arr=IO.readlines(md.fns,'')          src=txt_arr.join("\n") @@ -1928,7 +1928,7 @@ module SiSU_DB_columns             IS 'sisu markup source text (if shared)';}          end          def tuple -          t=if @md.mod.inspect=~/import|update/ \ +          t=if @md.opt.mod.inspect=~/import|update/ \            and FileTest.exist?(@md.fns)              ["#{name}, ","'#{@sisutxt}', "]            else ['',''] @@ -1954,7 +1954,7 @@ module SiSU_DB_columns              IS 'document full text clean, searchable';}          end          def tuple -          t=if @md.mod.inspect=~/import|update/ \ +          t=if @md.opt.mod.inspect=~/import|update/ \            and  FileTest.exist?(@md.fns)              ["#{name}, ","'#{@fulltext}', "]            else ['',''] diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb index 183f8fc4..b8408f22 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v3/db_load_tuple.rb @@ -116,7 +116,7 @@ module SiSU_DB_tuple    end    class Load_metadata #< SiSU_DB_columns::Columns      def initialize(conn,id,md,file) -      @conn,@id,@opt,@file=conn,id,md,file +      @conn,@id,@md,@file=conn,id,md,file        @tp=SiSU_DB_columns::Columns.new(md)      end      def tuple @@ -288,11 +288,11 @@ tid)  #{@tp.column.links.tuple[1]}  #{@id}  );" -      if @opt.cmd =~/M/ +      if @md.opt.cmd =~/M/          puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file.inspect}"          @file.puts sql_entry        else -        @file.puts sql_entry if @opt.cmd =~/V/ +        @file.puts sql_entry if @md.opt.cmd =~/V/        end        sql_entry      end diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v3/db_sqltxt.rb index c5a2b79c..f4acb2c5 100644 --- a/lib/sisu/v3/db_sqltxt.rb +++ b/lib/sisu/v3/db_sqltxt.rb @@ -83,14 +83,14 @@ module SiSU_DB_text            and not @md.creator.author.empty?              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.cmd.inspect =~/q/ +            SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/            end            if defined? @md.title \            and defined? @md.title.full \            and not @md.title.full.empty?              s.gsub!(/@title/,@md.title.full)            else -            SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.cmd.inspect =~/q/ +            SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/            end          end          s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'') diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index 3d35fbd7..e11ac945 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -114,23 +114,23 @@ module SiSU_Digest_view          output        end        def description(f,e='') -        puts f + e.to_s if @md.cmd =~/V/ +        puts f + e.to_s if @md.opt.cmd =~/V/          @@description << f << e        end        def digests(f,e='') -        puts f if @md.cmd =~/V/ +        puts f if @md.opt.cmd =~/V/          @@ds[:digests] << f + "\n"        end        def dal_structure_tree(f,e='') -        puts f + e.to_s if @md.cmd =~/V/ +        puts f + e.to_s if @md.opt.cmd =~/V/          @@ds[:tree] << f << e        end        def dal_structure_summary(f,e='') -        puts f + e.to_s if @md.cmd =~/V/ +        puts f + e.to_s if @md.opt.cmd =~/V/          @@ds[:summary] << f << e        end        def rcinfo(f,e='') -        puts f + e.to_s if @md.cmd =~/V/ +        puts f + e.to_s if @md.opt.cmd =~/V/          @@sc_info << f << e        end        def output @@ -198,7 +198,7 @@ module SiSU_Digest_view                      elsif FileTest.file?("#{@env.path.image_source_include}/#{i}")                        @env.path.image_source_include                      else -                      SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +                      SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/                        nil                      end                      @img << /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index 29a71f6b..f60ed85f 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -87,13 +87,13 @@ module SiSU_Embedded        ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"        @rhost.each do |remote_conn|          rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" -        if @md.cmd.inspect =~/[vVMR]/ \ +        if @md.opt.cmd.inspect =~/[vVMR]/ \          and FileTest.directory?(src)            mkdir_p(ldest) unless FileTest.directory?(ldest)            src_ec="#{src}/" + @md.ec[:image].join(" #{src}/")            unless @opt.fns =~/\.-sst$/              SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync -            if @md.cmd.inspect =~/R/ #rsync to remote image directory +            if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory                SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync              end            end @@ -106,12 +106,12 @@ module SiSU_Embedded        ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio"        @rhost.each do |remote_conn|          rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" -        if @md.cmd.inspect =~/[vVMR]/ \ +        if @md.opt.cmd.inspect =~/[vVMR]/ \          and FileTest.directory?(src)            mkdir_p(ldest) unless FileTest.directory?(ldest)            src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/")            SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync -          if @md.cmd.inspect =~/R/ #rsync to remote audio directory +          if @md.opt.cmd.inspect =~/R/ #rsync to remote audio directory              SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync            end          end @@ -123,12 +123,12 @@ module SiSU_Embedded        ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video"        @rhost.each do |remote_conn|          rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" -        if @md.cmd.inspect =~/[vVMR]/ \ +        if @md.opt.cmd.inspect =~/[vVMR]/ \          and FileTest.directory?(src)            mkdir_p(ldest) unless FileTest.directory?(ldest)            src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/")            SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync -          if @md.cmd.inspect =~/R/ #rsync to remote video directory +          if @md.opt.cmd.inspect =~/R/ #rsync to remote video directory              SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync            end          end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index b76beb17..8b2b2d1d 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -141,9 +141,9 @@ module SiSU_EPUB          SiSU_Env::SiSU_file.new(@md).mkdir.output.epub        end        def tuned_file_instructions -        @tell=SiSU_Screen::Ansi.new(@md.cmd) -        @md.cmd=@md.cmd.gsub(/H/,'h') -        @md.file_type='html' if @md.cmd =~/[hon]/ +        @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) +        @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') +        @md.file_type='html' if @md.opt.cmd =~/[hon]/          directories          dal_array=@particulars.dal_array # dal file drawn here          @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet @@ -191,10 +191,10 @@ module SiSU_EPUB          @md,@data=md,data          @vz=SiSU_Env::Get_init.instance.skin          @epub=SiSU_EPUB_Format::Head_information.new(@md) -        @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md +        @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md        end        def songsheet #extracts toc for scroll & seg -        SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/          toc=nil          @@firstseg=nil          @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] } @@ -272,7 +272,7 @@ module SiSU_EPUB                  @@toc[:seg] << toc[:seg]                  @@toc[:scr] << toc[:seg]                  @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] -              rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +              rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error                end              end            end @@ -490,7 +490,7 @@ module SiSU_EPUB        def in_common          toc_shared=[]          segtoc=[] -        SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/          format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md)          dochead=format_head_toc.head          dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge @@ -611,7 +611,7 @@ module SiSU_EPUB              end            end            out.close -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end        def epub_metadata_opf @@ -623,7 +623,7 @@ module SiSU_EPUB              end            end            out.close -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end        def images @@ -646,7 +646,7 @@ module SiSU_EPUB            mv #{@epub_doc} #{@md.file.place_file.epub}            cd #{Dir.pwd}          ") -        unless @md.cmd.inspect =~/M/ +        unless @md.opt.cmd.inspect =~/M/            system("rm -r #{@md.env.processing_path.epub}")          end        end @@ -663,7 +663,7 @@ module SiSU_EPUB            end            filename_html_segtoc.close            filename_html_index.close -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end      end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index e03034dc..205f4f22 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -75,20 +75,20 @@ module SiSU_EPUB_Concordance        begin          @env,@md=@particulars.env,@particulars.md          loc=@env.url.output_tell -        tool=((@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '') -        SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi unless @md.cmd =~/q/ +        tool=((@md.opt.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '') +        SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi unless @md.opt.cmd =~/q/          wordmax=@env.concord_max          unless @md.wc_words.nil?            if @md.wc_words < wordmax              SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet            else -            SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.cmd =~/q/ +            SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/            end          else -          SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/            SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet          end -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end @@ -170,14 +170,14 @@ WOK            @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!            @rgx_splitlist=%r{[—.,;:-]+|#{Mx[:nbsp]}+}mi            @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|#{Mx[:url_o]}https?://\S+?#{Mx[:url_c]}|file://\S+|<\S+?>|\w+|[a-zA-Z]+}mi -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end        def songsheet          begin            @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w')            map_para -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure            @file_concordance.close          end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 519ba16b..5af5c0b4 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -71,7 +71,7 @@ module SiSU_EPUB_Format      end      def ocn_display        if @md.markup.inspect =~/no_ocn/ \ -      or @md.mod.inspect =~/--no-ocn/ \ +      or @md.opt.mod.inspect =~/--no-ocn/ \        or @skin_no_ocn          ocn_class='ocn_off'          @ocn.gsub(/^(\d+|)$/, @@ -1598,7 +1598,7 @@ WOK          @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil)          @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil)        else -        if @md.cmd =~/M/ +        if @md.opt.cmd =~/M/            p __FILE__ +':'+ __LINE__.to_s            p t_o.class            p caller diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index c06f11f2..a21a64a7 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -151,7 +151,7 @@ WOK          data=articles(data)          Seg.new.cleanup # (((( added ))))          #### (((( END )))) #### -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure          @@seg_name=[]        end @@ -177,7 +177,7 @@ WOK        @@seg_name_xhtml=@@seg_name        @@seg_total=@@seg_name.length        testforartnum=@@seg_name_xhtml -      SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) if @md.cmd =~/[MVv]/ +      SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length) if @md.opt.cmd =~/[MVv]/        map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob|          #if defined? dob.obj \ diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index 19453fc8..d691361b 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -77,7 +77,7 @@ module SiSU_EPUB_Tune      def initialize(data,md)        @data,@md=data,md        @file=SiSU_Env::SiSU_file.new(@md) -      @cX=SiSU_Screen::Ansi.new(@md.cmd).cX +      @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX      end      def hard_output        @filename_tune=@file.write_file_processing.html_tune @@ -206,18 +206,18 @@ module SiSU_EPUB_Tune      end      def songsheet        begin -        @cX=SiSU_Screen::Ansi.new(@md.cmd).cX -        SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ +        @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/          data=Tune.new(@data,@md).amp_html          data=Tune.new(data,@md).endnotes_html          data=Tune.new(data,@md).url_markup          data=Tune.new(data,@md).markup -        if @md.cmd =~/M/  #Hard Output Tune Optional on/off here +        if @md.opt.cmd =~/M/  #Hard Output Tune Optional on/off here            data=Output.new(data,@md).hard_output            Output.new(data,@md).marshal          end          tuned=Tune.new(@data,@md).output -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end diff --git a/lib/sisu/v3/harvest.rb b/lib/sisu/v3/harvest.rb index 117028e2..aaec9046 100644 --- a/lib/sisu/v3/harvest.rb +++ b/lib/sisu/v3/harvest.rb @@ -96,6 +96,7 @@ require_relative 'sysenv'                               # sysenv.rb  argv=$*  opt=SiSU_commandline::Options.new(argv)  argv.shift -mkdir_p(@env.path.output_md_harvest) unless FileTest.directory?(@env.path.output_md_harvest) +harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" +mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth)  cases(opt)  __END__ diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb index dc36a06f..75d2a810 100644 --- a/lib/sisu/v3/harvest_authors.rb +++ b/lib/sisu/v3/harvest_authors.rb @@ -89,7 +89,8 @@ module HARVEST_authors        end        the_idx=HARVEST_authors::Index.new(idx_array,@@the_idx_authors).construct_book_author_index        HARVEST_authors::Output_index.new(@opt,the_idx).html_print.html_songsheet -      puts "file://#{@env.path.output_md_harvest}/harvest_authors.html" +      harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" +      puts "file://#{harvest_pth}/harvest_authors.html"        puts "file://#{@env.path.pwd}/harvest_authors.html" if @opt.cmd.inspect =~/M/      end    end @@ -174,7 +175,8 @@ module HARVEST_authors      end      def html_file_open        @output={} -      @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_authors.html",'w') +      harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" +      @output[:html]=File.new("#{harvest_pth}/harvest_authors.html",'w')        @output[:html_mnt]=(@opt.cmd.inspect =~/M/) \        ? File.new("#{@env.path.pwd}/harvest_authors.html",'w') \        : nil @@ -193,9 +195,19 @@ module HARVEST_authors          html_file_close        end        def html_head_adjust(type='') -        css_path=(type !~/maintenance/) \ -        ? '../_sisu/css/harvest.css' \ -        : 'harvest.css' +        css_path=if @env.output_dir_structure.by_language_code? +          css_path=(type !~/maintenance/) \ +          ? '../../_sisu/css/harvest.css' \ +          : 'harvest.css' +        elsif @env.output_dir_structure.by_filetype? +          css_path=(type !~/maintenance/) \ +          ? '../_sisu/css/harvest.css' \ +          : 'harvest.css' +        elsif @env.output_dir_structure.by_filename? +          css_path=(type !~/maintenance/) \ +          ? '../_sisu/css/harvest.css' \ +          : 'harvest.css' +        end          sv=SiSU_Env::Info_version.instance.get_version          <<WOK  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" @@ -286,9 +298,22 @@ WOK            @output[:html] << x            works=[]            a[1][:md].each do |x| -            work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ] +            if @env.output_dir_structure.by_language_code? +              manifest_pth="#{@env.path.output}/#{x[:file]}" +              manifest_at_local=@env.path.output + '/' + 'en' + '/' + 'manifest/'  +  x[:file] + '.manifest.html' +              manifest_at=x[:file] + '.manifest.html' +            elsif @env.output_dir_structure.by_filetype? +              #manifest_pth_2="#{@env.path.output}/#{x[:file]}" +              manifest_name=x[:file] +              manifest_at_local=manifest_name + 'manifest.html' +              manifest_at=x[:file] + '.manifest.html' +            elsif @env.output_dir_structure.by_filename? +              manifest_at_local="#{@env.path.output}/#{x[:file]}/#{x[:page]}" +              manifest_at="../#{x[:file]}/#{x[:page]}" +            end +            work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]              works<<=(@output[:html_mnt].class==File) \ -            ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]  #{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \ +            ? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]  #{x[:date]} <a href="file://#{manifest_at_local}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}])) \              : work            end            works.sort_by {|x| x[0]}.each do |x| diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb index f00fb7f3..3ca72326 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v3/harvest_topics.rb @@ -90,7 +90,8 @@ module HARVEST_topics        the_idx=HARVEST_topics::Index.new(idx_array,@@the_idx_topics).construct_book_topic_index        #HARVEST_topics::Output_index.new('',the_idx).screen_print.cycle if @opt.cmd.inspect =~/[VM]/        HARVEST_topics::Output_index.new(@opt,the_idx).html_print.html_songsheet -      puts "file://#{@env.path.output_md_harvest}/harvest_topics.html" +      harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" +      puts "file://#{harvest_pth}/harvest_topics.html"        puts "file://#{@env.path.pwd}/harvest_topics.html" if @opt.cmd.inspect =~/M/      end    end @@ -258,7 +259,8 @@ module HARVEST_topics      end      def html_file_open        @output={} -      @output[:html]=File.new("#{@env.path.output_md_harvest}/harvest_topics.html",'w') +      harvest_pth="#{@env.path.webserv}/#{@env.stub_md_harvest}" +      @output[:html]=File.new("#{harvest_pth}/harvest_topics.html",'w')        if @opt.cmd.inspect =~/-M/          @output[:html_mnt]=File.new("#{@env.path.pwd}/harvest_topics.html",'w')        end @@ -277,9 +279,19 @@ module HARVEST_topics          html_file_close        end        def html_head_adjust(type='') -        css_path=(type !~/maintenance/) \ -        ? '../_sisu/css/harvest.css' \ -        : 'harvest.css' +        css_path=if @env.output_dir_structure.by_language_code? +          css_path=(type !~/maintenance/) \ +          ? '../../_sisu/css/harvest.css' \ +          : 'harvest.css' +        elsif @env.output_dir_structure.by_filetype? +          css_path=(type !~/maintenance/) \ +          ? '../_sisu/css/harvest.css' \ +          : 'harvest.css' +        elsif @env.output_dir_structure.by_filename? +          css_path=(type !~/maintenance/) \ +          ? '../_sisu/css/harvest.css' \ +          : 'harvest.css' +        end          sv=SiSU_Env::Info_version.instance.get_version          <<WOK  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" @@ -382,7 +394,14 @@ WOK          end        end        def do_hash_md(attrib,hash) -        html=%{<a href="../#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}} +        if @env.output_dir_structure.by_language_code? +          manifest_at=hash[:file] + '.manifest.html' +        elsif @env.output_dir_structure.by_filetype? +          manifest_at=hash[:file] + '.manifest.html' +        elsif @env.output_dir_structure.by_filename? +          manifest_at="../#{hash[:file]}/#{hash[:page]}" +        end +        html=%{<a href="#{manifest_at}">#{hash[:title]}</a> - #{hash[:author]}}          do_string_default(attrib,html)        end        def do_hash_md_maintenance(attrib,hash) diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 47988cba..5c044594 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -142,9 +142,9 @@ module SiSU_HTML          title=File.basename(@md.fns,'.rb')        end        def tuned_file_instructions -        @tell=SiSU_Screen::Ansi.new(@md.cmd) -        @md.cmd=@md.cmd.gsub(/H/,'h') -        @md.file_type='html' if @md.cmd =~/[hon]/ +        @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) +        @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') +        @md.file_type='html' if @md.opt.cmd =~/[hon]/          directories          newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/          dal_array=@particulars.dal_array # dal file drawn here @@ -156,7 +156,7 @@ module SiSU_HTML        @links_guide_toc=[]        def initialize(data,md)          @data,@md=data,md -        @links_guide_=SiSU_Env::Create_site.new(@md.cmd).html_quick_ref? +        @links_guide_=SiSU_Env::Create_site.new(@md.opt.cmd).html_quick_ref?        end        def toc          @links_guide_toc=[] @@ -225,10 +225,10 @@ module SiSU_HTML        def initialize(md=nil,data='')          @data,@md=data,md          @vz=SiSU_Env::Get_init.instance.skin -        @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md +        @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md        end        def songsheet #extracts toc for scroll & seg -        SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/          toc=nil          @@firstseg=nil          @@toc={ seg: [], seg_mini: [], scr: [] } @@ -261,7 +261,7 @@ module SiSU_HTML                  @@toc[:seg] << toc[:seg] if toc[:seg]                  @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini]                  @@toc[:scr] << toc[:scr] if toc[:scr] -              rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +              rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error                end              end            end @@ -518,7 +518,7 @@ WOK        def in_common          toc_shared=[]          @segtoc=[] -        SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/          format_head_toc=SiSU_HTML_Format::Head_toc.new(@md)          dochead=format_head_toc.head          dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge @@ -627,7 +627,7 @@ WOK                @filename_html_scroll.puts para,"\n"              end            end -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end        def segtoc @@ -644,7 +644,7 @@ WOK                @filename_html_index.puts para,"\n"              end            end -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end      end diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index 7f13aab3..a4a05293 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -71,7 +71,7 @@ module SiSU_HTML_Format      end      def ocn_display        if @md.markup.inspect =~/no_ocn/ \ -      or @md.mod.inspect =~/--no-ocn/ \ +      or @md.opt.mod.inspect =~/--no-ocn/ \        or @skin_no_ocn          ocn_class='ocn_off'          @ocn.gsub(/^(\d+|)$/, @@ -967,7 +967,7 @@ WOK          @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil)          @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil)        else -        if @md.cmd =~/M/ +        if @md.opt.cmd =~/M/            p t_o.class            p caller          end diff --git a/lib/sisu/v3/html_minitoc.rb b/lib/sisu/v3/html_minitoc.rb index 160881dd..7390ee7c 100644 --- a/lib/sisu/v3/html_minitoc.rb +++ b/lib/sisu/v3/html_minitoc.rb @@ -67,10 +67,10 @@        def initialize(md,data)          @md,@data=md,data          @pat_strip_heading_name=/<a name="h?\d.*?">(.+?)<\/a>/ -        @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md +        @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md        end        def songsheet -        SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/          toc=nil          @toc=[]          @data.each do |txt| diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb index 92d184c5..91f63ac1 100644 --- a/lib/sisu/v3/html_promo.rb +++ b/lib/sisu/v3/html_promo.rb @@ -405,7 +405,7 @@ WOK            end          end        else -        SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}").warn unless @md.cmd =~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"category not found: #{category}").warn unless @md.opt.cmd =~/q/        end        adverts.join      end diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index a6a1a763..d58dd502 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -71,7 +71,7 @@ module SiSU_HTML_scroll          scr=Scroll.new(@md,@data,@endnotes).markup          scr[:tails]=Scroll.new(@md).tails          scr -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index 5fcb6cf0..2ac89805 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -64,7 +64,7 @@ module SiSU_HTML_seg    class Seg_output      def initialize(md,outputfile,seg,minitoc,type='')        @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type -      @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner? +      @title_banner_=SiSU_Env::Create_site.new(@md.opt.cmd).html_seg_title_banner?        @file=SiSU_Env::SiSU_file.new(@md)      end      def output @@ -141,7 +141,7 @@ module SiSU_HTML_seg        @seg_name_html_tracker=@@tracker || nil        @env=SiSU_Env::Info_env.new(@md.fns) if @md        if @md -        @title_banner_=SiSU_Env::Create_site.new(@md.cmd).html_seg_title_banner? +        @title_banner_=SiSU_Env::Create_site.new(@md.opt.cmd).html_seg_title_banner?        end      end      def songsheet @@ -151,7 +151,7 @@ module SiSU_HTML_seg          data=articles(data)          Seg.new.cleanup # (((( added ))))          #### (((( END )))) #### -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure          @@seg_name=[]        end @@ -178,7 +178,7 @@ module SiSU_HTML_seg        @@seg_name_html=@@seg_name        @@seg_total=@@seg_name.length        testforartnum=@@seg_name_html -      SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length).segmented if @md.cmd =~/[MVv]/ +      SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length).segmented if @md.opt.cmd =~/[MVv]/        map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags        data.each do |dob|          if defined? dob.obj \ diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb index 5bbcdf6c..26072704 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v3/html_tune.rb @@ -76,8 +76,8 @@ module SiSU_HTML_Tune    class Output      def initialize(data,md)        @data,@md=data,md -      @file=SiSU_Env::SiSU_file.new(@md) -      @cX=SiSU_Screen::Ansi.new(@md.cmd).cX +      @file=SiSU_Env::Info_file.new(@md.fns) +      @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX      end      def hard_output        @filename_tune=@file.write_file_processing.html_tune @@ -202,17 +202,17 @@ module SiSU_HTML_Tune      end      def songsheet        begin -        @cX=SiSU_Screen::Ansi.new(@md.cmd).cX -        SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ +        @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/          data=Tune.new(@data,@md).endnotes_html          data=Tune.new(data,@md).url_markup          data=Tune.new(data,@md).markup -        if @md.cmd =~/M/  #Hard Output Tune Optional on/off here +        if @md.opt.cmd =~/M/  #Hard Output Tune Optional on/off here            data=Output.new(data,@md).hard_output            Output.new(data,@md).marshal          end          tuned=Tune.new(@data,@md).output -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 7794c08c..e20b4293 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -287,58 +287,28 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        if @opt.cmd =~/E/ # re-assign character          require 'profile'        end -      if @opt.mod.inspect =~/--harvest/ +      if @opt.act[:harvest]          require_relative 'harvest'                      # harvest.rb -      end -      if @opt.mod.inspect =~/--convert|--to|--from/ +      elsif @opt.mod.inspect =~/--convert|--to|--from/          require_relative 'sst_convert_markup'           # sst_convert_markup.rb -      end -      if @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \ +      elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \        and @opt.cmd =~/^-/ \        and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/          @@tell=SiSU_Screen::Ansi.new(@opt.cmd)          @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX          flag=SiSU_Env::Info_processing_flag.new -        extra='' -        if @opt.cmd !~/[mn]/ -          extra+=if @opt.cmd =~/[abegHhIiNOoPpTtwXxyz]/ \ -          and @opt.cmd !~/[mn]/ -            'm'                        #% add dal -          elsif ((@opt.cmd =~/[Dd]/ \ -          or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ -          and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ -          and @opt.cmd !~/[mn]/ -            'm'                                                                          #% add dal -          else '' -          end -        end -        if @opt.cmd !~/y/ -          extra+=if @opt.cmd =~/[abeHhIiNopsSstwXxz]/ \ -          and @opt.cmd !~/y/ -            'ym'            #% add manifest -          elsif (@opt.cmd =~/[Dd]/ \ -          or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ -          and @opt.files[0] !~/^remove$/ \ -          and @opt.cmd !~/y/ -            'ym' #% add manifest -          else '' -          end -        end -        @opt.cmd=@opt.cmd + extra -        opt=@opt.cmd.scan(/CC|\S/) -        @opt.cmd=opt.uniq.join -        if @opt.cmd =~/[vVM]/          #% version information +        if @opt.cmd =~/[vVM]/                              #% version information            if @opt.cmd =~/V/ \ -          and @opt.files.empty?        #% environment +          and @opt.files.empty?                            #% environment              SiSU_Help::Help.new('env',@opt).environment            else SiSU_Help::Help.new('env',@opt).sisu_version            end          end -        if @opt.cmd =~/^-L$/           #% version information +        if @opt.act[:license]                              #% license information            SiSU_Help::Help.new('license',@opt).help_request          end -        if @opt.cmd =~/m/i             #% -m for -C +        if @opt.act[:dal] or @opt.act[:maintenance]        #% --maintenance, -m for -C            path={}            path[:css]=@@env.path.output + '/_sisu/css'            path[:xml]=@@env.path.output + '/_sisu/xml' @@ -356,7 +326,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              end            end          end -        if @opt.cmd =~/C/              #% -C initialize/configure +        if @opt.act[:site_init]                            #% --init-site, -C initialize/configure            op('conf','configure site')            if @opt.cmd =~/R/              if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ @@ -372,19 +342,19 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              end            end          end -        if @opt.cmd =~/F/              #% -F cgi sample search form +        if @opt.act[:sample_search_form]                   #% --sample-search-form, -F cgi sample search form            Operations.new(@opt).cgi          end -        if @opt.cmd =~/W/              #% -W webrick #@argv==port +        if @opt.act[:webrick]                              #% --webrick, -W webrick            Operations.new(@opt).webrick          end -        if @opt.cmd =~/Z/              #% -Z wipe previous output clean +        if @opt.cmd =~/Z/                                  #% -Z wipe previous output clean            op('zap','Zap, deletions')          end -        if @opt.cmd =~/s/              #% -s sisu source +        if @opt.act[:share_source]            op('share_src','SiSU markup source')          end -        if @opt.cmd =~/m/              #% -m is remote url requested? (download if) +        if @opt.act[:dal]            @retry_count= -1            begin              path_image='./_sisu/processing/external_document/image' @@ -400,12 +370,12 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/                  @get_p << re_p.match(fns)[1] if re_p                end              end -            if @get_s.length > 0       #% remote markup file .sst +            if @get_s.length > 0                           #% remote markup file .sst                require_relative 'remote'                 # remote.rb                SiSU_Remote::Get.new(@opt,@get_s).fns                Operations.new.counter              end -            if @get_p.length > 0       #% remote sisupod +            if @get_p.length > 0                           #% remote sisupod                require_relative 'remote'                 # remote.rb                SiSU_Remote::Get.new(@opt,@get_p).sisupod              end @@ -417,48 +387,57 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/            end            @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }          end -        if @opt.cmd=~/m/               #% -m dal +        if @opt.act[:dal]                                  #%--dal, -m            op('dal','dal')          end          @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } -        if @opt.cmd =~/S/ -          op('sisupod_make','sisupod (zip)') #% -S make sisupod +        if @opt.act[:sisupod]                              #% --sisupod, -S make sisupod +          op('sisupod_make','sisupod (zip)')            if @opt.fns=~/\.kdi._sst/ -            op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source +            op('share_src_kdissert','kdissert (kdi)')      #% -S share kdissert source            end          end -        if @opt.cmd =~/N/; op('digests','digests')             #% -N digest tree +        if @opt.act[:hash_digests]                         #% --hash-digests, -N digest tree +          op('digests','digests')          end -        if @opt.cmd =~/[hHz]/; op('html','html')               #% -h -H -z html css +        if @opt.act[:html]                                 #% --html, -h +          op('html','html')          end -        if @opt.cmd =~/[at]/; op('plaintext','plaintext')         #% -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file +        if @opt.act[:txt]                                  #% --txt, -t -a +          #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file +          op('plaintext','plaintext')          end -        #if @opt.cmd =~/g/; op('git','git')         #% -g git -        #end -        #if @opt.cmd =~/g/; op('wikispeak','wikispeak')         #% -g wiki -        #end -        if @opt.cmd =~/e/; op('epub','ePub')                   #% -e epub +        if @opt.act[:epub]                                 #% --epub, -e +          op('epub','ePub')          end -        if @opt.cmd =~/o/; op('odf','OpenDocument')            #% -o opendocument +        if @opt.act[:odt]                                  #% --odt, -o opendocument +          op('odf','OpenDocument')          end -        if @opt.cmd =~/x/; op('xml','xml sax')                 #% -x xml sax type +        if @opt.act[:xml_sax]                              #% --xml-sax, -x xml sax type +          op('xml','xml sax')          end -        if @opt.cmd =~/X/; op('xml_dom','xml dom')             #% -X xml dom type +        if @opt.act[:xml_dom]                              #% --xml-dom, -x xml dom type +          op('xml_dom','xml dom')          end -        if @opt.cmd =~/f/; op('xml_fictionbook','xml fictionbook') #% -f xml fictionbook +        if @opt.act[:fictionbook]                          #% --fictionbook, -f fictionbook xml +          op('xml_fictionbook','xml fictionbook')          end -        if @opt.cmd =~/b/; op('xhtml','xhtml sax')             #% -b xhtml sax type +        if @opt.act[:xhtml]                                #% --xhtml, -b xhtml +          op('xhtml','xhtml sax')          end -        if @opt.cmd =~/w/; op('concordance','Concordance')     #% -w concordance +        if @opt.act[:concordance]                          #% --concordance, -w +          op('concordance','Concordance')          end -        if @opt.cmd =~/O/; op('xml_md_oai_pmh_dc','OAI PMH')   #% -O open archive initiative, metadata harvesting +        if @opt.cmd =~/O/                                  #% -O open archive initiative, metadata harvesting +          op('xml_md_oai_pmh_dc','OAI PMH')          end -        if @opt.cmd =~/P/; op('po4a','po4a')                   #% -P +        if @opt.act[:po4a]                                 #% --po4a, -P +          op('po4a','po4a')          end -        if @opt.cmd =~/g/              #% -g sisu git +        if @opt.act[:git]                                  #% --git, -g sisu git            op('git','SiSU Git')          end -        if @opt.cmd =~/T/                                      #% -T termsheet/standard form +        if @opt.cmd =~/T/                                  #% -T termsheet/standard form            SiSU_Help::Help.new('termsheet').help_request            @opt.files.each do |fns|              if FileTest.file?(fns) @@ -472,32 +451,39 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/            end            Operations.new.counter          end -        if @opt.cmd =~/k/; op('xml_scaffold','XML scaffold')                   #% -T temporary tests +        if @opt.cmd =~/k/                                  #% -T temporary tests +          op('xml_scaffold','XML scaffold')          end -        if @opt.cmd =~/p/; op('texpdf','LaTeX pdf')                            #% -p latex/ texpdf +        if @opt.act[:pdf]                                  #% --pdf, -p latex/ texpdf +          op('texpdf','LaTeX pdf')          end -        if @opt.cmd =~/i/; op('manpage','manpage')                             #% -i manpage +        if @opt.act[:manpage]                              #% --manpage, -i +          op('manpage','manpage')          end -        if @opt.cmd =~/I/; op('texinfo','TeX Info')                            #% -I texinfo (i taken by db import) +        if @opt.act[:texinfo]                              #% --texinfo, -I +          op('texinfo','TeX Info')          end -        if @opt.cmd =~/D/ \ -        or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql')                #% -D DB postgresql +        if @opt.act[:psql]                                 #% --pg, -D DB postgresql +          op('dbi','postgresql')          end -        if @opt.cmd =~/d/ \ -        or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite')                   #% -d DB sqlite +        if @opt.act[:sqlite]                               #% --sqlite, -d DB sqlite +          op('dbi','sqlite')          end -        #if @opt.cmd =~/G/; Operations.new(@opt).cgi                            #% -G cgi - used to make dbi intecface -        #end -        if @opt.cmd=~/m/; op('embedded','Embedded Content')                    #% -m embedded content +        if @opt.act[:dal]                                  #% --dal, -m embedded content +          op('embedded','Embedded Content')          end -        if @opt.cmd =~/y/; op('manifest','Manifest')                           #% -y manifest +        if @opt.act[:manifest]                             #% --manifest, -y +          op('manifest','Manifest')          end -        if @opt.cmd =~/Y/; op('sitemaps','Sitemap')                            #% -Y sitemap +        if @opt.act[:sitemap]                              #% --sitemap, -Y +          op('sitemaps','Sitemap')          end          if @opt.mod.inspect !~/--harvest/ -          if @opt.cmd =~/r/; op('remote','scp')                                #% -r copy to remote server +          if @opt.act[:scp]                                #% -r copy to remote server +            op('remote','scp')            end -          if @opt.cmd =~/R/; op('remote','rsync')                              #% -R copy to remote server +          if @opt.act[:rsync]                              #% -R copy to remote server +            op('remote','rsync')            end          else          end @@ -517,20 +503,20 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        elsif @opt.mod.inspect =~/--identify/          require_relative 'sst_identify_markup'          # sst_identify_markup.rb          markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version? -      elsif  @opt.mod.inspect =~/--about/                            #% help instructions +      elsif  @opt.mod.inspect =~/--about/                  #% help instructions          if @opt.mod.inspect =~/--about/ \          and not @opt.what.empty?            SiSU_Help::Help.new(@opt.what,'color_off').help_request          else SiSU_Help::Help.new('list','color_off').help_request          end -      elsif  @opt.mod.inspect =~/--sitemaps/                                   #% sitemaps +      elsif  @opt.mod.inspect =~/--sitemaps/               #% sitemaps          require_relative 'sitemaps'                     # sitemaps.rb          SiSU_Sitemaps::Source.new(@opt).read          if @opt.cmd =~/R/            require_relative 'remote'                     # remote.rb            SiSU_Remote::Put.new(@opt).rsync_sitemaps          end -      else                                                                     #% help instructions +      else                                                 #% help instructions          unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/            if @opt.mod.inspect =~/--help/ \            and not @opt.what.empty? diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index c496c8a6..38dc994c 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -138,7 +138,7 @@ module SiSU_Manifest          dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}")          else                             sys.md5("#{pth}/#{file}")          end -        SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}").warn if @md.cmd =~/[vVM]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/          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" @@ -285,10 +285,10 @@ module SiSU_Manifest            summarize(id,file,pth)          end          if FileTest.file?(@md.file.place_file.txt)==true -        if    @md.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' -        elsif @md.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' -        elsif @md.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' -        elsif @md.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)' +        if    @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' +        elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' +        elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' +        elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)'          else                id='Plaintext (UTF-8)'          end            pth=@md.file.output_path.txt @@ -728,7 +728,7 @@ WOK  </html>  WOK            output -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index c14a6c91..81344d4c 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -82,8 +82,6 @@ module SiSU_ODF        begin          @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array          @env.odf_structure -        opendoc=@md.fn[:odf] -        path=@env.path.output_tell          unless @opt.cmd =~/q/            tool=(@opt.cmd =~/[MVv]/) \            ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt}/#{@md.file.base_filename.odt}" \ @@ -112,14 +110,24 @@ module SiSU_ODF          @vz=SiSU_Env::Get_init.instance.skin          @tab="\t"          @brace_url=SiSU_Viz::Skin.new.url_decoration -        @br=(@md.cmd =~/M/) ? '' : '' -        #@br=(@md.cmd =~/M/) ? "\n" : '' +        @br=(@md.opt.cmd =~/M/) ? '' : '' +        #@br=(@md.opt.cmd =~/M/) ? "\n" : ''        end        def songsheet -        pre -        @data=markup(@dal_array) -        post -        publish +        begin +          pre +          @data=markup(@dal_array) +          post +          publish +        ensure +          unless @md.opt.cmd =~/[MV]/ #check maintenance flag +            if @env.processing_path.odt =~/od[ft]/ +              #p "rm -r #{@env.processing_path.odt}" if @md.opt.cmd =~/v/ +              system("rm -r #{@env.processing_path.odf_pth}") +              #system("rm -r #{@env.processing_path.odt}") +            end +          end +        end        end        # Used for extraction of endnotes from paragraphs        def extract_endnotes(dob='') @@ -190,7 +198,7 @@ module SiSU_ODF          and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}")            @env.path.image_source_include_remote          else -          SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/            nil          end        end @@ -207,7 +215,9 @@ module SiSU_ODF          w=/([0-9]+\.\d{0,3})/.match(w).captures.join          image_source=image_src(i)          pwd=Dir.pwd -        cp("#{image_source}/#{i}","#{@env.processing_path.odf}/Pictures/#{i}") if image_source +        if image_source +          cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") +        end          img=if i.to_s =~/jpg|png|gif/ \          and h.to_s =~/\d/ \          and w.to_s =~/\d/ @@ -506,10 +516,12 @@ module SiSU_ODF          odf_tail #($1,$2)          fix=[]          bullet=image_src('bullet_09.png') -        cp("#{bullet}/bullet_09.png","#{@env.processing_path.odf}/Pictures/.") #if image_src('bullet_09.png') +        if bullet +          cp("#{bullet}/bullet_09.png","#{@env.processing_path.odt}/Pictures/.") +        end          odf_metadata          data.each do |dob| -          #p dob.obj if dob.obj =~safe_characters and @md.cmd =~/V/ #KEEP +          #p dob.obj if dob.obj =~safe_characters and @md.opt.cmd =~/V/ #KEEP            dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o]            para_array=[]            dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') @@ -686,9 +698,9 @@ module SiSU_ODF        def odf                                                           #%odf output          env=SiSU_Env::SiSU_file.new(@md)          env.mkdir -        env.make_path(@env.processing_path.odf) +        env.make_path(@env.processing_path.odt)          env.make_path(@md.file.output_path.odt) -        filename="#{@env.processing_path.odf}/content.xml" +        filename="#{@env.processing_path.odt}/content.xml"          od=File.new(filename,'w+')          @content.each do |para|                                                # this is a hack            od.puts para unless para =~/\A\s*\Z/ @@ -730,9 +742,9 @@ page break  notes?? [you could add a note number for every object/paragraph!] -        cd(@env.processing_path.odf) +        cd(@env.processing_path.odt)          structure=[] -        Find.find(@env.processing_path.odf) do |f| +        Find.find(@env.processing_path.odt) do |f|            structure << puts f          end          open(opendoc,'wb') do |f| diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index a79b08f3..a1a448e6 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -61,11 +61,11 @@ module SiSU_commandline    require "pathname"    require_relative 'sysenv'                             # sysenv.rb    class Options -    attr_accessor :cmd,:mod,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:what +    attr_accessor :cmd,:mod,:act,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what      def initialize(a)        @a=a        @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what='','','','','','','','','' -      @f_pths,@files,@paths,@mod=[],[],[],[] +      @f_pths,@files,@paths,@mod,@act=Array.new(5){[]}        @env=SiSU_Env::Info_env.new        r=Px[:lng_lst].join('|')        #r.gsub!(/\|en\|/,'|') @@ -102,44 +102,27 @@ module SiSU_commandline      end      def init        a=@a -      c,w,s='','','' -      m,f,pth,z,ca=[],[],[],[],[] -      shortcut=SiSU_Env::Info_processing_flag.new -      a.each do |x| -        y=case x -        when /0/ -          (x=~/^-1\S+/) \ -          ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \ -          : x.gsub(/^-0/,shortcut.cf_0 + ' ') -        when /1/ -          (x=~/^-1\S+/) \ -          ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \ -          : x.gsub(/^-1/,shortcut.cf_1 + ' ') -        when /2/ -          (x=~/^-2\S+/) \ -          ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \ -          : x.gsub(/^-2/,shortcut.cf_2 + ' ') -        when /3/ -          (x=~/^-3\S+/) \ -          ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \ -          : x.gsub(/^-3/,shortcut.cf_3 + ' ') -        when /4/ -          (x=~/^-4\S+/) \ -          ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \ -          : x.gsub(/^-4/,shortcut.cf_4 + ' ') -        when /5/ -          (x=~/^-5\S+/) \ -          ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \ -          : x.gsub(/^-5/,shortcut.cf_5 + ' ') -        when /6/ -          (x=~/^-6\S+/) \ -          ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \ -          : x.gsub(/^-6/,shortcut.cf_5 + ' ') -        else x -        end -        s << " #{y}" unless y.empty? +      s=expand_numeric_shortcuts(a) +      q=set_files_and_paths_and_general_extract(s) +      @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod]) +      @what=q[:what] unless q[:what].empty? +      @paths = q[:paths] +      @files = q[:files] +      @f_pths = q[:f_pths] +      if @files.length > 0 \ +      and @cmd.empty? \ +      and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default +        @cmd=shortcut.cf_0        end -      s.strip! +      SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ +#     @files.uniq! +      @act=opt_act +      @files +      self +    end +    def set_files_and_paths_and_general_extract(s) +      c,w='','' +      m,f,pth,z,lng=[],[],[],[],[]        a=s.split(/\s+/)        a.each do |x|          if x =~/^-[a-z0-5]+/i \ @@ -157,6 +140,10 @@ module SiSU_commandline              f << pt.split[1].to_s                #remove?              u=/.+?\/([^\/]+)(?:(?:\/(?:en|fr|es)$)|$)/              t=/.+\/(en|fr|es)/ +            lng << (pt.split[0].realpath.to_s[t,1]) \ +              ? pt.split[0].realpath.to_s[t,1] \ +              : nil +              #: ''              f_pths << {                pth: pt.split[0].realpath.to_s,                f: pt.split[1].to_s, @@ -176,72 +163,321 @@ module SiSU_commandline            puts "#{x} in #{a.join(' ')}?"          end        end +      { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng } +    end +    def expand_numeric_shortcuts(a) +      shortcut=SiSU_Env::Info_processing_flag.new +      s='' +      a.each do |x| +        y=case x +        when /0/ +          (x=~/^-1\S+/) \ +          ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \ +          : x.gsub(/^-0/,shortcut.cf_0 + ' ') +        when /1/ +          (x=~/^-1\S+/) \ +          ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \ +          : x.gsub(/^-1/,shortcut.cf_1 + ' ') +        when /2/ +          (x=~/^-2\S+/) \ +          ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \ +          : x.gsub(/^-2/,shortcut.cf_2 + ' ') +        when /3/ +          (x=~/^-3\S+/) \ +          ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \ +          : x.gsub(/^-3/,shortcut.cf_3 + ' ') +        when /4/ +          (x=~/^-4\S+/) \ +          ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \ +          : x.gsub(/^-4/,shortcut.cf_4 + ' ') +        when /5/ +          (x=~/^-5\S+/) \ +          ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \ +          : x.gsub(/^-5/,shortcut.cf_5 + ' ') +        when /6/ +          (x=~/^-6\S+/) \ +          ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \ +          : x.gsub(/^-6/,shortcut.cf_5 + ' ') +        else x +        end +        s << " #{y}" unless y.empty? +      end +      s.strip! +    end +    def opt_cmd_and_mod_adjust(c,m) +      cmd,mod,files=@cmd,@mod,@files        unless m.empty?          m.each do |m|            case m -          when /^(?:--color-toggle)$/;                       c=c+'c' -          when /^(?:--configure)$/;                          c=c+'CC' -          when /^(?:--dal?|--machine|--abstraction|--abs)$/; c=c+'m' -          when /^(?:--txt|--text|--plaintext)$/;             c=c+'t' -          when /^(?:--html)$/;                               c=c+'h' -          when /^(?:--epub)$/;                               c=c+'e' -          when /^(?:--od[ft])$/;                             c=c+'o' -          when /^(?:--pdf)$/;                                c=c+'p' -          when /^(?:--concordance|--wordmap)$/;              c=c+'w' -          when /^(?:--manpage)$/;                            c=c+'i' -          when /^(?:--texinfo)$/;                            c=c+'I' -          when /^(?:--xhtml)$/;                              c=c+'b' -          when /^(?:--xml-sax)$/;                            c=c+'x' -          when /^(?:--xml-dom)$/;                            c=c+'X' -          when /^(?:--digest)$/;                             c=c+'N' -          when /^(?:--po4a|--pot?)$/;                        c=c+'P' -          when /^(?:--termsheet)$/;                          c=c+'T' -          when /^(?:--manifest)$/;                           c=c+'y' -          when /^(?:--sqlite)$/;                             c=c+'d' -          when /^(?:--pg|--pg?sql|--postgresql)$/;           c=c+'D' -          when /^(?:--remote|--rsync)$/;                     c=c+'R' -          when /^(?:--scp)$/;                                c=c+'r' -          when /^(?:--source)$/;                             c=c+'s' -          when /^(?:--sisupod|--pod)$/;                      c=c+'S' -          when /^(?:--git)$/;                                c=c+'g' -          when /^(?:--urls)$/;                               c=c+'U' -          when /^(?:--zap|--delete)$/;                       c=c+'Z' -          when /^(?:--sample-search-form)$/;                 c=c+'F' -          when /^(?:--webserv|--webrick)$/;                  c=c+'W' -          when /^(?:--maintenance)$/;                        c=c+'M' -          when /^(?:--verbose[=-]3)$/;                       c=c+'VM' -          when /^(?:--verbose[=-]2|--Verbose|--VERBOSE)$/;   c=c+'V' -          when /^(?:--verbose(?:[=-]1)?)$/;                  c=c+'v' -          when /^(?:--verbose[=-]0|--quiet|--silent)$/;      c=c+'q' -          else @mod << m +          when /^--(?:color-toggle)$/;                       c=c+'c' +          when /^--(?:configure)$/;                          c=c+'CC' +          when /^--(?:dal?|machine|abstraction|abs)$/;       c=c+'m' +          when /^--(?:txt|text|plaintext)$/;                 c=c+'t' +          when /^--(?:html)$/;                               c=c+'h' +          when /^--(?:epub)$/;                               c=c+'e' +          when /^--(?:od[ft])$/;                             c=c+'o' +          when /^--(?:pdf)$/;                                c=c+'p' +          when /^--(?:concordance|wordmap)$/;                c=c+'w' +          when /^--(?:manpage)$/;                            c=c+'i' +          when /^--(?:texinfo)$/;                            c=c+'I' +          when /^--(?:xhtml)$/;                              c=c+'b' +          when /^--(?:xml-sax)$/;                            c=c+'x' +          when /^--(?:xml-dom)$/;                            c=c+'X' +          when /^--(?:hash-digests)$/;                       c=c+'N' +          when /^--(?:po4a|pot?)$/;                          c=c+'P' +          when /^--(?:termsheet)$/;                          c=c+'T' +          when /^--(?:manifest)$/;                           c=c+'y' +          when /^--(?:sqlite)$/;                             c=c+'d' +          when /^--(?:pg|pg?sql|postgresql)$/;               c=c+'D' +          when /^--(?:remote|rsync)$/;                       c=c+'R' +          when /^--(?:scp)$/;                                c=c+'r' +          when /^--(?:source)$/;                             c=c+'s' +          when /^--(?:sisupod|pod)$/;                        c=c+'S' +          when /^--(?:git)$/;                                c=c+'g' +          when /^--(?:urls)$/;                               c=c+'U' +          when /^--(?:zap|delete)$/;                         c=c+'Z' +          when /^--(?:sample-search-form)$/;                 c=c+'F' +          when /^--(?:webserv|webrick)$/;                    c=c+'W' +          when /^--(?:maintenance|keep-processing-files)$/;  c=c+'M' +          when /^--(?:verbose[=-]3)$/;                       c=c+'VM' +          when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/;       c=c+'V' +          when /^--(?:verbose(?:[=-]1)?)$/;                  c=c+'v' +          when /^--(?:verbose[=-]0|quiet|silent)$/;          c=c+'q' +          else mod << m                                     #mod only contains command modifiers; commands converted to character            end          end        end +      ca=[]        unless c.empty?          c.gsub!(/-/,'')          c.scan(/CC|\S/) {|x| ca << x} -        @cmd= '-' + ca.uniq.join +        cmd= '-' + ca.uniq.join        end -      unless w.empty? ;  @what=w -      end -      @paths = pth -      @files = f -      @f_pths = f_pths -      if @files.length > 0 \ -      and @cmd.empty? \ -      and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default -        @cmd=shortcut.cf_0 +      extra='' +      if cmd !~/[mn]/ +        extra+=if cmd =~/[abegHhIiNOoPpTtwXxyz]/ \ +        and cmd !~/[mn]/ +          'm'                        #% add dal +        elsif ((cmd =~/[Dd]/ \ +        or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ +        and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ +        and cmd !~/[mn]/ +          'm'                                                                          #% add dal +        else '' +        end        end -      SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ -#     @files.uniq! -      @fa=[] -      @files.each do |f| -        if f =~/\.sst$/ -        elsif f =~/\.ssm$/ +      if cmd !~/y/ +        extra+=if cmd =~/[abeHhIiNopsSstwXxz]/ \ +        and cmd !~/y/ +          'ym'            #% add manifest +        elsif (cmd =~/[Dd]/ \ +        or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ +        and files[0] !~/^remove$/ \ +        and cmd !~/y/ +          'ym' #% add manifest +        else ''          end        end -      @files -      self +      cmd=cmd + extra +      cmds=cmd.scan(/CC|\S/) +      [cmds.uniq.join,mod] +    end +    def opt_act #note mod line commands have already been converted to command characters, cmd +      cmd,mod=@cmd,@mod +      act={} +      act[:license]=if cmd =~/L/ \ +      or mod.inspect =~/"--license/ +        true +      else false +      end +      act[:site_init]=if cmd =~/C/ \ +      or mod.inspect =~/"--init-site/ +        true +      else false +      end +      act[:verbose]=if cmd =~/v/ \ +      or mod.inspect =~/"--verbose"/ +        true +      else false +      end +      act[:quiet]=if cmd =~/q/ \ +      or mod.inspect =~/"--quiet"/ +        true +      else false +      end +      act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ +        true +      elsif mod.inspect =~/"--color-off"/ +        true +      else true #fix default color +      end +#     act[:color_toggle]=if cmd =~/c/ \ +#     or mod.inspect =~/"--color-toggle"/ +#       true +#     else false +#     end +      act[:maintenance]=if cmd =~/M/ \ +      or mod.inspect =~/"--maintenance|--keep-processing-files"/ +        true +      else false +      end +      act[:ocn]=if mod.inspect =~/"--no-ocn"/ +        false +      else true +      end +      act[:dal]=if cmd =~/m/ \ +      or mod.inspect =~/"--dal"/ +        true +      else false +      end +      act[:html]=if cmd =~/h/ \ +      or mod.inspect =~/"--html"/ +        true +      else false +      end +      act[:concordance]=if cmd =~/w/ \ +      or mod.inspect =~/"--concordance"/ +        true +      else false +      end +      act[:pdf]=if cmd =~/p/ \ +      or mod.inspect =~/"--pdf"/ +        true +      else false +      end +      act[:epub]=if cmd =~/e/ \ +      or mod.inspect =~/"--epub"/ +        true +      else false +      end +      act[:odt]=if cmd =~/o/ \ +      or mod.inspect =~/"--odf"/ +        true +      else false +      end +      act[:xml_sax]=if cmd =~/x/ \ +      or mod.inspect =~/"--xml-sax"/ +        true +      else false +      end +      act[:xml_dom]=if cmd =~/X/ \ +      or mod.inspect =~/"--xml-dom"/ +        true +      else false +      end +      act[:xhtml]=if cmd =~/b/ \ +      or mod.inspect =~/"--xhtml"/ +        true +      else false +      end +      act[:txt]=if cmd =~/[at]/ \ +      or mod.inspect =~/"--txt"/ +        true +      else false +      end +      act[:manpage]=if cmd =~/i/ \ +      or mod.inspect =~/"--manpage"/ +        true +      else false +      end +      act[:texinfo]=if cmd =~/I/ \ +      or mod.inspect =~/"--texinfo"/ +        true +      else false +      end +      act[:fictionbook]=if cmd =~/f/ \ +      or mod.inspect =~/"--fictionbook"/ +        true +      else false +      end +      act[:psql]=if cmd =~/D/ \ +      or mod.inspect =~/"--pg"|"--pgsql"/ +        true +      else false +      end +      act[:sqlite]=if cmd =~/d/ \ +      or mod.inspect =~/"--sqlite"/ +        true +      else false +      end +      act[:harvest]=if mod.inspect =~/"--harvest"/ +        true +      else false +      end +      act[:po4a]=if mod.inspect =~/"--po4a"|"--po"/ +        true +      else false +      end +      act[:git]=if cmd =~/g/ \ +      or mod.inspect =~/"--git"/ +        true +      else false +      end +      act[:hash_digests]=if cmd =~/N/ \ +      or mod.inspect =~/"--hash-digests"/ +        true +      else false +      end +      act[:sample_search_form]=if cmd =~/F/ \ +      or mod.inspect =~/"--sample-search-form"/ +        true +      else false +      end +      act[:webrick]=if cmd =~/W/ \ +      or mod.inspect =~/"--webrick"/ +        true +      else false +      end +      act[:share_source]=if cmd =~/s/ \ +      or mod.inspect =~/"--source"/ +        true +      else false +      end +      act[:sisupod]=if cmd =~/S/ \ +      or mod.inspect =~/"--sisupod"/ +        true +      else false +      end +      act[:scp]=if cmd =~/r/ \ +      or mod.inspect =~/"--scp"/ +        true +      else false +      end +      act[:rsync]=if cmd =~/R/ \ +      or mod.inspect =~/"--rsync"/ +        true +      else false +      end +      act[:delete_output]=if cmd =~/z/ \ +      or mod.inspect =~/"--delete"|"--zap"/ +        true +      else false +      end +      act[:urls_all]=if cmd =~/U/ \ +      or mod.inspect =~/"--urls-all"/ +        true +      else false +      end +      act[:urls_seleted]=if cmd =~/u/ \ +      or mod.inspect =~/"--urls"/ +        true +      else false +      end +      act[:sitemap]=if cmd =~/Y/ \ +      or mod.inspect =~/"--sitemap"/ +        true +      else false +      end +      act[:manifest]=if cmd =~/y/ \ +      or mod.inspect =~/"--manifest"/ +        true +      else false +      end +      act[:help]=if mod.inspect =~/"--help/ +        true +      else false +      end +      @act=act      end      def cmd        @cmd @@ -249,12 +485,18 @@ module SiSU_commandline      def mod        @mod      end +    def act +      @act +    end      def f_pth        @f_pth      end      def pth        @pth      end +    def lng +      @lng +    end      def fns        @fns      end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 9a11da8c..c2968564 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -101,7 +101,7 @@ module SiSU_Param          @@md=nil        end        if @@md.nil? \ -      or @cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file +      or @opt.cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file          if File.exist?(@pstorefile)            param_msg='Parameters from pstore'            store=PStore.new(@pstorefile) @@ -117,12 +117,12 @@ module SiSU_Param            @md          end          if defined? @md.title.main # on removal check problems with -U -          SiSU_Screen::Ansi.new(@cmd,param_msg,@md.title.main).txt_grey if @cmd =~/[MVv]/ +          SiSU_Screen::Ansi.new(@opt.cmd,param_msg,@md.title.main).txt_grey if @opt.cmd =~/[MVv]/          end          @@md=@md        else @@md        end -      @@md.cmd=@cmd +      @@md.opt=@opt        @@md      end      class Md_default @@ -400,7 +400,7 @@ module SiSU_Param              elsif @h['main']                @h['main']              else -              SiSU_Screen::Ansi.new(@cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ +              SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/                ''              end              l,n=Db[:col_info_note],'rights.copyright.text' @@ -487,7 +487,7 @@ module SiSU_Param                s +='<br> License: ' + copyright.license              end              if s.empty? -              SiSU_Screen::Ansi.new(@cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ +              SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/              else                l,n=Db[:col_info_note],'rights.all'                validate_length(s,l,n) @@ -828,10 +828,10 @@ module SiSU_Param        @doc={ lv: [] }        @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''        @@publisher='SiSU scribe' -      attr_accessor :cmd,:make,:mod,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy +      attr_accessor :make,:env,:path,:file,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy        def initialize(fns_array,opt)          @env=@path,@file=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil -        @data,@path,@fns,@cmd,@mod,@opt=fns_array,opt.pth,opt.fns,opt.cmd,opt.mod,opt #@data used as data +        @data,@path,@fns,@opt=fns_array,opt.pth,opt.fns,opt #@data used as data          @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false          @seg_autoname_safe=true          @daisy,@sem_tag=false,false @@ -845,7 +845,7 @@ module SiSU_Param          @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/          @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg          begin -        rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@fns).error          ensure          end        end @@ -882,7 +882,7 @@ module SiSU_Param          end          @concord_make=(@wc_words > @env.concord_max) ? false : true          @locale=@sys.locale -        @file_encoding=@sys.file_encoding(fns,@cmd) +        @file_encoding=@sys.file_encoding(fns,@opt.cmd)          # programs set here for things that affect output appearance only          @programs[:pdf]=SiSU_Env::System_call.new.program_found?('pdflatex')          if @opt.cmd =~/P/ #if @env.multilingual? @@ -925,11 +925,11 @@ module SiSU_Param              @markup_version_declared=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1]              sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3]              sm_c ||=0 -            sv=(@cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : '' +            sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : ''              s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3]              tell=(@markup_version_declared.to_f==@markup_version.determined) \ -            ? SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \ -            : SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv) +            ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \ +            : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv)              ok=if s_a.to_i > sm_a.to_i                true              elsif s_a.to_i == sm_a.to_i \ @@ -942,12 +942,12 @@ module SiSU_Param              else false              end              if ok -              tell.txt_green if @cmd =~/[vVM]/ +              tell.txt_green if @opt.cmd =~/[vVM]/              else -              SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @cmd =~/q/ +              SiSU_Screen::Ansi.new(@opt.cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/              end            else -            SiSU_Screen::Ansi.new(@cmd,'No SiSU markup version provided').warn if @cmd =~/[VM]/ +            SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/            end          else            mv=if defined? @markup_version.determined and not @markup_version.determined.nil? @@ -955,7 +955,7 @@ module SiSU_Param              "markup version determined #{x}"            else ''            end -          SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).warn unless @cmd =~/q/ +          SiSU_Screen::Ansi.new(@opt.cmd,'SiSU filetype indicator not provided',mv).warn unless @opt.cmd =~/q/          end          @code_flag=false          fns_array.each do |para|                                               #% scan document @@ -1076,7 +1076,7 @@ module SiSU_Param                  @title=Md.new(tf.strip,@opt,@env).title                end                @html_title=@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'') -              SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title).txt_grey if @cmd =~/v/ +              SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',@html_title).txt_grey if @opt.cmd =~/v/              end              if not @book_idx \              and para =~/^=\{(.+?)\}\s*$/ @@ -1205,9 +1205,9 @@ module SiSU_Param            @markup.gsub!(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}")            @markup.gsub!(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")          end -        if @mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \ -        or  @mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override -          @papersize=determine_papersize(@mod.inspect) +        if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \ +        or  @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override +          @papersize=determine_papersize(@opt.mod.inspect)          end          @papersize_array=@papersize.scan(/(?:a4|letter|legal|book|a5|b5)/i)          fn=@fns=~/\.ssm\.sst$/ ? @fns.gsub(/.sst/,'') : @fns #decide what to do a filesize on .ssm tells very little about actual document size @@ -1257,13 +1257,13 @@ module SiSU_Param          if @en[:note] > 0 \          and @en[:sum] > 0            if @en[:sum] > 0 -          else SiSU_Screen::Ansi.new(@cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @cmd !~/q/ +          else SiSU_Screen::Ansi.new(@opt.cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/            end          end          if @en[:mark] != @en[:note] \          and @en[:note] > 0            @en[:mismatch]=@en[:note] - @en[:mark] -          SiSU_Screen::Ansi.new(@cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @cmd !~/q/ +          SiSU_Screen::Ansi.new(@opt.cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/            footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a')            footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n"          end @@ -1274,7 +1274,7 @@ module SiSU_Param            and  @opt.inspect =~/P/              #@title=Md.new('Text Insert',@opt,@env).title            else -            SiSU_Screen::Ansi.new(@cmd,'WARNING Document Title missing','please provide @title:').warn unless @cmd =~/q/ +            SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/            end          end          if @author !~/[\S]/ @@ -1282,7 +1282,7 @@ module SiSU_Param            and  @opt.inspect =~/P/              #@creator=Md.new('Text Insert',@opt,@env).creator            else -            SiSU_Screen::Ansi.new(@cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @cmd =~/q/ +            SiSU_Screen::Ansi.new(@opt.cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/            end          end          @struct={} @@ -1349,7 +1349,7 @@ module SiSU_Param          @lv5 ||=/^5~/          @lv6 ||=/^6~/          if @doc_skin -          SiSU_Screen::Ansi.new(@cmd,"doc_skin <- #{@doc_skin}").txt_grey if @cmd =~/v/ +          SiSU_Screen::Ansi.new(@opt.cmd,"doc_skin <- #{@doc_skin}").txt_grey if @opt.cmd =~/v/          end          @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually          @file=SiSU_Env::SiSU_file.new(self) #watch @@ -1364,7 +1364,7 @@ module SiSU_Param          end          def store            File.unlink(@pstorefile) if FileTest.file?(@pstorefile) -          SiSU_Screen::Ansi.new(@md.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.cmd =~/[MV]/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{@pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/            store=PStore.new(@pstorefile)            store.transaction do              store['md']=@md diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index 8ff64b30..74de7a0e 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -118,12 +118,12 @@ module SiSU_Plaintext          @env=SiSU_Env::Info_env.new(@md.fns)          @brace_url=SiSU_Viz::Skin.new.url_decoration          @tab="\t" -        @@endnotes_=case md.mod.inspect +        @@endnotes_=case md.opt.mod.inspect          when /--footnote/; false          when /--endnote/; true          else true          end -        @br=case md.mod.inspect +        @br=case md.opt.mod.inspect          when /--dos/; "\r\n"          when /--unix/; "\n"          else "\n" diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index ba892634..d65191e0 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -172,8 +172,8 @@ module SiSU_po4a          @brace_url=SiSU_Viz::Skin.new.url_decoration          @vz=SiSU_Env::Get_init.instance.skin          @tab="\t" -        @@endnotes_=(@md.mod.inspect =~/--endnote/) ? true : false    # --footnote -        @br=(@md.mod.inspect =~/--dos/) ? "\r\n" : "\n"               # --unix +        @@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false    # --footnote +        @br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n"               # --unix          @pot={ body: [], open: [], close: [], head: [], metadata: [], tail: [] }        end        def songsheet @@ -213,7 +213,7 @@ module SiSU_po4a            d="#{nt} #{@fn}"            mark="^~ "            instruct=s_mark='' -          if @md.cmd=~/M/ +          if @md.opt.cmd=~/M/              instruct=%{\n# footnotes, the preferred sisu markup for a footnote is~{this is a footnote}~ however, for translation a footnote reference marker in the text~^ with a set of notes following the paragraph starting on a newline with "^~ this is a footnote", is easier to deal with, if possible these should be converted back to~{inline notes}~}              s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}            end @@ -518,7 +518,7 @@ GSUB          mark="#{dob_src.lv}~#{fn} "          d="#{dob_src.is} (level #{dob_src.lv})"          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct=%{\n# markup for headings is marker at the start of the line/object, indicating the heading level, and if provided an associated name tag, this heading is "#{mark}"}            s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}          end @@ -546,7 +546,7 @@ GSUB              mark="_#{dob_src.indent}* "              d="#{dob_src.is}: indent #{dob_src.indent}, bullet"              instruct=s_mark='' -            if @md.cmd=~/M/ +            if @md.opt.cmd=~/M/                instruct=%{\n# markup for indented bullet text is at the start of the line/object, an underscore followed by the indent level and an asterisk "#{mark}"}                s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}              end @@ -555,7 +555,7 @@ GSUB              mark="_#{dob_src.indent} "              d="#{dob_src.is}: indent #{dob_src.indent}"              instruct=s_mark='' -            if @md.cmd=~/M/ +            if @md.opt.cmd=~/M/                instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"}                s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}              end @@ -570,7 +570,7 @@ GSUB              mark='_* '              d="#{dob_src.is}: bullet"              instruct=s_mark='' -            if @md.cmd=~/M/ +            if @md.opt.cmd=~/M/                instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"}                s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}              end @@ -581,7 +581,7 @@ GSUB              mark=''              d=dob_src.is              instruct=%{\n# regular paragraph, no special markup} -            if @md.cmd=~/M/ +            if @md.opt.cmd=~/M/                instruct="\n# "                s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}              end @@ -607,7 +607,7 @@ GSUB          mark="block{\\n\\n...\\n\\n}block"          d=dob_src.is          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped"            s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}          end @@ -622,7 +622,7 @@ GSUB          mark="group{\\n\\n...\\n\\n}group"          d=dob_src.is          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped"            s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}          end @@ -637,7 +637,7 @@ GSUB          mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem"          d=dob_src.is          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# verse are part of the text block described as a poem, the first verse is preceeded by an opening marker, and the last verse by a closing marker, the content of which should remain unwrapped"            s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}          end @@ -652,7 +652,7 @@ GSUB          mark="code{\\n\\n...\\n\\n}code"          d=dob_src.is          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped"            s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}          end @@ -667,7 +667,7 @@ GSUB          mark="table{\\n\\n...\\n\\n}table"          d=dob_src.is          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped"            s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}          end @@ -683,7 +683,7 @@ GSUB        def pot_structure_idx(dob_src='',dob_trn='')                      #% Used to extract the structure of a document          mark="={ ... }"          instruct=s_mark='' -        if @md.cmd=~/M/ +        if @md.opt.cmd=~/M/            instruct="\n# the book index should be attached unwrapped to the preceding text block (there should be a new line, but no empty line)"            s_mark="\n# " + %{"\\n#{mark}\\n\\n"}          end @@ -730,11 +730,11 @@ GSUB              if (data_src[s].is == 'comment' or data_trn[t].is == 'comment') \              and (data_src[s].is != data_trn[t].is)                if data_src[s].is == 'comment' -                puts "src (comment):\n\t" + data_src[s].obj if @md.cmd =~/M/ +                puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/                  s+=1                  #next if data_src[s].is == 'comment'                elsif data_trn[t].is == 'comment' -                puts "trans (comment):\n\t" + data_trn[t].obj if @md.cmd =~/M/ +                puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.cmd =~/M/                  t+=1                  #next if data_trn[t].is == 'comment'                end @@ -943,7 +943,7 @@ GSUB          po4a_git        end        def po4a_git -        unless @md.cmd =~/M/ +        unless @md.opt.cmd =~/M/            require_relative 'git'                           # git.rb            git=SiSU_Git::Source.new(@md.opt)            git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git) diff --git a/lib/sisu/v3/rexml.rb b/lib/sisu/v3/rexml.rb index d3053ee9..fd15865f 100644 --- a/lib/sisu/v3/rexml.rb +++ b/lib/sisu/v3/rexml.rb @@ -88,10 +88,10 @@ module SiSU_Rexml              xmlfile=IO.readlines(@fnap,'').join              begin                @xmldoc=REXML::Document.new xmlfile -              SiSU_Screen::Ansi.new(@md.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.cmd =~/q/  #% tell -              if @md.cmd =~ /v/i        #% substantive text +              SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.cmd =~/q/  #% tell +              if @md.opt.cmd =~ /v/i        #% substantive text                  @xmldoc.elements.each(@e_head) do |e| -                  SiSU_Screen::Ansi.new(@md.cmd,'brown',e).colorize unless @md.cmd =~/q/ +                  SiSU_Screen::Ansi.new(@md.opt.cmd,'brown',e).colorize unless @md.opt.cmd =~/q/                  end                end              rescue REXML::ParseException @@ -99,10 +99,10 @@ module SiSU_Rexml              end            end          else -          SiSU_Screen::Ansi.new(@md.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.cmd =~/q/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.cmd =~/q/            exit          end -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb index d4855ccd..3ad5b09d 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v3/screen_text_color.rb @@ -58,7 +58,7 @@  =end  module SiSU_Screen    class Color -    attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black +    attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:white_bold,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black      def initialize(&block)        instance_eval &block      end @@ -85,12 +85,13 @@ module SiSU_Screen        end        @cX=@@cX= unless @use_color          Color.new do -          self.off=self.white=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' +          self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black=''          end        else                                                                       #default set to colors on          Color.new do            self.off           = "\033[0m" -          self.white         = "\033[0m" +          self.white         = "\033[37m" +          self.white_bold    = "\033[1m"            self.marker        = "\033[42m"            self.bold          = "\033[1m"            self.underline     = "\033[4m" @@ -127,7 +128,7 @@ module SiSU_Screen      end      def colors        0.upto(109) {|i| print "\033[#{i}m 33[#{i}m \033[m"} -       puts '' +      puts ''      end      def color        case @color_instruct @@ -412,3 +413,75 @@ module SiSU_Screen    end  end  __END__ +        Color.new do +          self.off           = "\033[0m" +          self.white         = "\033[37m" +          self.white_bold    = "\033[1m" +          self.marker        = "\033[42m" +          self.bold          = "\033[1m" +          self.underline     = "\033[4m" +          self.invert        = "\033[7m" +          self.darkgrey_hi   = "\033[100m" +          self.grey_hi       = "\033[47m" +          self.pink_hi       = "\033[105m" +          self.fuschia_hi    = "\033[45m" +          self.red_hi        = "\033[41m" +          self.orange_hi     = "\033[101m" +          self.yellow_hi     = "\033[103m" +          self.brown_hi      = "\033[43m" +          self.lightgreen_hi = "\033[102m" +          self.green_hi      = "\033[42m" +          self.cyan_hi       = "\033[106m" +          self.blue_hi       = "\033[104m" +          self.navy_hi       = "\033[44m" +          self.grey          = "\033[90m" +          self.pink          = "\033[95m" +          self.fuschia       = "\033[35m" +          self.ruby          = "\033[31m" +          self.red           = "\033[91m" #check +          self.orange        = "\033[91m" +          self.yellow        = "\033[93m" +          self.brown         = "\033[33m" +          self.green         = "\033[92m" +          self.darkgreen     = "\033[32m" +          self.cyan          = "\033[36m" +          self.blue          = "\033[94m" +          self.navy          = "\033[34m" +          self.black         = "\033[30m" +        end +# fewer colors +        Color.new do +          self.off           = "\033[0m" +          self.white         = "\033[0m" +          self.marker        = "\033[42m" +          self.bold          = "\033[1m" +          self.underline     = "\033[4m" +          self.invert        = "\033[7m" +          self.darkgrey_hi   = "\033[100m" +          self.grey_hi       = "\033[47m" +          self.pink_hi       = "\033[105m" +          self.fuschia_hi    = "\033[45m" +          self.red_hi        = "\033[41m" +          self.orange_hi     = "\033[101m" +          self.yellow_hi     = "\033[103m" +          self.brown_hi      = "\033[43m" +          self.lightgreen_hi = "\033[102m" +          self.green_hi      = "\033[42m" +          self.cyan_hi       = "\033[106m" +          self.blue_hi       = "\033[104m" +          self.navy_hi       = "\033[44m" +          self.grey          = "\033[90m" +          self.pink          = "\033[95m" +          self.fuschia       = "\033[35m" +          self.ruby          = "\033[31m" +          self.red           = "\033[31m" #check +          self.orange        = "\033[91m" +          self.yellow        = "\033[33m" +          self.brown         = "\033[33m" +          self.green         = "\033[32m" +          self.darkgreen     = "\033[32m" +          self.cyan          = "\033[36m" +          self.blue          = "\033[34m" +          self.navy          = "\033[34m" +          self.black         = "\033[30m" +        end diff --git a/lib/sisu/v3/shared_markup_alt.rb b/lib/sisu/v3/shared_markup_alt.rb index 738ec75a..a7d08cae 100644 --- a/lib/sisu/v3/shared_markup_alt.rb +++ b/lib/sisu/v3/shared_markup_alt.rb @@ -261,7 +261,7 @@ module SiSU_text_representation               elsif FileTest.file?("#{@env.path.image_source_include}/#{i}")                 @env.path.image_source_include               else -               SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +               SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/                 nil               end               img_type = /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb index 18252515..27ccf6db 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v3/sst_do_inline_footnotes.rb @@ -128,15 +128,15 @@ module SiSU_Convert_footnotes        meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice        @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract        if @md.en[:mismatch]==0 \ -      or @md.mod.inspect =~/=footnotes-force/ +      or @md.opt.mod.inspect =~/=footnotes-force/          meta=nil          dal=SiSU_Convert_footnotes::Make.new(@md,file_array).song -        SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.cmd =~/v/ -        SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.cmd =~/q/ +        SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.opt.cmd =~/v/ +        SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.cmd =~/q/          dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?}          dal_array        else -        SiSU_Screen::Ansi.new(@md.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/          ''        end      end @@ -350,7 +350,7 @@ module SiSU_Convert_footnotes      end      def set_heading_top                                                        #% make sure no false positives        unless @md.set_heading_top -        puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          data=@data          @tuned_file=[]          data.each do |para| @@ -371,7 +371,7 @@ module SiSU_Convert_footnotes      end      def set_heading_seg                                                        #% make sure no false positives        unless @md.set_heading_seg -        puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          data=@data          @tuned_file=[]          data.each do |para| @@ -393,7 +393,7 @@ module SiSU_Convert_footnotes      end      def set_header_title                                                       #% make sure no false positives        unless @md.set_header_title -        puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/ +        puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/          data=@data          @tuned_file=[]          data.each do |para| diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v3/sst_to_s_xml_sax.rb index e698a8f9..c9cdd241 100644 --- a/lib/sisu/v3/sst_to_s_xml_sax.rb +++ b/lib/sisu/v3/sst_to_s_xml_sax.rb @@ -120,9 +120,9 @@ module SiSU_simple_xml_model_sax        def songsheet          begin            SiSU_simple_xml_model_sax::Convert::Scroll.new(@data,@particulars).songsheet -          SiSU_simple_xml_model_sax::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use -          SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +          SiSU_simple_xml_model_sax::Convert::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use +          SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end @@ -436,14 +436,14 @@ WOK        end        def xml          if @prog.tidy !=false #note values can be other than true -          if @md.cmd =~/[VM]/ -            SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/ -            SiSU_Screen::Ansi.new(@md.cmd,'','','check document structure') -            tell.grey_open unless @md.cmd =~/q/ +          if @md.opt.cmd =~/[VM]/ +            SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/ +            SiSU_Screen::Ansi.new(@md.opt.cmd,'','','check document structure') +            tell.grey_open unless @md.opt.cmd =~/q/              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy =SiSU_Env::System_call.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile)              tidy.well_formed? -            tell.p_off unless @md.cmd =~/q/ +            tell.p_off unless @md.opt.cmd =~/q/            end          end        end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 7cc2a327..6f69296a 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -191,7 +191,6 @@ module SiSU_Env        PROCESSING_TUNE =>          'tune',        PROCESSING_LATEX =>         'tex',        PROCESSING_TEXINFO =>       'texinfo', -      PROCESSING_LOUT =>          'lout',        PROCESSING_SQLITE =>        'sqlite',        PROCESSING_POSTGRESQL=>     'postgresql',        PROCESSING_ENCODING =>      'encoding', @@ -225,7 +224,8 @@ module SiSU_Env      : ["#{@@home}/.sisu",@@sisu_etc]      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,:yamlrc_path,:ad_path      def initialize -      @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=@@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path +      @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=\ +      @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path        #note rbver is duplicated in Info_version      end    end @@ -890,7 +890,6 @@ module SiSU_Env        @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters        @fixed_websev_root='' # @home        @pwd=@@pwd=Dir.pwd -#     @pwd=@@pwd||=Dir.pwd        m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m        @stub_pwd=@@pwd[m,1]        @stub_txt=     @stub_pwd + '/txt' @@ -903,6 +902,23 @@ module SiSU_Env        @stub_src=     @stub_pwd + '/src'        @stub_pod=     @stub_pwd + '/pod'        @stub_md=      @stub_pwd + '/sisu_site_metadata' +      pt=Pathname.new(Dir.pwd) +      stub=if output_dir_structure.by_language_code? +        stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(en|fr|es)$)/ +          lng=pt.split[-1].to_s +          lng_part='/' + lng +          base=pt.split[0].split[-1].to_s +        else +          lng_part='/' + 'en'                           #fix default language +          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? +        '' +      end +      @stub_set_manifest=stub + '/manifest'      end      def user        @sys.user @@ -969,8 +985,8 @@ module SiSU_Env      def stub_pwd                                                               #200412        @stub_pwd      end -    def stub_md_harvest -      @stub_md +    def stub_md_harvest                                                        #watch +      @stub_set_manifest      end      def stub_src        @stub_src @@ -1388,6 +1404,9 @@ WOK        def stub_manifest          @stub_manifest        end +      def stub_set_manifest +        @stub_set_manifest +      end        def stub_src          @stub_src        end @@ -1395,7 +1414,7 @@ WOK          @stub_pod        end        def stub_md_harvest -        @stub_md +        @stub_set_manifest        end        def etc          defaults[:sisu_etc]                                                      #live/dynamic @@ -1654,8 +1673,15 @@ WOK          end          pth        end +      def odf_pth +        pth="#{processing}/odf/#{@fns}" +        pth +      end        def odf -        pth="#{processing}/odf" +        odt +      end +      def odt +        pth=odf_pth + '/odt'          mkdir_p(pth) unless FileTest.directory?(pth)          pth        end @@ -1808,15 +1834,15 @@ WOK        end        def webrick_port          if @md \ -        and @md.cmd.inspect=~/-F/ \ -        and @md.mod.inspect=~/port=(\d+)/ +        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.mod \ -            and not @md.mod.nil? \ -            and @md.mod.inspect=~/webrick/) +            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'] @@ -1828,15 +1854,16 @@ WOK        end        def webserv_port_cgi          if @md \ -        and @md.cmd.inspect=~/-F/ \ -        and @md.mod.inspect=~/port=(\d+)/ +        and defined? @md.opt \ +        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.mod \ -            and not @md.mod.nil? \ -            and @md.mod.inspect=~/webrick/) +            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'] @@ -2196,8 +2223,9 @@ WOK        : (defaults[:papersize].downcase)      end      def odf_structure -      rm_rf("#{processing_path.processing}/odf") -      system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d      #{processing_path.processing}") +      rm_rf(processing_path.processing_path.odf_pth) +      mkdir_p(processing_path.processing_path.odf_pth) +      system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d      #{processing_path.odf_pth}")      end      def sisupod_gen(fns_pod)        pwd=Dir.pwd @@ -2296,44 +2324,44 @@ WOK        if @md \        and defined? @md.fn \        and @md.fn        # used for by_language_code? -        if @md.cmd =~ /[hH]/ +        if @md.opt.cmd =~ /[hH]/            ft << @md.fn[:html]          end -        if @md.cmd =~ /w/ \ -        and @md.cmd !~ /[hH]/ +        if @md.opt.cmd =~ /w/ \ +        and @md.opt.cmd !~ /[hH]/            ft << @md.fn[:concordance]          end -        if @md.cmd =~ /y/ \ -        and @md.cmd !~ /[hH]/ +        if @md.opt.cmd =~ /y/ \ +        and @md.opt.cmd !~ /[hH]/            ft << @md.fn[:manifest]          end -        if @md.cmd =~ /[at]/; ft << @md.fn[:plain] +        if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain]          end -        if @md.cmd =~ /b/; ft << @md.fn[:xhtml] +        if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml]          end -        if @md.cmd =~ /e/; ft << @md.fn[:epub] +        if @md.opt.cmd =~ /e/; ft << @md.fn[:epub]          end -        if @md.cmd =~ /g/; ft << @md.fn[:wiki] +        if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki]          end -        if @md.cmd =~ /i/; ft << @md.fn[:manpage] +        if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage]          end -        if @md.cmd =~ /N/; ft << @md.fn[:digest] +        if @md.opt.cmd =~ /N/; ft << @md.fn[:digest]          end -        if @md.cmd =~ /o/; ft << @md.fn[:odf] +        if @md.opt.cmd =~ /o/; ft << @md.fn[:odf]          end -        if @md.cmd =~ /O/; ft << @md.fn[:oai_pmh] +        if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh]          end -        if @md.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] +        if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p]          end -        if @md.cmd =~ /s/; ft << @md.fns +        if @md.opt.cmd =~ /s/; ft << @md.fns          end -        if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' +        if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi'          end -        if @md.cmd =~ /x/; ft << @md.fn[:sax] +        if @md.opt.cmd =~ /x/; ft << @md.fn[:sax]          end -        if @md.cmd =~ /X/; ft << @md.fn[:dom] +        if @md.opt.cmd =~ /X/; ft << @md.fn[:dom]          end -        if @md.cmd =~ /G/; ft << @md.fn[:pot] +        if @md.opt.cmd =~ /G/; ft << @md.fn[:pot]          end          @fnb=@md.fnb        else                                                                     # still needed where/when param is not parsed @@ -2400,7 +2428,7 @@ WOK        ? "#{@env.path.output}/pod" \        : @env.path.output_pod)        @source_path_harvest=(@fnb && !(@fnb.empty?) \ -      ? "#{@env.path.output}/sisu_site_metadata" \ +      ? "#{@env.path.output}/manifest" \        : @env.path.output_harvest)        @local_sisu_source=(@filetypes =~/\S/) \        ? "#{@source_path}/#{@filetypes}" \ @@ -3417,7 +3445,7 @@ WOK          @env.processing_path.git + '/' + @md.fnb + '/' + ft        end        def md_harvest -        "#{output_path.base}/sisu_site_metadata" +        manifest        end        def txt          ft='txt' @@ -3736,7 +3764,7 @@ WOK        skin_path << "#{@env.processing_path.processing}/external_document/skin"        skin=true        if @pwd_stub =~/^sisupod$/ \ -      and @md.mod.inspect !~/--trust/ +      and @md.opt.mod.inspect !~/--trust/          skin=false  #security only run skins on sisupod if --trust flag is provided        end        doc_skin,dir_skin=nil,nil diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb index 14602fb7..f7693056 100644 --- a/lib/sisu/v3/texinfo.rb +++ b/lib/sisu/v3/texinfo.rb @@ -138,7 +138,7 @@ module SiSU_TexInfo          @data=tail          output          makeinfo #KEEP reinstate when fixed #% -      rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.cmd,$!,$@).rescue +      rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue        ensure        end      end @@ -361,7 +361,7 @@ module SiSU_TexInfo        data.compact!        filename=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo}        filename_texinfo=File.new(filename,'w+') -      puts filename if @md.cmd =~/M/ +      puts filename if @md.opt.cmd =~/M/        data.each {|s| (filename_texinfo.puts s,"\n") if s}        filename_texinfo.close      end @@ -372,7 +372,7 @@ module SiSU_TexInfo          pwd=Dir.pwd          case sfx          when /(?:-|ssm\.)?sst$/ -          @env=SiSU_Env::Info_env.new(@md.fns,@md.cmd) +          @env=SiSU_Env::Info_env.new(@md.fns,@md.opt.cmd)            Dir.chdir(@env.processing_path.texi)            texinfo=SiSU_Env::System_call.new("#{fnb}.texinfo")            texinfo.makeinfo diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 9497d51f..42c565b7 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -110,7 +110,7 @@ module SiSU_TeX            SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_p}pdf").flow          end          @md=@particulars.md -        $flag=@md.cmd                                                          #introduced to pass 0 for no object citation numbers... to texpdf_format +        $flag=@md.opt.cmd                                                          #introduced to pass 0 for no object citation numbers... to texpdf_format          directories                                                                                 #% needed needs to be reprogrammed !!!          SiSU_Env::Info_skin.new(@md).select @@ -153,24 +153,24 @@ module SiSU_TeX        def latex_do(texfilename,papersize)          @texfilename=texfilename          @@n_lpdf=@@n_lpdf+1 -        SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/          tex_fn_base=@texfilename.gsub(/\.tex$/,'') -        cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.cmd) -        tell=SiSU_Screen::Ansi.new(@md.cmd) -        tell.grey_open if @md.cmd =~/[MVv]/ +        cmd=SiSU_Env::System_call.new("#{tex_fn_base}.tex",'',@md.opt.cmd) +        tell=SiSU_Screen::Ansi.new(@md.opt.cmd) +        tell.grey_open if @md.opt.cmd =~/[MVv]/          if "#{tex_fn_base}" =~/\w+/ \          and "#{papersize}" =~/\w+/            2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex portrait          end -        tell.p_off if @md.cmd =~/[MVv]/ -        SiSU_Screen::Ansi.new(@md.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.cmd =~/[MVv]/ -        cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.cmd) -        tell.grey_open if @md.cmd =~/[MVv]/ +        tell.p_off if @md.opt.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ +        cmd=SiSU_Env::System_call.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) +        tell.grey_open if @md.opt.cmd =~/[MVv]/          if "#{tex_fn_base}" =~/\w+/ \          and "#{papersize}" =~/\w+/            2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape          end -        tell.p_off if @md.cmd =~/[MVv]/ +        tell.p_off if @md.opt.cmd =~/[MVv]/          pwd=Dir.pwd          portrait_pdf="#{pwd}/#{tex_fn_base}.pdf"          landscape_pdf="#{pwd}/#{tex_fn_base}.landscape.pdf" @@ -186,14 +186,14 @@ module SiSU_TeX          if FileTest.file?(portrait_pdf)            cp(portrait_pdf,"#{@md.file.output_path.pdf}/#{pdf_p}")            rm(portrait_pdf) -        else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.cmd.inspect =~/M/ +        else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/          end          if FileTest.file?(landscape_pdf)            cp(landscape_pdf,"#{@md.file.output_path.pdf}/#{pdf_l}")            rm(landscape_pdf) -        else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.cmd.inspect =~/M/ +        else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/          end -        SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.cmd =~/[MVv]/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/        end        def latexrun_selective          begin @@ -213,7 +213,7 @@ module SiSU_TeX                      if File.exist?(texfile) \                      and File.size(texfile) > 0                        @tex_f_no+=1 -                      #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.cmd.inspect =~/M/ #%% disable temporarily, re-enable +                      #p "#{__FILE__}:#{__LINE__} texpdf generation disabled" if @md.opt.cmd.inspect =~/M/ #%% disable temporarily, re-enable                        latex_do(texfile,ps)                      else                        puts "\tzero file size #{@env.processing_path.tex}/#{texfile}" @@ -255,11 +255,11 @@ module SiSU_TeX                ")              end            else -            SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn +            SiSU_Screen::Ansi.new(@md.opt.cmd,"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 -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          end        end      end @@ -295,7 +295,7 @@ module SiSU_TeX            data=@data            @@tex_footnote_array=[]            @@rights=nil -          SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape").txt_grey if @md.cmd=~/[MVvz]/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"pdfTex portrait & landscape").txt_grey if @md.opt.cmd=~/[MVvz]/            if defined? @md.rights.all \            and not @md.rights.all.empty?              rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed @@ -319,7 +319,7 @@ module SiSU_TeX              data=tables(data) #uncomment to start experimenting with tables            end            ocn=if @md.markup.inspect =~/no_ocn/ \ -          or @md.mod.inspect =~/--no-ocn/ \ +          or @md.opt.mod.inspect =~/--no-ocn/ \            or @skin_no_ocn              false            else true @@ -327,7 +327,7 @@ module SiSU_TeX            data=number_paras(data)            data=markup(data)            output(data) -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end @@ -656,7 +656,7 @@ WOK                        p: markup_common(dob.tmp[ps][:p]),                        l: markup_common(dob.tmp[ps][:l])                      } -                  else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ +                  else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/                    end                  end                end @@ -666,7 +666,7 @@ WOK                  p: markup_common(dob.tmp[:p]),                  l: markup_common(dob.tmp[:l])                } -            else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ +            else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/              end            end            @tex_file << dob @@ -690,7 +690,7 @@ WOK            paranum=dob.ocn ? dob.ocn : ''            paranum = '' if paranum.to_i==0            paranumber_display=if @md.markup.inspect =~/no_ocn/ \ -          or @md.mod.inspect =~/--no-ocn/ \ +          or @md.opt.mod.inspect =~/--no-ocn/ \            or not dob.ocn_              ''            else @@ -725,7 +725,7 @@ WOK                        l: number_paras_numbering(dob.tmp[ps][:l])                      }                      dob.tmp=para_hash -                  else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ +                  else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/                    end                  end                end @@ -734,7 +734,7 @@ WOK                  p: number_paras_numbering(dob.tmp[:p]),                  l: number_paras_numbering(dob.tmp[:l])                } -            else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ +            else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/              end            else              dob=if dob.of !~/comment|meta|layout/ @@ -770,7 +770,7 @@ WOK            if h[:l] !~/\A\s*\Z/              fn[:landscape].puts h[:l],"\n"            end -        else p "#{__FILE__}:#{__LINE__}" if @md.cmd.inspect =~/M/ +        else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/          end        end        def output(array) diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index b235e1fc..90dd7452 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -334,7 +334,7 @@ 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.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.cmd =~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/          @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 @@ -352,7 +352,7 @@ module SiSU_TeX_Pdf        elsif FileTest.file?("#{dir.path.image_source_include}/#{image}")          dir.path.image_source_include        else -        SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/          nil        end        if image_source #CHECK @@ -389,7 +389,7 @@ module SiSU_TeX_Pdf        else          unless image.nil? \          or image.length < 2 -          SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +          SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/          end          nil        end @@ -539,7 +539,7 @@ 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.cmd,%{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 @opt.cmd =~/q/ +              SiSU_Screen::Ansi.new(@md.opt.cmd,%{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 @opt.cmd =~/q/                images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]')              end              if image #most images fc etc. #% clean up ! @@ -576,7 +576,7 @@ module SiSU_TeX_Pdf                  end                  images_hash[ps]                else -                SiSU_Screen::Ansi.new(@md.cmd,"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.cmd =~/q/ +                SiSU_Screen::Ansi.new(@md.opt.cmd,"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.cmd =~/q/                  if images_hash[ps] =~url_image_rgx \                  or images_hash[ps] =~image_rgx                    images_hash[ps]='' @@ -1321,7 +1321,7 @@ WOK        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.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.cmd =~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.cmd =~/q/          " SiSU "        end        url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v3/update.rb index 7c35a5aa..473d3045 100644 --- a/lib/sisu/v3/update.rb +++ b/lib/sisu/v3/update.rb @@ -70,9 +70,9 @@ module SiSU_Update_control_flag          @env=SiSU_Env::Info_env.new(@md.fns)          out=@env.path.output          base_path="#{out}/#{@md.fnb}" -        SiSU_Screen::Ansi.new(@md.cmd,'Checking previous output',base_path).green_hi_blue unless @md.cmd =~/q/ +        SiSU_Screen::Ansi.new(@md.opt.cmd,'Checking previous output',base_path).green_hi_blue unless @md.opt.cmd =~/q/          Set_CF.new(@md).set_flags -      rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +      rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 900d9849..77952d0b 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -68,7 +68,7 @@ module SiSU_urls      end      def read        begin -        SiSU_urls::Output_urls.new(@opt).songsheet if @opt.fnb #fnb[/.+?\.(?:[_-]?sst|ssm)$/] +        SiSU_urls::Output_urls.new(@opt).songsheet if @opt.fnb        rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd).error        ensure        end @@ -129,25 +129,117 @@ module SiSU_urls        ensure        end      end +    def show +      def source +        def src(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.src}/#{y}").result +        end +        def pod(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}").result +        end +        self +      end +      def generic(x,y) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result +      end +      def meta(x,y) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result +      end +      def text(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt}/#{@md.file.base_filename.txt}").result +      end +      def epub(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub}/#{@md.file.base_filename.epub}").result +      end +      def html +        def scroll(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll}/#{@md.file.base_filename.html_scroll}").result +        end +        def toc(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg}/#{@md.file.base_filename.html_segtoc}").result +        end +        def concordance(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance}/#{@md.file.base_filename.html_concordance}").result +        end +        def manifest(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest}/#{@md.file.base_filename.manifest}").result +        end +        self +      end +      def odt(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt}/#{@md.file.base_filename.odt}").result +      end +      def pdf +        def portrait(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_p}pdf").result +        end +        def landscape(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_l}pdf").result +        end +        self +      end +      def manpage(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage}/#{@md.file.base_filename.manpage}").result +      end +      def pinfo(x,y) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.processing_path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -").result +      end +      def po4a +        def po(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po}/#{y}").result +        end +        def pot(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot}/#{y}").result +        end +        self +      end +      def xhtml(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml}/#{@md.file.base_filename.xhtml}").result +      end +      def xml +        def sax(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax}/#{@md.file.base_filename.xml_sax}").result +        end +        def dom(x) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom}/#{@md.file.base_filename.xml_dom}").result +        end +        def sitemap(x) #BROKEN +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemap}/#{@md.file.base_filename.sitemap}").result +        end +        self +      end +      def hash_digest(x) +        SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest}/#{@md.file.base_filename.hash_digest}").result +      end +      def db +        def psql(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result +        end +        def sqlite(x,y) +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}").result +        end +        self +      end +      self +    end      def urls_maintenance(opt,x,y)        if x=~/^([abcehHmNoptwxXy])/ \        and opt.cmd =~/[abcehHmNoptwxXy]/ \        and x=~/^[#{opt.cmd}]/ \ -      and opt.cmd =~/M/ +      and opt.cmd =~/[MV]/          m=$1          f=y          tool=@prog.text_editor          if x =~/^m/ \          and @opt.cmd=~/m/ \          and x=~/^[#{opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance if @opt.cmd =~/[MVv]/ +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance          end -        if x=~/^([hHw])/ \ -        and @opt.cmd=~/[hHw]/ \ -        and x=~/^[#{@opt.cmd}]/ -          f=if x !~/segmented/; "#{y}.html" -          else                  "#{y}.index.html" -          end +        if x=~/^([hw])/ \ +        and @opt.cmd=~/[hw]/ \ +        and x=~/^[#{@opt.cmd}]/ \ +        and x !~/segmented/; "#{y}.html" +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance          end          if x=~/^p/ \          and @opt.cmd=~/p/ \ @@ -155,11 +247,11 @@ module SiSU_urls            tool=@prog.pdf_viewer            fns=@opt.fns.gsub(/~/,'-')            unless @opt.cmd =~/q/ -            tell=if y =~/landscape/ +            tell=if x =~/landscape/                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex")              else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex")              end -            tell.maintenance if @opt.cmd =~/[MVv]/ +            tell.maintenance            end          end          if x=~/^o/ \ @@ -170,12 +262,13 @@ module SiSU_urls          if x=~/^e/ \          and @opt.cmd=~/e/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/OPS/toc.xhtml").maintenance if @opt.cmd =~/[MVv]/ +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/OPS/toc.xhtml").maintenance          end -        if x !~/^[me]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{tool} #{@env.path.output}/#{@fnb}/#{y}").maintenance if @opt.cmd =~/[MVv]/ +        if x=~/^o/ \ +        and @opt.cmd=~/o/ \ +        and x=~/^[#{@opt.cmd}]/ +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/content.xml").maintenance #not implemented          end -        #@opt.cmd.gsub!(/#{m}/,'')        end      end      def urls_select @@ -194,106 +287,95 @@ module SiSU_urls              if @opt.cmd =~/[MVv]/                if (x=~/^a/ and @opt.cmd =~/a/) \                or (x=~/^t/ and @opt.cmd =~/t/) -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt}/#{@md.file.base_filename.txt}").result +                show.text(x)                end                if x=~/^b/ \                and @opt.cmd =~/b/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml}/#{@md.file.base_filename.xhtml}").result +                show.xhtml(x)                end -#              if x=~/^[c]/ \ -#              and @opt.cmd =~/[c]/ -#                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest}/#{@md.file.base_filename.manifest}").result -#              end                if x=~/^D/ \                and @opt.cmd =~/D/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result +                show.db.psql(x,y)                end                if x=~/^d/ \                and @opt.cmd =~/d/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite3 #{@env.path.output}/sisu_sqlite.db", "#{y}").result +                show.db.sqlite(x,y)                end                if x=~/^e/ \                and @opt.cmd =~/e/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub}/#{@md.file.base_filename.epub}").result +                show.epub(x)                end                if x=~/^h/ \                and @opt.cmd =~/h/                  if x =~/scroll/ -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll}/#{@md.file.base_filename.html_scroll}").result +                  show.html.scroll(x)                  else -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg}/#{@md.file.base_filename.html_segtoc}").result +                  show.html.toc(x)                  end                end                if x=~/^I/ \                and @opt.cmd =~/I/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.processing_path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -").result +                show.pinfo(x,y)                end                if x=~/^i/ \                and @opt.cmd =~/i/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage}/#{@md.file.base_filename.manpage}").result +                show.manpage(x)                end                if x=~/^N/ \                and @opt.cmd =~/N/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest}/#{@md.file.base_filename.hash_digest}").result +                show.hash_digest(x)                end                if x=~/^o/ \                and @opt.cmd =~/o/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt}/#{@md.file.base_filename.odt}").result +                show.odt(x)                end                if x=~/^P/ \                and @opt.cmd =~/P/                  if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/                    f=y.gsub(/\.pot$/,'.po') -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po}/#{f}").result +                  show.po4a.po(x,f)                  else -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot}/#{y}").result +                  show.po4a.pot(x,f)                  end -                #@opt.cmd.gsub!(/P/,'')                end                if x=~/^p/ \                and @opt.cmd =~/p/                  if x =~/portrait/ -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_p}pdf").result +                  show.pdf.portrait(x)                  else -                  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf}/#{@md.file.base_filename.pdf_l}pdf").result +                  show.pdf.landscape(x)                  end                end -              #if x=~/^P/ \ -              #and @opt.cmd =~/P/ -              #  SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Profile","#{@pwd_stub}::#{@opt.fns}",y).result -              #  @opt.cmd.gsub!(/P/,'') -              #end                if x=~/^S/ \                and @opt.cmd =~/S/                  zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip')                  else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1')                  end -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}").result +                show.source.pod(x,y)                end                if x=~/^s/ \                and @opt.cmd =~/s/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.src}/#{y}").result +                show.source.src(x,y)                end                if x=~/^w/ \                and @opt.cmd =~/w/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance}/#{@md.file.base_filename.html_concordance}").result +                show.html.concordance(x)                end                if x=~/^X/ \                and @opt.cmd =~/X/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom}/#{@md.file.base_filename.xml_dom}").result +                show.xml.dom(x)                end                if x=~/^x/ \                and @opt.cmd =~/x/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax}/#{@md.file.base_filename.xml_sax}").result +                show.xml.sax(x)                end                if x=~/^Y/ \                and @opt.cmd =~/Y/ #BROKEN -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemap}/#{@md.file.base_filename.sitemap}").result +                show.xml.sitemap(x)                end -                if x=~/^y/ \                and @opt.cmd =~/y/ -                SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest}/#{@md.file.base_filename.manifest}").result +                show.html.manifest(x)                end              end              urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/ @@ -307,26 +389,38 @@ module SiSU_urls        @u.each do |x,y|          tell=case x          when /^m/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}") -        when /^[bBcdhNopswxXy]/ -          tellx=SiSU_Screen::Ansi.new(@opt.cmd,"-p (LaTeX)","#{@prog.text_editor} ~work/tex_rz/#{@fnb}.tex") if y=~/landscape/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}") +          show.meta(x,y) +        when /^[BcdNsxXy]/ +          show.generic(x,y)          when /^[at]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt}/#{@md.file.base_filename.txt}") #.result +          show.text(x) +        when /^b/ +          show.xhtml(x)          when /^e/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.epub_viewer} #{@env.path.output}/epub/#{y}") +          show.epub(x) +        when /^h/ +          if x =~/scroll/ +            show.html.scroll(x) +          else +            show.html.toc(x) +          end +        when /^o/ +          show.odt(x) +        when /^p/ +          if x =~/portrait/ +            show.pdf.portrait(x) +          else +            show.pdf.landscape(x) +          end +        when /^w/ +          show.html.concordance(x)          when /^Y/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.web_browser} #{@env.url.output_tell}/sitemap/#{y}") +          show.xml.sitemap(x)          when /^I/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@env.processing_path.texinfo}; pinfo ./#{@fnb}.#{y}; cd -") +          show.pinfo(x,y)          when /^i/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@env.processing_path.manpage}/#{@fnb}.1") -        end -        unless @opt.cmd =~/q/ -          tellx.result if tellx -          tell.result if tell +          show.manpage(x)          end -        tellx=nil        end      end    end diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index 2b791a31..0871170a 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -107,9 +107,9 @@ module SiSU_XHTML        def song          begin            SiSU_XHTML::Source::Scroll.new(@particulars).songsheet -          SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use -          SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +          SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use +          SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end @@ -401,16 +401,16 @@ WOK        end        def xml          if @prog.tidy !=false -          if @md.cmd =~/[VM]/ -            unless @md.cmd =~/q/ -              SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') +          if @md.opt.cmd =~/[VM]/ +            unless @md.opt.cmd =~/q/ +              SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize +              tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','')                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:xhtml]}",tidyfile)              tidy.well_formed? -            tell.p_off unless @md.cmd =~/q/ +            tell.p_off unless @md.opt.cmd =~/q/            end          end        end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index 9b9bc3f5..1e68000b 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -107,9 +107,9 @@ module SiSU_XML_SAX        def song          begin            SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet -          SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use -          SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +          SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use +          SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end @@ -443,16 +443,16 @@ WOK        end        def xml          if @prog.tidy !=false #note values can be other than true -          if @md.cmd =~/[VM]/ -            unless @md.cmd =~/q/ -              SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize -              tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') +          if @md.opt.cmd =~/[VM]/ +            unless @md.opt.cmd =~/q/ +              SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize +              tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','')                tell.grey_open              end              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:sax]}",tidyfile)              tidy.well_formed? -            tell.p_off unless @md.cmd =~/q/ +            tell.p_off unless @md.opt.cmd =~/q/            end          end        end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 02180617..3f18a1b8 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -104,9 +104,9 @@ module SiSU_XML_DOM        def songsheet          begin            SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet -          SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use -          SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug -        rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error +          SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use +          SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug +        rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error          ensure          end        end @@ -519,14 +519,14 @@ WOK        end        def xml          if @prog.tidy !=false -          if @md.cmd =~/[VM]/ -            SiSU_Screen::Ansi.new(@md.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.cmd =~/q/ -            tell=SiSU_Screen::Ansi.new(@md.cmd,'invert','','') -            tell.grey_open unless @md.cmd =~/q/ +          if @md.opt.cmd =~/[VM]/ +            SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/ +            tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') +            tell.grey_open unless @md.opt.cmd =~/q/              tidyfile='/dev/null' #don't want one or screen output, check for alternative flags              tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:dom]}",tidyfile)              tidy.well_formed? -            tell.p_off unless @md.cmd =~/q/ +            tell.p_off unless @md.opt.cmd =~/q/            end          end        end diff --git a/lib/sisu/v3/xml_fictionbook.rb b/lib/sisu/v3/xml_fictionbook.rb index 09a9e5aa..277d4adc 100644 --- a/lib/sisu/v3/xml_fictionbook.rb +++ b/lib/sisu/v3/xml_fictionbook.rb @@ -181,7 +181,7 @@ WOK        end        def put(line)          @file_fictionbook.puts line -        puts line if @md.cmd =~/V/ +        puts line if @md.opt.cmd =~/V/        end        def structure_build_tag_close(lev,h)          @sp='  ' @@ -261,7 +261,7 @@ WOK              y="#{@sp*6}<#{@s[6]}>\n#{x[:para]}"              @h[0]=6            else -            y=if @md.cmd =~/V/; "#{x[:para]}" +            y=if @md.opt.cmd =~/V/; "#{x[:para]}"              else nil              end            end @@ -286,7 +286,7 @@ WOK                @ds[c][:para]=markup(para,'title')              else                @ds[c]={} -              @ds[c][:para]=markup(para) if @md.cmd =~/V/ +              @ds[c][:para]=markup(para) if @md.opt.cmd =~/V/              end              c+=1            end diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb index dd41a094..a3539f60 100644 --- a/lib/sisu/v3/xml_format.rb +++ b/lib/sisu/v3/xml_format.rb @@ -342,7 +342,7 @@ WOK      end      def ocn_display        if @md.markup.inspect =~/no_ocn/ \ -      or @md.mod.inspect =~/--no-ocn/ \ +      or @md.opt.mod.inspect =~/--no-ocn/ \        or @skin_no_ocn          ocn_class='ocn_off'          @ocn.gsub(/^(\d+|)$/, @@ -1225,7 +1225,7 @@ WOK          else nil          end        else -        if @md.cmd =~/M/ +        if @md.opt.cmd =~/M/            p __FILE__ +':'+ __LINE__.to_s            p t_o.class            p caller diff --git a/lib/sisu/v3/xml_scaffold.rb b/lib/sisu/v3/xml_scaffold.rb index 1e423bea..fdd3e5b3 100644 --- a/lib/sisu/v3/xml_scaffold.rb +++ b/lib/sisu/v3/xml_scaffold.rb @@ -103,8 +103,8 @@ module SiSU_XML_scaffold          #  'sect2'            #  'section'          #]                    #]          data=@data -        structure_outline(data) if @md.cmd =~/V/ -        structure_simple(data) if @md.cmd =~/V/ +        structure_outline(data) if @md.opt.cmd =~/V/ +        structure_simple(data) if @md.opt.cmd =~/V/          structure_build(data)        end        def structure_outline(data) | 
