diff options
| author | Ralph Amissah <ralph@amissah.com> | 2012-12-28 12:31:04 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2012-12-28 12:31:04 -0500 | 
| commit | e791dbbdd0097b6bba0829000408ab30d0810fbe (patch) | |
| tree | bb5a341e757b38f9335ce2c8aa2884e28facdb39 /lib | |
| parent | v4: sisu: --color flag, which toggles color on/off (Closes: #622171) (diff) | |
v4 v3: largely cosmetic
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sisu/v3/dal.rb | 56 | ||||
| -rw-r--r-- | lib/sisu/v3/epub_format.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v3/html.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v3/options.rb | 12 | ||||
| -rw-r--r-- | lib/sisu/v3/particulars.rb | 110 | ||||
| -rw-r--r-- | lib/sisu/v3/sst_from_xml.rb | 9 | ||||
| -rw-r--r-- | lib/sisu/v3/sysenv.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v4/dal.rb | 56 | ||||
| -rw-r--r-- | lib/sisu/v4/epub.rb | 1 | ||||
| -rw-r--r-- | lib/sisu/v4/html.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v4/options.rb | 3 | ||||
| -rw-r--r-- | lib/sisu/v4/particulars.rb | 110 | ||||
| -rw-r--r-- | lib/sisu/v4/plaintext.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v4/sst_from_xml.rb | 9 | 
14 files changed, 184 insertions, 224 deletions
| diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index 0e816091..1fa0ecb9 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -287,59 +287,51 @@ module SiSU_DAL      end      def read_fnm        dal=[] -      dal=if FileTest.file?(@fnm) -        File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)} -      else SiSU_DAL::Source.new(@opt).create_dal -      end +      dal=(FileTest.file?(@fnm)) \ +      ? (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}) +      : SiSU_DAL::Source.new(@opt).create_dal      end      def read_fnc        dal=[] -      dal=if FileTest.file?(@fnc) -        File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)} -      else SiSU_DAL::Source.new(@opt).create_dal -      end +      dal=(FileTest.file?(@fnc)) \ +      ? (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)}) +      : SiSU_DAL::Source.new(@opt).create_dal      end      def read_idx_sst        m=[] -      m=if FileTest.file?(@idx_sst) -        File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_sst)) \ +      ? (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_raw        m=[] -      m=if FileTest.file?(@idx_raw) -        File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_raw)) \ +      ? (File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_html        m=[] -      m=if FileTest.file?(@idx_html) -        File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_html)) \ +      ? (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_xhtml        m=[] -      m=if FileTest.file?(@idx_xhtml) -        File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_xhtml)) \ +      ? (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_map_nametags        m=[] -      m=if FileTest.file?(@map_nametags) -        File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@map_nametags)) \ +      ? (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_map_ocn_htmlseg        m=[] -      m=if FileTest.file?(@map_ocn_htmlseg) -        File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@map_ocn_htmlseg)) \ +      ? (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end    end    class Output diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 70636fb1..1cc87294 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -64,8 +64,8 @@ module SiSU_EPUB_Format        vz=SiSU_Env::GetInit.instance.skin      end      def ocn_display -      @make=SiSU_Env::ProcessingSettings.new(@md) -      if @make.build.ocn? +      make=SiSU_Env::ProcessingSettings.new(@md) +      if make.build.ocn?          ocn_class='ocn'          if @ocn.to_i==0            @ocn.gsub(/^(\d+|)$/, diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 132394d6..4c826af1 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -100,15 +100,15 @@ module SiSU_HTML          end          SiSU_Env::InfoSkin.new(@md).select          data=nil -        @tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions -        data=@tuned_file_array +        tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions +        data=tuned_file_array          scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll          toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet          links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc -        data=@tuned_file_array +        data=tuned_file_array          scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch          SiSU_HTML::Source::Seg.new(@md,data).songsheet -        data=@tuned_file_array +        data=tuned_file_array          scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet          scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish          SiSU_HTML::Source::Output.new(scroll,@md).scroll @@ -143,12 +143,9 @@ module SiSU_HTML        end        def tuned_file_instructions          @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 =~/[hw]/ -        newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/          dal_array=@particulars.dal_array # dal file drawn here -        @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet -        @tuned_file_array +        tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet +        tuned_file_array        end      end      class LinksGuide diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 39c392a9..344a0b55 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -845,6 +845,9 @@ module SiSU_Commandline      def fns        @fns      end +    def fnl +      x=@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") +    end      def what        @what      end @@ -868,9 +871,6 @@ module SiSU_Commandline    end  end  __END__ -note usually named @opt -is carried in Param usually as @md -@opt is a subset of @md -where @md is passed, contents of @opt are available -passing @opt as well is duplication -check for fns & fnb +note usually named @opt is carried in Param usually as @md @opt is a subset of +@md where @md is passed, contents of @opt are available as @md.opt passing @opt +as well is duplication check for fns & fnb diff --git a/lib/sisu/v3/particulars.rb b/lib/sisu/v3/particulars.rb index 97a3da3e..57ffea3f 100644 --- a/lib/sisu/v3/particulars.rb +++ b/lib/sisu/v3/particulars.rb @@ -66,169 +66,155 @@ module SiSU_Particulars    class CombinedSingleton      include Singleton      def get_all(opt) -      @opt=opt -      set_env -      set_file -      set_md -      set_dal                #needs @md +      set_env(opt) +      set_file(opt) +      set_md(opt) +      set_dal(opt)                #needs @md      end      def get_env(opt) -      @opt=opt -      set_env +      set_env(opt)      end      def get_file(opt) -      @opt=opt -      set_file +      set_file(opt)      end      def get_md(opt) -      @opt=opt -      set_md +      set_md(opt)      end      def get_dal_array(opt) -      @opt=opt -      set_dal                #needs @md +      set_dal(opt)                #needs @md      end      def get_env_md(opt) -      @opt=opt -      set_env -      set_md +      set_env(opt) +      set_md(opt)      end      def get_idx_sst(opt) -      @opt=opt -      set_sst_idx +      set_sst_idx(opt)      end      def get_idx_raw(opt) -      @opt=opt -      set_raw_idx +      set_raw_idx(opt)      end      def get_idx_html(opt) -      @opt=opt -      set_html_idx +      set_html_idx(opt)      end      def get_idx_xhtml(opt) -      @opt=opt -      set_xhtml_idx +      set_xhtml_idx(opt)      end      def get_name_tags(opt) -      @opt=opt -      set_name_tags +      set_name_tags(opt)      end      def get_maps(opt) -      @opt=opt -      set_nametags_map -      set_ocn_htmlseg_map +      set_nametags_map(opt) +      set_ocn_htmlseg_map(opt)      end      def get_map_nametags(opt) -      @opt=opt -      set_nametags_map +      set_nametags_map(opt)      end      def get_map_ocn_htmlseg(opt) -      @opt=opt -      set_ocn_htmlseg_map +      set_ocn_htmlseg_map(opt)      end      attr_accessor :opt,:md,:sst_idx,:raw_idx,:html_idx,:xhtml_idx -    def set_md +    def set_md(opt)        begin -        @md=SiSU_Param::Parameters.new(@opt).get +        @md=SiSU_Param::Parameters.new(opt).get          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :opt,:env,:file -    def set_env +    def set_env(opt)        begin -        @env=SiSU_Env::InfoEnv.new(@opt.fns) +        @env=SiSU_Env::InfoEnv.new(opt.fns)          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_file +    def set_file(opt)        begin -        set_md unless @md +        set_md(opt) unless @md          @file=SiSU_Env::FileOp.new(@md)          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :opt,:dal_array -    def set_dal +    def set_dal(opt)        begin -        @dal_array=SiSU_DAL::Source.new(@opt).get +        @dal_array=SiSU_DAL::Source.new(opt).get          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_sst_idx +    def set_sst_idx(opt)        begin -        @sst_idx=SiSU_DAL::Source.new(@opt).get_idx_sst +        @sst_idx=SiSU_DAL::Source.new(opt).get_idx_sst          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_raw_idx +    def set_raw_idx(opt)        begin -        @raw_idx=SiSU_DAL::Source.new(@opt).get_idx_raw +        @raw_idx=SiSU_DAL::Source.new(opt).get_idx_raw          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_html_idx +    def set_html_idx(opt)        begin -        @html_idx=SiSU_DAL::Source.new(@opt).get_idx_html +        @html_idx=SiSU_DAL::Source.new(opt).get_idx_html          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_xhtml_idx +    def set_xhtml_idx(opt)        begin -        @xhtml_idx=SiSU_DAL::Source.new(@opt).get_idx_xhtml +        @xhtml_idx=SiSU_DAL::Source.new(opt).get_idx_xhtml          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :nametags_map -    def set_nametags_map +    def set_nametags_map(opt)        begin -        opt=@md ? @md : @opt +        opt=@md ? @md : opt          @nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :ocn_htmlseg_map -    def set_ocn_htmlseg_map +    def set_ocn_htmlseg_map(opt)        begin          @ocn_htmlseg_map=SiSU_DAL::Source.new(@md).get_map_ocn_htmlseg          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end diff --git a/lib/sisu/v3/sst_from_xml.rb b/lib/sisu/v3/sst_from_xml.rb index ab55f0de..73dccc25 100644 --- a/lib/sisu/v3/sst_from_xml.rb +++ b/lib/sisu/v3/sst_from_xml.rb @@ -144,15 +144,18 @@ module SiSU_sstFromXML              end            end            if xml =~/\.sxs\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'sax') +            unless @opt.cmd =~/q/ +              tell(xml,'sax')              end              sax            elsif xml =~/\.sxd\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'dom') +            unless @opt.cmd =~/q/ +              tell(xml,'dom')              end              dom            elsif xml =~/\.sxn\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'node') +            unless @opt.cmd =~/q/ +              tell(xml,'node')              end              node            else puts "filename not recognised: << #{xml} >>" diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index c4b364ad..879e614d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3499,7 +3499,9 @@ WOK        @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns)      end      def doc_rc #document rc, make instructions -      @md.make +      (defined? @md.make) \ +      ? @md.make +      : nil      end      def cmd_rc_act #command-line rc        @cmd_rc_act=@md.opt.opt_act diff --git a/lib/sisu/v4/dal.rb b/lib/sisu/v4/dal.rb index 0e816091..1fa0ecb9 100644 --- a/lib/sisu/v4/dal.rb +++ b/lib/sisu/v4/dal.rb @@ -287,59 +287,51 @@ module SiSU_DAL      end      def read_fnm        dal=[] -      dal=if FileTest.file?(@fnm) -        File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)} -      else SiSU_DAL::Source.new(@opt).create_dal -      end +      dal=(FileTest.file?(@fnm)) \ +      ? (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}) +      : SiSU_DAL::Source.new(@opt).create_dal      end      def read_fnc        dal=[] -      dal=if FileTest.file?(@fnc) -        File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)} -      else SiSU_DAL::Source.new(@opt).create_dal -      end +      dal=(FileTest.file?(@fnc)) \ +      ? (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)}) +      : SiSU_DAL::Source.new(@opt).create_dal      end      def read_idx_sst        m=[] -      m=if FileTest.file?(@idx_sst) -        File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_sst)) \ +      ? (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_raw        m=[] -      m=if FileTest.file?(@idx_raw) -        File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_raw)) \ +      ? (File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_html        m=[] -      m=if FileTest.file?(@idx_html) -        File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_html)) \ +      ? (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_idx_xhtml        m=[] -      m=if FileTest.file?(@idx_xhtml) -        File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@idx_xhtml)) \ +      ? (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_map_nametags        m=[] -      m=if FileTest.file?(@map_nametags) -        File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@map_nametags)) \ +      ? (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end      def read_map_ocn_htmlseg        m=[] -      m=if FileTest.file?(@map_ocn_htmlseg) -        File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)} -      else nil -      end +      m=(FileTest.file?(@map_ocn_htmlseg)) \ +      ? (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)}) +      : nil      end    end    class Output diff --git a/lib/sisu/v4/epub.rb b/lib/sisu/v4/epub.rb index 9ac4b610..73ccf0c4 100644 --- a/lib/sisu/v4/epub.rb +++ b/lib/sisu/v4/epub.rb @@ -140,7 +140,6 @@ module SiSU_EPUB        end        def tuned_file_instructions          @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) -        @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h')          directories          dal_array=@particulars.dal_array # dal file drawn here          @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet diff --git a/lib/sisu/v4/html.rb b/lib/sisu/v4/html.rb index f9162192..9cdd0254 100644 --- a/lib/sisu/v4/html.rb +++ b/lib/sisu/v4/html.rb @@ -99,15 +99,15 @@ module SiSU_HTML            SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").flow if @opt.cmd =~/[MV]/          end          data=nil -        @tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions -        data=@tuned_file_array +        tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions +        data=tuned_file_array          scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll          toc=SiSU_HTML::Source::Toc.new(@md,data).songsheet          links_guide=SiSU_HTML::Source::LinksGuide.new(data,@md).toc -        data=@tuned_file_array +        data=tuned_file_array          scr_toc=SiSU_HTML::Source::ScrollHeadAndSegToc.new(@md,toc,links_guide).in_common #watch          SiSU_HTML::Source::Seg.new(@md,data).songsheet -        data=@tuned_file_array +        data=tuned_file_array          scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet          scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish          SiSU_HTML::Source::Output.new(scroll,@md).scroll @@ -142,12 +142,9 @@ module SiSU_HTML        end        def tuned_file_instructions          @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 =~/[hw]/ -        newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/          dal_array=@particulars.dal_array # dal file drawn here -        @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet -        @tuned_file_array +        tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet +        tuned_file_array        end      end      class LinksGuide diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index 9b9e1249..96ca66cc 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -941,6 +941,9 @@ module SiSU_Commandline      def fns        @fns      end +    def fnl +      x=@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") +    end      def what        @what      end diff --git a/lib/sisu/v4/particulars.rb b/lib/sisu/v4/particulars.rb index 97a3da3e..57ffea3f 100644 --- a/lib/sisu/v4/particulars.rb +++ b/lib/sisu/v4/particulars.rb @@ -66,169 +66,155 @@ module SiSU_Particulars    class CombinedSingleton      include Singleton      def get_all(opt) -      @opt=opt -      set_env -      set_file -      set_md -      set_dal                #needs @md +      set_env(opt) +      set_file(opt) +      set_md(opt) +      set_dal(opt)                #needs @md      end      def get_env(opt) -      @opt=opt -      set_env +      set_env(opt)      end      def get_file(opt) -      @opt=opt -      set_file +      set_file(opt)      end      def get_md(opt) -      @opt=opt -      set_md +      set_md(opt)      end      def get_dal_array(opt) -      @opt=opt -      set_dal                #needs @md +      set_dal(opt)                #needs @md      end      def get_env_md(opt) -      @opt=opt -      set_env -      set_md +      set_env(opt) +      set_md(opt)      end      def get_idx_sst(opt) -      @opt=opt -      set_sst_idx +      set_sst_idx(opt)      end      def get_idx_raw(opt) -      @opt=opt -      set_raw_idx +      set_raw_idx(opt)      end      def get_idx_html(opt) -      @opt=opt -      set_html_idx +      set_html_idx(opt)      end      def get_idx_xhtml(opt) -      @opt=opt -      set_xhtml_idx +      set_xhtml_idx(opt)      end      def get_name_tags(opt) -      @opt=opt -      set_name_tags +      set_name_tags(opt)      end      def get_maps(opt) -      @opt=opt -      set_nametags_map -      set_ocn_htmlseg_map +      set_nametags_map(opt) +      set_ocn_htmlseg_map(opt)      end      def get_map_nametags(opt) -      @opt=opt -      set_nametags_map +      set_nametags_map(opt)      end      def get_map_ocn_htmlseg(opt) -      @opt=opt -      set_ocn_htmlseg_map +      set_ocn_htmlseg_map(opt)      end      attr_accessor :opt,:md,:sst_idx,:raw_idx,:html_idx,:xhtml_idx -    def set_md +    def set_md(opt)        begin -        @md=SiSU_Param::Parameters.new(@opt).get +        @md=SiSU_Param::Parameters.new(opt).get          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :opt,:env,:file -    def set_env +    def set_env(opt)        begin -        @env=SiSU_Env::InfoEnv.new(@opt.fns) +        @env=SiSU_Env::InfoEnv.new(opt.fns)          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_file +    def set_file(opt)        begin -        set_md unless @md +        set_md(opt) unless @md          @file=SiSU_Env::FileOp.new(@md)          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :opt,:dal_array -    def set_dal +    def set_dal(opt)        begin -        @dal_array=SiSU_DAL::Source.new(@opt).get +        @dal_array=SiSU_DAL::Source.new(opt).get          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_sst_idx +    def set_sst_idx(opt)        begin -        @sst_idx=SiSU_DAL::Source.new(@opt).get_idx_sst +        @sst_idx=SiSU_DAL::Source.new(opt).get_idx_sst          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_raw_idx +    def set_raw_idx(opt)        begin -        @raw_idx=SiSU_DAL::Source.new(@opt).get_idx_raw +        @raw_idx=SiSU_DAL::Source.new(opt).get_idx_raw          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_html_idx +    def set_html_idx(opt)        begin -        @html_idx=SiSU_DAL::Source.new(@opt).get_idx_html +        @html_idx=SiSU_DAL::Source.new(opt).get_idx_html          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end -    def set_xhtml_idx +    def set_xhtml_idx(opt)        begin -        @xhtml_idx=SiSU_DAL::Source.new(@opt).get_idx_xhtml +        @xhtml_idx=SiSU_DAL::Source.new(opt).get_idx_xhtml          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :nametags_map -    def set_nametags_map +    def set_nametags_map(opt)        begin -        opt=@md ? @md : @opt +        opt=@md ? @md : opt          @nametags_map=SiSU_DAL::Source.new(opt).get_map_nametags          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end      end      attr_accessor :ocn_htmlseg_map -    def set_ocn_htmlseg_map +    def set_ocn_htmlseg_map(opt)        begin          @ocn_htmlseg_map=SiSU_DAL::Source.new(@md).get_map_ocn_htmlseg          self        rescue -        SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do +        SiSU_Errors::InfoError.new($!,$@,opt.cmd,opt.fnl).error do            __LINE__.to_s + ':' + __FILE__          end        end diff --git a/lib/sisu/v4/plaintext.rb b/lib/sisu/v4/plaintext.rb index 5ad35447..29f62ee1 100644 --- a/lib/sisu/v4/plaintext.rb +++ b/lib/sisu/v4/plaintext.rb @@ -73,7 +73,7 @@ module SiSU_Plaintext      def initialize(opt)        @opt=opt        unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/ -       puts "#{sf} not a processed file type" +        puts "#{sf} not a processed file type"        end      end      def read @@ -112,7 +112,7 @@ module SiSU_Plaintext      class Scroll <Source        require_relative 'defaults'                       # defaults.rb        require_relative 'shared_txt'                     # shared_txt.rb -      include SiSU_TextUtils +        include SiSU_TextUtils        @@endnotes={ para: [], end: [] }        def initialize(data,md,wrap_width)          @data,@md,@wrap_width=data,md,wrap_width diff --git a/lib/sisu/v4/sst_from_xml.rb b/lib/sisu/v4/sst_from_xml.rb index ab55f0de..73dccc25 100644 --- a/lib/sisu/v4/sst_from_xml.rb +++ b/lib/sisu/v4/sst_from_xml.rb @@ -144,15 +144,18 @@ module SiSU_sstFromXML              end            end            if xml =~/\.sxs\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'sax') +            unless @opt.cmd =~/q/ +              tell(xml,'sax')              end              sax            elsif xml =~/\.sxd\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'dom') +            unless @opt.cmd =~/q/ +              tell(xml,'dom')              end              dom            elsif xml =~/\.sxn\.xml$/ -            unless @opt.cmd =~/q/; tell(xml,'node') +            unless @opt.cmd =~/q/ +              tell(xml,'node')              end              node            else puts "filename not recognised: << #{xml} >>" | 
