diff options
Diffstat (limited to 'lib/sisu/v5/options.rb')
-rw-r--r-- | lib/sisu/v5/options.rb | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 2133a812..b7bf98a6 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -159,7 +159,6 @@ module SiSU_Commandline end def find_all(find_flag,opt) if find_flag - pwd_set=Dir.pwd x=Dir.glob('*.ss[tm]') Px[:lng_lst].each do |d| if FileTest.directory?(d) @@ -172,7 +171,6 @@ module SiSU_Commandline end def find_select(find_flag,opt) if find_flag - pwd_set=Dir.pwd x=[] if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/ opt.each do |g| @@ -221,7 +219,7 @@ module SiSU_Commandline end r=Px[:lng_lst_rgx].gsub(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} - z=if find_flag + if find_flag (f.length > 0) \ ? (b + find_select(find_flag,f)) : find_all(find_flag,b) @@ -270,9 +268,7 @@ module SiSU_Commandline SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown end end -# @files=@files.uniq @@act ? @act=@@act : @@act=@act=opt_act - @files self end def sisu_document_make_pod @@ -283,7 +279,7 @@ module SiSU_Commandline "#{pod_make_path}/#{makefile_name}" end def makefile_read(pod_make_path) - f=if FileTest.file?(makefile(pod_make_path)) + if FileTest.file?(makefile(pod_make_path)) sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8') sisu_doc_makefile.split(/\s*\n\s*\n/m) else nil @@ -293,7 +289,7 @@ module SiSU_Commandline end def set_files_and_paths_and_general_extract(s) c,w='','' - m,f,pth,z,lng,lngs=[],[],[],[],[],[] + m,f,pth,lng,lngs=[],[],[],[],[] lng_is='' a=s.split(/\s+/) r_l=Px[:lng_lst].join('|') @@ -316,11 +312,9 @@ module SiSU_Commandline pt=Pathname.new(fullname) FileUtils::mkdir_p(pt.to_s) pod_make_path=fullname + '/sisupod/doc/_sisu' - pod_make_path_file=pod_make_path make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions Dir.chdir(pt.realpath) - options=s.gsub(/(\s+--?\S+)+.+/,'\1') system(" chdir #{fullname} tar xaf #{pwd}/#{x} @@ -470,38 +464,37 @@ module SiSU_Commandline cmd,mod,files=@cmd,@mod,@files if not m.empty? \ and m.inspect =~/"--pdf-/ - ps,psa='',[] - mod << '--pdf' - m.each do |m| - if m =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ - mod << '--landscape' - end - if m =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ - mod << '--portrait' - end - if m =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ - if m =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ - mod << '--papersize-a4' - end - if m =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ - mod << '--papersize-a5' - end - if m =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ - mod << '--papersize-b5' - end - if m =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ - mod << '--papersize-letter' - end - if m =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ - mod << '--papersize-legal' - end - end - end - mod=mod.uniq + mod << '--pdf' + m.each do |s| + if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/ + mod << '--landscape' + end + if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/ + mod << '--portrait' + end + if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/ + if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/ + mod << '--papersize-a4' + end + if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/ + mod << '--papersize-a5' + end + if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/ + mod << '--papersize-b5' + end + if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/ + mod << '--papersize-letter' + end + if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/ + mod << '--papersize-legal' + end + end + end + mod=mod.uniq end unless m.empty? - m.each do |m| - case m + m.each do |s| + case s when /^--(?:color-toggle)$/; c=c+'c' when /^--(?:color-off)$/; c=c+'k' when /^--(?:conf|config|configure|init|initialize|init-site)$/; c=c+'CC' @@ -509,7 +502,7 @@ module SiSU_Commandline when /^--(?:txt|text|plaintext)$/; c=c+'t' when /^--(?:html)$/; c=c+'h' when /^--(?:html-scroll|html-seg)$/; c=c+'H' - mod << m + mod << s when /^--(?:epub)$/; c=c+'e' when /^--(?:od[ft])$/; c=c+'o' when /^--(?:pdf)$/; c=c+'p' @@ -547,7 +540,7 @@ module SiSU_Commandline when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' when /^--(?:version)$/; c=c+'v' when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' - else mod << m #mod only contains command modifiers; commands converted to character + else mod << s #mod only contains command modifiers; commands converted to character end end end @@ -578,7 +571,7 @@ module SiSU_Commandline end end if cmd !~/y/ - extra+=if cmd =~/[abeHhIiNopQsSstwXxz]/ \ + extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ and cmd !~/y/ 'ym' #% add manifest elsif (cmd =~/[Dd]/ \ |