diff options
| author | Ralph Amissah <ralph@amissah.com> | 2011-05-17 18:07:38 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2011-05-17 18:07:44 -0400 | 
| commit | d87f4ffff1d3d00f5acf02ebb73dbb85be94ab8e (patch) | |
| tree | 658036a5021e1b48c024d7be7b335654d4082991 /lib | |
| parent | v3: embedded, source path (diff) | |
v3: options, expand name of source file for selected language directories
* only use for single file(name) available in multiple languages e.g.
  sisu3 -hv en/free_culture.lawrence_lessig.sst es fr
* english assumed as default language, make default configurable later
* particularly useful for po4a
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sisu/v3/options.rb | 47 | 
1 files changed, 20 insertions, 27 deletions
| diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 30f857f6..aabbd946 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -63,43 +63,35 @@ module SiSU_commandline    class Options      attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what      def initialize(a) -      @a=a +      @x=a        @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng='','','','','','','','','',''        @f_pths,@files,@paths,@mod,@act=Array.new(5){[]}        @env=SiSU_Env::Info_env.new        @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by?        r=Px[:lng_lst].join('|') -      #r.gsub!(/\|en\|/,'|') +      r.gsub!(/\|en\|/,'|')        @lang_regx=%r{(?:#{r})} -      if a.inspect =~/"(?:-\S|--\S+?)"/ \ -      and a.inspect =~/"#{@lang_regx}"/ \ -      and a.inspect =~/"en\/\S+?\.ss[tm]"/ -        init_po +      @a=if a.inspect =~/"(?:-\S+?|--\S+?)"/ \ +      && a.inspect =~/"#{@lang_regx}\/?"/ \ +      && a.inspect =~/"en\/\S+?\.ss[tm]"/ +        init_selected_lang_dirs(a) +      else @x        end +      @a.freeze        init      end -    def init_po -      a=@a -      if a.inspect =~/"(?:-\S|--\S+?)"/ \ -      and a.inspect =~/"#{@lang_regx}"/ \ -      and a.inspect =~/"en\/\S+?\.ss[tm]"/ -        x,z=[],[] -        l=nil -        a.each do |y| -          if y =~/^(?:-\S|--\S+?)$/ -            x << y -          elsif y =~/^en\/(\S+?\.ss[tm])$/ -            l=$1 -            x << y -          elsif y =~/^#{@lang_regx}$/ -            z = x.dup -            z << y + '/' + l -            SiSU_commandline::Options.new(z) -            z=[] -          end +    def init_selected_lang_dirs(a) +      @z=[] +      a.each do |y| +        if y =~/^en\/(\S+?\.ss[tm])$/ +          @fn=$1 +          @z << y +        elsif y =~/^#{@lang_regx}\/?$/ +          @z << "#{y}/#{@fn}" +        else @z << y          end        end -      self +      @z      end      def init        a=@a @@ -414,7 +406,8 @@ module SiSU_commandline          true        else false        end -      act[:po4a]=if mod.inspect =~/"--po4a"|"--po"/ +      act[:po4a]=if cmd =~/P/ \ +      or mod.inspect =~/"--po4a"|"--pot?"/          true        else false        end | 
