From 0491018d2df353ea1a9990434ba03c7d0ec07a32 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 1 Feb 2011 19:07:29 -0500
Subject: v3 po4a, options, shortcut representation for processing, keep
 working on

* sisu --po4a en/live-manual.ssm fr
   instead of:
   sisu --po4a en/live-manual.ssm fr/live-manual.ssm
   test:
   sisu --po4a en/live-manual.ssm fr de
---
 lib/sisu/v3/options.rb | 43 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

(limited to 'lib')

diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index fa1fc973..4364b06c 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -63,9 +63,47 @@ module SiSU_commandline
   class Options
     attr_accessor :cmd,:mod,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:what
     def initialize(a)
-      @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,c,w,s='','','','','','','','','','','',''
-      @f_pths,@files,@paths,@mod,m,f,pth,z,ca=[],[],[],[],[],[],[],[],[]
+      @a=a
+      @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what='','','','','','','','',''
+      @f_pths,@files,@paths,@mod=[],[],[],[]
       @env=SiSU_Env::Info_env.new
+      r=Px[:lng_lst].join('|')
+      #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
+      end
+      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
+        end
+      end
+      self
+    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
@@ -203,6 +241,7 @@ module SiSU_commandline
         end
       end
       @files
+      self
     end
     def cmd
       @cmd
-- 
cgit v1.2.3