aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-05-17 18:07:38 -0400
committerRalph Amissah <ralph@amissah.com>2011-05-17 18:07:44 -0400
commitd87f4ffff1d3d00f5acf02ebb73dbb85be94ab8e (patch)
tree658036a5021e1b48c024d7be7b335654d4082991
parentv3: 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
-rw-r--r--data/doc/sisu/CHANGELOG_v36
-rw-r--r--lib/sisu/v3/options.rb47
2 files changed, 26 insertions, 27 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index f35050bd..854acfad 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -28,6 +28,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.9.orig.tar.gz
* copyright file, softlink, make more visible in tarball and update
* sisu-mode.el assigned to FSF (GNU EMACS)
+ * options, expand name of 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
+
* sysenv
* output directory structure check, fix & start testing alternatives
sisurc.yml output_by: (language|filetype|filename)
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