From 39e11a4420226c3238e787de5be1c9279f46cf1f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Aug 2014 00:10:22 -0400 Subject: v5 v6: code file renames, fairly extensive * v5 file renames sync with v6 for easier comparison * v5 here (5.5.6) remains as in previous version (5.5.5) --- lib/sisu/v5/options.rb | 1399 ------------------------------------------------ 1 file changed, 1399 deletions(-) delete mode 100644 lib/sisu/v5/options.rb (limited to 'lib/sisu/v5/options.rb') diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb deleted file mode 100644 index eede713a..00000000 --- a/lib/sisu/v5/options.rb +++ /dev/null @@ -1,1399 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, - All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Git - - - - * Ralph Amissah - - - - ** Description: SiSU information Structuring Universe, command line options - parsing - -=end -module SiSU_Commandline - begin - require 'pathname' - rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname NOT FOUND (LoadError)') - end - require_relative 'sysenv' # sysenv.rb - require_relative 'param_make' # param_make.rb - class HeaderCommon - def sisu_document_make_instructions(make_instruct_array=:nil) - @pagenew= - @pagebreak= - @pageline= - @toc= - @lv1=@lv2=@lv3=@lv4=@lv5=@lv6= - @num_top= - @i18n= - @man_section= - @emphasis_set_to= - @bold_match_list= - @italics_match_list= - @substitution_match_list= - @footer_links= - @home_button_links= - @links= - nil - make_instruct_array=make_instruct_array==:nil \ - ? SiSU_Env::GetInit.new.sisu_document_make.makefile_read - : make_instruct_array - @makeset=false - if make_instruct_array - make_instruct_array.each do |para| #% scan document - if para =~/^(?:@make:|@links:)[+-]?\s/ - case para - when /^@make:(.+)/m #% header processing - make - @env=SiSU_Env::InfoEnv.new - @make=SiSU_Param_Make::MdMake.new($1.strip,@opt,@env).make - makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct - @makeset=true - @pagenew=makes[:pagenew] - @pagebreak=makes[:pagenew] - @pageline=makes[:pageline] - @toc=makes[:toc] - @lv1=makes[:lv1] - @lv2=makes[:lv2] - @lv3=makes[:lv3] - @lv4=makes[:lv4] - @lv5=makes[:lv5] - @lv6=makes[:lv6] - @num_top=makes[:num_top] - @i18n=makes[:i18n] - @man_section=makes[:man_section] - @emphasis_set_to=makes[:emphasis_set_to] - @bold_match_list=makes[:bold_match_list] - @italics_match_list=makes[:italics_match_list] - @substitution_match_list=makes[:substitution_match_list] - @footer_links=makes[:footer_links] - @home_button_links=makes[:home_button_links] - @home_button_image=makes[:home_button_image] - @cover_image=makes[:cover_image] - when /^@links:(.+)/m #% header processing - make - make_links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links - @links,@links_append=make_links.links,make_links.append? - end - end - end #% here endeth the common header loop - end - { makeset: @makeset, - pagenew: @pagenew, - pagebreak: @pagebreak, - pageline: @pageline, - toc: @toc, - lv1: @lv1, - lv2: @lv2, - lv3: @lv3, - lv4: @lv4, - lv5: @lv5, - lv6: @lv6, - num_top: @num_top, - i18n: @i18n, - man_section: @man_section, - emphasis_set_to: @emphasis_set_to, - bold_match_list: @bold_match_list, - italics_match_list: @italics_match_list, - substitution_match_list: @substitution_match_list, - footer_links: @footer_links, - home_button_links: @home_button_links, - home_button_image: @home_button_image, - cover_image: @cover_image, - links: @links, - links_append: @links_append - } - end - end - class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod - @@act=nil - def initialize(a,call_path) - @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location='' - @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} - @env=SiSU_Env::InfoEnv.new - @lng_base=@env.language_default_set - @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? - @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? - @call_path=call_path - pth=SiSU_Utils::Path.new(call_path) - @base_path=pth.base_markup - @base_stub=pth.base_markup_stub - @image_src_path=pth.image_src - @a=sisu_glob_rules(a) - @a.freeze - @make_instructions=HeaderCommon.new.sisu_document_make_instructions - @make_instructions_pod=nil - init - end - def find_all(find_flag,opt) - if find_flag - x=Dir.glob('*.ss[tm]') - Px[:lng_lst].each do |d| - if FileTest.directory?(d) - x << Dir.glob("#{d}/*.ss[tm]") - end - end - x=x.flatten - opt + x - end - end - def find_select(find_flag,opt) - if find_flag - x=[] - if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/ - opt.each do |g| - x <<=if g =~/.ss[tm]/ - Dir.glob("*#{g}") - else - Dir.glob("*#{g}*.ss[tm]") - end - Px[:lng_lst].each do |d| - if FileTest.directory?(d) - x <<=if g =~/.ss[tm]/ - Dir.glob("#{d}/*#{g}") - else - Dir.glob("#{d}/*#{g}*.ss[tm]") - end - end - end - end - end - x.flatten - end - end - def sisu_glob_rules(a) - a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \ - or a.inspect =~/"--find"|"--glob"/ - b,f=[],[] - find_flag=false - a.each do |y| - if y =~ /^-/ - if y =~/^-/ \ - && y =~/[fG]|--find|--glob/ - find_flag=true - end - b << y - end - if find_flag \ - && y !~ /^-/ \ - && y =~ /\S+/ - if y !~/\// - f << y - else - find_flag=false - puts %{sub-directories "#{y}" cannot be provided for --find or --glob at this time} - end - end - end - r=Px[:lng_lst_rgx].gsub(/\|#{lng_base}\|/,'|') - @lang_regx=%r{(?:#{r})} - if find_flag - (f.length > 0) \ - ? (b + find_select(find_flag,f)) - : find_all(find_flag,b) - elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ - && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"#{lng_base}\/\S+?\.ss[tm]"/ - init_selected_lang_dirs(a) - else b - end - else a - end - end - def init_selected_lang_dirs(a) - @z=[] - a.each do |y| - if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/ - @fn=$1 - @z << y - elsif y =~/^#{@lang_regx}\/?$/ - @z << "#{y}/#{@fn}" - else @z << y - end - end - @z - end - def init - a=@a - if a.length > 0 - s=expand_numeric_shortcuts(a) - q=set_files_and_paths_and_general_extract(s) - @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod]) - @what=q[:what] unless q[:what].empty? - @paths = q[:paths] - @files = q[:files] - @f_pths = q[:f_pths] - @lngs = q[:lngs] - if @files.length > 0 \ - and @cmd.empty? \ - and @mod.length==0 #% if no other action called on filename given, default is sisu --v5 -0 [filename(s)] configured as flag default - shortcut=SiSU_Env::InfoProcessingFlag.new - @mod=['--v5'] - @cmd=shortcut.cf_0 + ' --dal' - end - if @cmd =~/[vVM]/ \ - && @cmd !~/-[ku]*v[ku]*$/ - SiSU_Screen::Ansi.new( - @cmd, - "\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n" - ).print_brown - end - end - @@act ? @act=@@act : @@act=@act=opt_act - self - end - def sisu_document_make_pod - def makefile_name - SiSU_Env::GetInit.new.sisu_document_make.makefile_name - end - def makefile(pod_make_path) - "#{pod_make_path}/#{makefile_name}" - end - def makefile_read(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 - end - end - self - end - def set_files_and_paths_and_general_extract(s) - c,w='','' - m,f,pth,lng,lngs=[],[],[],[],[] - lng_is='' - a=s.split(/\s+/) - r_l=Px[:lng_lst].join('|') - a.uniq.each do |x| - if x =~/^-[a-z0-5]+/i \ - or x =~/^--\S+/ - if x =~/^-([a-z0-5]+)/i - c << $1 - end - if x =~/^--\S+/ - m << x - end - elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ - if x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ - if x =~/^(?:https?|file):\/\/\S+/ #\ - end - pwd=Dir.pwd - fn_pod=x.gsub(/([^\/]+)\.txz$/,'\1') - fullname=@env.processing_path.processing + '/sisupod/' + fn_pod - pt=Pathname.new(fullname) - FileUtils::mkdir_p(pt.to_s) - pod_make_path=fullname + '/sisupod/doc/_sisu' - make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) - @make_instructions_pod= - HeaderCommon.new.sisu_document_make_instructions(make_instruct_array) - Dir.chdir(pt.realpath) - system(" - chdir #{fullname} - tar xaf #{pwd}/#{x} - chdir #{pwd} - ") - Dir.chdir(pt.realpath.to_s + '/sisupod/doc') - r=Px[:lng_lst_rgx] - Dir.entries("#{fullname}/sisupod/doc").each do |d_lng| - if d_lng =~/^(?:#{r})$/ - Dir.chdir(pt.realpath.to_s + "/sisupod/doc/#{d_lng}") - filenames=Dir.glob("*.ss[mt]") - filenames.each do |fn| - f_pths << { - pth: "#{fullname}/sisupod/doc/#{d_lng}", - f: "#{fn}", - pth_stub: 'doc', - lng: d_lng, - lng_is: d_lng, - url_base: '', - url: '' - } - Dir.chdir(pwd) - f << fn - end - end - end - elsif x =~/^(?:https?|file):\/\/\S+/ \ - and x =~/\S+?\.ss[mt]$/ - r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\// - url_base = (x[r_url,1]) - url = x - y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'') - t=/(#{r_l})\/[^\/]+?\.ss[tm]$/ - l_p = (y[t,1]) \ - ? y[t,1] - : nil - lng << l_p - lngs << if l_p - l_p - elsif x =~/~(#{r_l})\.ss[tm]/ - $1 - else lng_base - end - r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/ - fn = (y[r_f,1]) \ - ? y[r_f,1] - : y - fn=fn.gsub(/\.((?:ssm\.)?sst)/,'.-\1') - fullname=Dir.pwd + '/' + fn - pt=Pathname.new(fullname) - pth << Dir.pwd - r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ - lng_is =if l_p - l_p - elsif x =~/~(#{r_l})\.ss[tm]/ - $1 - else lng_base - end - f_pths << { - pth: pt.split[0].realpath.to_s, - f: pt.split[1].to_s, - pth_stub: pt.split[0].realpath.to_s[r_u,1], - lng: (pt.split[0].realpath.to_s[t,1]) \ - ? pt.split[0].realpath.to_s[t,1] - : nil, - lng_is: lng_is, - url_base: url_base, - url: url - } - f << fn - elsif FileTest.file?(x) - pt=Pathname.new(x) - pth << pt.split[0].realpath.to_s #remove? - f << pt.split[1].to_s #remove? - r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ - t=/.+\/(#{r_l})$/ - l_p = (pt.split[0].realpath.to_s[t,1]) \ - ? pt.split[0].realpath.to_s[t,1] - : nil - lngs << lng_is = if l_p - l_p - elsif x =~/~(#{r_l})\.ss[tm]/ - $1 - else lng_base - end - f_pths << { - pth: pt.split[0].realpath.to_s, - f: pt.split[1].to_s, - pth_stub: pt.split[0].realpath.to_s[r_u,1], - lng: lng_is, - lng_is: lng_is, - url_base: nil, - url: nil, - } - else puts "file not found: #{x}" - end - elsif x =~ /\.termsheet\.rb$/ - (FileTest.file?(x)) \ - ? (f << x) - : (puts "file not found: #{x}") - else w=x - puts "#{x} in #{a.join(' ')}?" - end - end - { - cmd: c, - mod: m, - what: w, - paths: pth, - files: f, - f_pths: f_pths, - lng: lng_is, - lngs: lngs, - } - end - def expand_numeric_shortcuts(a) - shortcut=SiSU_Env::InfoProcessingFlag.new - s='' - a.each do |x| - y=case x - when /0/ - (x=~/^-0\S+/) \ - ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') - : x.gsub(/^-0/,shortcut.cf_0 + ' ') - when /1/ - (x=~/^-1\S+/) \ - ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') - : x.gsub(/^-1/,shortcut.cf_1 + ' ') - when /2/ - (x=~/^-2\S+/) \ - ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') - : x.gsub(/^-2/,shortcut.cf_2 + ' ') - when /3/ - (x=~/^-3\S+/) \ - ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') - : x.gsub(/^-3/,shortcut.cf_3 + ' ') - when /4/ - (x=~/^-4\S+/) \ - ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') - : x.gsub(/^-4/,shortcut.cf_4 + ' ') - when /5/ - (x=~/^-5\S+/) \ - ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') - : x.gsub(/^-5/,shortcut.cf_5 + ' ') - when /6/ - (x=~/^-6\S+/) \ - ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') - : x.gsub(/^-6/,shortcut.cf_5 + ' ') - else x - end - s << " #{y}" unless y.empty? - end - s.strip! - end - def opt_cmd_and_mod_adjust(c,m) - cmd,mod,files=@cmd,@mod,@files - if not m.empty? \ - and m.inspect =~/"--pdf-/ - 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 |s| - case s - when /^--(?:color-toggle)$/ then c=c+'c' - when /^--(?:color-off)$/ then c=c+'k' - when /^--(?:conf|config|configure|init|initialize|init-site)$/ then c=c+'CC' - when /^--(?:ao|dal?|machine|abstraction|abs)$/ then c=c+'m' - when /^--(?:txt|text|plaintext)$/ then c=c+'t' - when /^--(?:html)$/ then c=c+'h' - when /^--(?:html-scroll|html-seg)$/ then c=c+'H' - mod << s - when /^--(?:epub)$/ then c=c+'e' - when /^--(?:od[ft])$/ then c=c+'o' - when /^--docbook$/ then c=c+'d' - when /^--(?:pdf)$/ then c=c+'p' - when /^--pdf-(?:a4|a5|b5|legal|letter)$/ then c=c+'p' - when /^--pdf-(?:p|l|portrait|landscape)$/ then c=c+'L' - when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/ then c=c+'L' - when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/ then c=c+'L' - when /^--(?:concordance|wordmap)$/ then c=c+'w' - when /^--(?:manpage|man)$/ then c=c+'i' - when /^--(?:texinfo)$/ then c=c+'I' - when /^--(?:xhtml)$/ then c=c+'b' - when /^--(?:xml-sax)$/ then c=c+'x' - when /^--(?:xml-dom)$/ then c=c+'X' - when /^--(?:images)$/ then c=c+'j' - when /^--(?:digests?|hash-digests)$/ then c=c+'N' - when /^--(?:po4a|pot?)$/ then c=c+'P' - when /^--(?:termsheet)$/ then c=c+'T' - when /^--(?:manifest)$/ then c=c+'y' - when /^--(?:qrcode)$/ then c=c+'Q' - when /^--(?:remote|rsync)$/ then c=c+'R' - when /^--(?:scp)$/ then c=c+'r' - when /^--(?:source)$/ then c=c+'s' - when /^--(?:sisupod|pod)$/ then c=c+'S' - when /^--(?:git)$/ then c=c+'g' - when /^--(?:urls)$/ then c=c+'U' - when /^--(?:zap|delete)$/ then c=c+'Z' - when /^--(?:sample-search-form)$/ then c=c+'F' - when /^--(?:webserv|webrick)$/ then c=c+'W' - when /^--(?:profile)$/ then c=c+'E' - when /^--(?:maintenance|keep-processing-files)$/ then c=c+'M' - when /^--(?:verbose[=-]3)$/ then c=c+'VM' - when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/ then c=c+'V' - when /^--(?:verbose(?:[=-]1)?)$/ then c=c+'v' - when /^--(?:version)$/ then c=c+'v' - when /^--(?:verbose[=-]0|quiet|silent)$/ then c=c+'q' - else mod << s #mod only contains command modifiers; commands converted to character - end - end - end - ca=[] - unless c.empty? - c=c.gsub(/-/,'') - c.scan(/CC|\S/) {|x| ca << x} - cmd= '-' + ca.uniq.join - end - extra='' - if cmd !~/[mn]/ - extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ - and cmd !~/[mn]/ - 'm' #% add ao - elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ - and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ - and cmd !~/[mn]/ - 'm' #% add ao - else '' - end - end - if cmd !~/j/ - extra+=if cmd =~/[bdHhwXxyz]/ \ - and cmd !~/[j]/ - 'j' #% copy images - else '' - end - end - if cmd !~/y/ - extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \ - and cmd !~/y/ - 'ym' #% add manifest - elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \ - and files[0] !~/^remove$/ \ - and cmd !~/y/ - 'ym' #% add manifest - else '' - end - end - if cmd !~/u/ #% add urls - extra+='u' - end - cmd=cmd + extra - cmds=cmd.scan(/CC|\S/) - [cmds.uniq.join,mod] - end - def opt_act #note mod line commands have already been converted to command characters, cmd - cmd,mod=@cmd,@mod - @@act=if @@act - @act=@@act - else - act={} - act[:license]=(mod.inspect =~/"--license/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:site_init]=(cmd =~/C/ \ - || mod.inspect =~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:rc]=if mod.inspect =~/"--rc=/ - x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, set: :on, inst: x } - else - { bool: false, set: :na, inst: '' } - end - act[:processing_path]=if mod.inspect =~/"--processing-path=/ - base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--processing-path/ - { bool: true, set: :on, inst: @base_path } - else - { bool: false, set: :na, inst: nil } - end - act[:dump]=if mod.inspect =~/"--dump=/ - base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--dump/ - { bool: true, set: :on, inst: @base_path } - else - { bool: false, set: :na, inst: nil } - end - act[:redirect]=if mod.inspect =~/"--redirect=/ - base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--redirect/ - { bool: true, set: :on, inst: @base_path } - else - { bool: false, set: :na, inst: nil } - end - act[:switch]=if mod.inspect =~/"--switch-off=/ - off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1') - off_list=off_list.scan(/[^,;\s]+/) - { bool: false, set: :off, off: off_list} - else { bool: true, set: :na, off: [] } - end - act[:default_language]=if mod.inspect =~/"--(?:default-)?language[-=](\S{2})"/ - { set: :on, code: $1 } - elsif lng_base - { set: :on, code: lng_base } - else { set: :na, code: 'en' } - end - act[:i18n]=if mod.inspect =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected - @lingual=:mono - { set: :mono } - elsif mod.inspect =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/ - @lingual=:multi - { set: :multi } - else { set: :na } - end - act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/ - @dir_structure_by=:language - { set: :language } - elsif mod.inspect =~/"--(?:output-)?by-filename"/ - @dir_structure_by=:filename - { set: :filename } - elsif mod.inspect =~/"--(?:output-)?by-filetype"/ - @dir_structure_by=:filetype - { set: :filetype } - else { set: :na } - end - act[:ocn]=if mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ \ - || act[:switch][:off].inspect =~/"ocn"|"--numbering"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:toc]=if mod.inspect =~/"--inc-toc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ - || act[:switch][:off].inspect =~/"toc"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \ - || act[:switch][:off].inspect =~/"minitoc"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ - || act[:switch][:off].inspect =~/"manifest"/ #place lower - { bool: false, set: :off } - elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ - || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \ - || mod.inspect =~/"--(?:redirect|dump)/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \ - || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/ - #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:metadata]=if mod.inspect =~/"--inc-metadata"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ - || act[:switch][:off].inspect =~/"metadata"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \ - || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \ - || act[:switch][:off].inspect =~/"html_navigation"|"nav"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ - || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \ - || act[:switch][:off].inspect =~/"segsubtoc"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:search_form]=if mod.inspect =~/"--inc-search-form"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \ - || act[:switch][:off].inspect =~/"search_form"|"search"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \ - || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \ - || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \ - || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:html]=if mod.inspect =~/"--html-strict"/ \ - or ((cmd =~/h/ || mod.inspect =~/"--html"/) \ - && mod.inspect =~/"--strict"/) - act[:html_strict]={ bool: true, set: :on } - act[:html_scroll]={ bool: true, set: :on } - act[:html_seg]={ bool: true, set: :on } - { bool: true, set: :on } - elsif (cmd =~/h/ \ - || mod.inspect =~/"--html"/) - act[:html_strict]={ bool: false, set: :off } - act[:html_scroll]={ bool: true, set: :on } - act[:html_seg]={ bool: true, set: :on } - { bool: true, set: :on } - else - act[:html_strict]=(mod.inspect =~/"--strict"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:html_scroll]=(mod.inspect =~/"--html-scroll"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:html_seg]=(mod.inspect =~/"--html-seg"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - { bool: false, set: :na } - end - act[:concordance]=(cmd =~/w/ \ - || mod.inspect =~/"--concordance"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:images]=(cmd =~/j/ \ - || mod.inspect =~/"--images"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - if (cmd =~/p/ \ - || mod.inspect =~/"--pdf"/) - if mod.inspect =~/"--portrait"/ - act[:pdf]= { bool: false, set: :na } - act[:pdf_l]={ bool: false, set: :na } - act[:pdf_p]={ bool: true, set: :on } - elsif mod.inspect =~/"--landscape"/ - act[:pdf]= { bool: false, set: :na } - act[:pdf_l]={ bool: true, set: :on } - act[:pdf_p]={ bool: false, set: :na } - else - act[:pdf]= { bool: true, set: :on } - act[:pdf_l]={ bool: true, set: :on } - act[:pdf_p]={ bool: true, set: :on } - end - else - act[:pdf]= { bool: false, set: :na } - act[:pdf_p]= { bool: false, set: :na } - act[:pdf_l]= { bool: false, set: :na } - act[:pdf_a4]= { bool: false, set: :na } - act[:pdf_a5]= { bool: false, set: :na } - act[:pdf_b5]= { bool: false, set: :na } - act[:pdf_letter]={ bool: false, set: :na } - act[:pdf_legal]= { bool: false, set: :na } - end - if act[:pdf][:set]==:on \ - or act[:pdf_p][:set]==:on \ - or act[:pdf_l][:set]==:on - act[:pdf_a4]=if mod.inspect =~/"--a4"|--papersize-a4"/ \ - or mod.inspect =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5 - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:pdf_a5]=if mod.inspect =~/"--a5"|"--papersize-a5"/ \ - or mod.inspect =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5 - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:pdf_b5]=if mod.inspect =~/"--b5"|"--papersize-b5"/ \ - or mod.inspect =~/"--papersize=\S*b5\b\S*"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:pdf_letter]=if mod.inspect =~/"--letter"|"--papersize-letter"/ \ - or mod.inspect =~/"--papersize=\S*letter\b\S*"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:pdf_legal]=if mod.inspect =~/"--legal"|"--papersize-legal"/ \ - or mod.inspect =~/"--papersize=\S*legal\b\S*"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - end - act[:epub]=(cmd =~/e/ \ - || mod.inspect =~/"--epub"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:odt]=if cmd =~/o/ \ - or mod.inspect =~/"--odt"|"--odf"|"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ - act[:odt_ocn]=if (mod.inspect =~/"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ \ - or mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/) - { bool: true, set: :on } - elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ - { bool: false, set: :off } - else - { bool: false, set: :na } - end - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:xml_sax]=(cmd =~/x/ \ - || mod.inspect =~/"--xml-sax"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_dom]=(cmd =~/X/ \ - || mod.inspect =~/"--xml-dom"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_docbook_book]=(cmd =~/d/ \ - || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_fictionbook]=(cmd =~/f/ \ - || mod.inspect =~/"--fictionbook"|"--xml-fictionbook"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_scaffold_structure_sisu]=mod.inspect =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_scaffold_structure_collapse]=mod.inspect =~/"--xml-scaffold-collapse"/ \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xhtml]=(cmd =~/b/ \ - || mod.inspect =~/"--xhtml"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:txt]=if cmd =~/[at]/ \ - or mod.inspect =~/"--txt"|"--text"|"--plaintext"|"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ - act[:txt_ocn]=if (mod.inspect =~/"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ \ - or mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/) - { bool: true, set: :on } - elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ - { bool: false, set: :off } - else - { bool: false, set: :na } - end - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:txt_textile]=(mod.inspect =~/"--textile"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:txt_asciidoc]=(mod.inspect =~/"--asciidoc"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:txt_markdown]=(mod.inspect =~/"--markdown"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:txt_rst]=(mod.inspect =~/"--rst"|"--rest"|"--restructuredtext"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:manpage]=(cmd =~/i/ \ - || mod.inspect =~/"--manpage"|"--man"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:texinfo]=(cmd =~/I/ \ - || mod.inspect =~/"--texinfo"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:psql]=if mod.inspect =~/"--pg-\S+"/ \ - or ((mod.inspect =~/"--pg"/) \ - && (mod.inspect \ - =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) - act[:psql_createdb]=if mod.inspect \ - =~/"--pg-createdb"|"--createdb"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - if mod.inspect \ - =~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/ - act[:psql_drop]={ bool: true, set: :on } - act[:psql_create]={ bool: true, set: :on } - else - act[:psql_drop]=if mod.inspect \ - =~/"--pg-dropall"|"--dropall"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:psql_create]=if mod.inspect \ - =~/"--pg-create(?:all)?"|"--create(?:all)?"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - end - act[:psql_import]=if mod.inspect \ - =~/"--pg-import"|"--import"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:psql_update]=if mod.inspect \ - =~/"--pg-update"|"--update"/ - act[:psql_remove]={ bool: true, set: :on } - { bool: true, set: :on } - else - act[:psql_remove]=if mod.inspect \ - =~/"--pg-remove"|"--remove"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - { bool: false, set: :na } - end - { bool: true, set: :on } - else - act[:psql_createdb]= - { bool: false, set: :na } - act[:psql_drop]= - { bool: false, set: :na } - act[:psql_create]= - { bool: false, set: :na } - act[:psql_import]= - { bool: false, set: :na } - act[:psql_update]= - { bool: false, set: :na } - act[:psql_remove]= - { bool: false, set: :na } - { bool: false, set: :na } - end - act[:sqlite]=if (mod.inspect =~/"--sqlite-\S+"/) \ - or ((mod.inspect =~/"--sqlite"/) \ - && (mod.inspect \ - =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)) - act[:sqlite_createdb]=if mod.inspect \ - =~/"--sqlite-createdb"|"--createdb"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - if mod.inspect \ - =~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/ - act[:sqlite_drop]={ bool: true, set: :on } - act[:sqlite_create]={ bool: true, set: :on } - else - act[:sqlite_create]=if mod.inspect \ - =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:sqlite_drop]=if mod.inspect \ - =~/"--sqlite-dropall"|"--dropall"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - end - act[:sqlite_import]=if mod.inspect \ - =~/"--sqlite-import"|"--import"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:sqlite_update]=if mod.inspect \ - =~/"--sqlite-update"|"--update"/ - act[:sqlite_remove]={ bool: true, set: :on } - { bool: true, set: :on } - else - act[:sqlite_remove]=if mod.inspect \ - =~/"--sqlite-remove"|"--sqlite-remove"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - end - { bool: false, set: :na } - end - { bool: true, set: :on } - else - act[:sqlite_createdb]= - { bool: false, set: :na } - act[:sqlite_drop]= - { bool: false, set: :na } - act[:sqlite_create]= - { bool: false, set: :na } - act[:sqlite_import]= - { bool: false, set: :na } - act[:sqlite_update]= - { bool: false, set: :na } - act[:sqlite_remove]= - { bool: false, set: :na } - { bool: false, set: :na } - end - act[:sqlite_discrete]=mod.inspect =~/"--sql"|"--sqlite"/ \ - && (mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:harvest]=(mod.inspect =~/"--harvest"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:po4a]=(cmd =~/P/ \ - || mod.inspect =~/"--po4a"|"--pot?"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:git]=(cmd =~/g/ \ - || mod.inspect =~/"--git"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:hash_digests]=(cmd =~/N/ \ - || mod.inspect =~/"--digests?"|"--hash-digests"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:pdf_font_size]=if mod.inspect =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/ - $1 - else :na - end - act[:pdf_hyperlink_colors]=if mod.inspect =~/"--pdf-hyperlinks-(?:mono(?:chrome)?|no-color)"/ - :mono - elsif mod.inspect =~/"--pdf-hyperlinks-color"/ - :color - else :na - end - act[:hash_digest_algo]=if mod.inspect =~/"--hash-(?:sha)?512"/ - :sha512 - elsif mod.inspect =~/"--hash-(?:sha)?256"/ - :sha256 - elsif mod.inspect =~/"--hash-md5"/ - :md5 - else :na - end - act[:sample_search_form]=(cmd =~/F/ \ - || mod.inspect =~/"--sample-search-form"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:webrick]=(cmd =~/W/ \ - || mod.inspect =~/"--webrick"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:share_source]=(cmd =~/s/ \ - || mod.inspect =~/"--source"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sisupod]=(cmd =~/S/ \ - || mod.inspect =~/"--sisupod"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:scp]=(cmd =~/r/ \ - || mod.inspect =~/"--scp"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:rsync]=(cmd =~/R/ \ - || mod.inspect =~/"--rsync"|"--remote"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:zap]=(cmd =~/Z/ \ - || mod.inspect =~/"--zap"|"--delete"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:urls_all]=(cmd =~/U/ \ - || mod.inspect =~/"--urls-all"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:urls_selected]=(cmd =~/u/ \ - || mod.inspect =~/"--urls"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sitemap]=(cmd =~/Y/ \ - || mod.inspect =~/"--sitemap"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:qrcode]=(cmd =~/Q/ \ - || mod.inspect =~/"--qrcode"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:help]=(mod.inspect =~/"--help/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:ao]=if (cmd =~/m/ \ - || mod.inspect =~/"--ao"|"--dal"/) - { bool: true, set: :on } - elsif (act[:txt][:set]==:on \ - || act[:txt_textile][:set]==:on \ - || act[:txt_asciidoc][:set]==:on \ - || act[:txt_markdown][:set]==:on \ - || act[:txt_rst][:set]==:on \ - || act[:xhtml][:set]==:on \ - || act[:epub][:set]==:on \ - || act[:html][:set]==:on \ - || act[:html_seg][:set]==:on \ - || act[:html_scroll][:set]==:on \ - || act[:texinfo][:set]==:on \ - || act[:manpage][:set]==:on \ - || act[:hash_digests][:set]==:on \ - || act[:odt][:set]==:on \ - || act[:pdf][:set]==:on \ - || act[:pdf_p][:set]==:on \ - || act[:pdf_l][:set]==:on \ - || act[:qrcode][:set]==:on \ - || act[:share_source][:set]==:on \ - || act[:sisupod][:set]==:on \ - || act[:concordance][:set]==:on \ - || act[:xml_dom][:set]==:on \ - || act[:xml_sax][:set]==:on \ - || act[:xml_docbook_book][:set]==:on \ - || act[:xml_fictionbook][:set]==:on \ - || act[:xml_scaffold_structure_sisu][:set]==:on \ - || act[:xml_scaffold_structure_collapse][:set]==:on ) - { bool: true, set: :on } - #if cmd !~/[mn]/ - # extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ - # and cmd !~/[mn]/ - # 'm' #% add ao - #elsif (act[:txt][:set]==:on \ - # { bool: true, set: :on } - # elsif ((cmd =~/[Dd]/ \ - # or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ - # and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ - # and cmd !~/[mn]/ - # 'm' #% add ao - else - { bool: false, set: :na } - end - act[:manifest]=if mod.inspect =~/"--inc-manifest"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ - || act[:switch][:off].inspect =~/"manifest"/ - { bool: false, set: :off } - elsif (cmd =~/y/ \ - || mod.inspect =~/"--manifest"/) - { bool: true, set: :on } - elsif (act[:txt][:set]==:on \ - || act[:txt_textile][:set]==:on \ - || act[:txt_asciidoc][:set]==:on \ - || act[:txt_markdown][:set]==:on \ - || act[:txt_rst][:set]==:on \ - || act[:xhtml][:set]==:on \ - || act[:epub][:set]==:on \ - || act[:html][:set]==:on \ - || act[:html_seg][:set]==:on \ - || act[:html_scroll][:set]==:on \ - || act[:texinfo][:set]==:on \ - || act[:manpage][:set]==:on \ - || act[:hash_digests][:set]==:on \ - || act[:odt][:set]==:on \ - || act[:pdf][:set]==:on \ - || act[:pdf_p][:set]==:on \ - || act[:pdf_l][:set]==:on \ - || act[:qrcode][:set]==:on \ - || act[:share_source][:set]==:on \ - || act[:sisupod][:set]==:on \ - || act[:concordance][:set]==:on \ - || act[:xml_dom][:set]==:on \ - || act[:xml_sax][:set]==:on \ - || act[:xml_docbook_book][:set]==:on \ - || act[:xml_fictionbook][:set]==:on \ - || act[:xml_scaffold_structure_sisu][:set]==:on \ - || act[:xml_scaffold_structure_collapse][:set]==:on ) - { bool: true, set: :on } - ## if cmd !~/y/ - ## extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ - ## and cmd !~/y/ - ## 'ym' #% add manifest - #elsif (act[:txt][:set]==:on \ - # { bool: true, set: :on } - # elsif (cmd =~/[Dd]/ \ - # or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ - # and files[0] !~/^remove$/ \ - # and cmd !~/y/ - # 'ym' #% add manifest - else { bool: true, set: :na } - end - act[:console_messages] = '' - act[:verbose]=if (cmd =~/v/ \ - || mod.inspect =~/"--verbose"/) - act[:console_messages] << ' --verbose ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:verbose_plus]=if (cmd =~/V/ \ - || mod.inspect =~/"--very-verbose"/) - act[:console_messages] << ' --very-verbose ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:version_info]=if (cmd =~/[vVM]/ \ - || mod.inspect =~/"--verbose"|"--maintenance"/) - act[:console_messages] << ' --maintenance ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:quiet]=if (cmd =~/q/ \ - || mod.inspect =~/"--quiet"/) - act[:console_messages] << ' --quiet ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - act[:console_messages] << ' --color-on ' - { bool: true, set: :on } - elsif (cmd =~/k/ \ - || mod.inspect =~/"--color-off"/) - act[:console_messages] << ' --color-off ' - { bool: false, set: :off } - else { bool: true, set: :na } #fix default color - end -# act[:color_toggle]=if cmd =~/c/ \ -# or mod.inspect =~/"--color-toggle"/ -# true -# else false -# end - act[:maintenance]=if (cmd =~/M/ \ - || mod.inspect =~/"--maintenance|--keep-processing-files"/) - act[:console_messages] << ' --maintenance ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - act[:profile]=if (cmd =~/E/ \ - || mod.inspect =~/"--profile"/) - act[:console_messages] << ' --color-off ' - { bool: true, set: :on } - else - { bool: false, set: :na } - end - @act=act - end - end - def cmd - @cmd - end - def mod - @mod - end - def act - @@act - end - def files_mod - files_mod=files - @files_mod=files_mod - end - def f_pth - @f_pth - end - def pth - @pth - end - def sub_location - pth.gsub(/#{base_path}/,'') - end - def lng - @lng - end - def lng_base - @lng_base - end - def fno - @fno=(fns.nil? || fns.empty?) \ - ? '' \ - : (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1]) - end - def fng - @fng=(fno.nil? || fno.empty?) \ - ? '' \ - : (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1')) - end - def fns - @fns - end - def fnl - @fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") - end - def what - @what - end - def fnb - (fns.nil? || fns.empty?) \ - ? '' \ - : (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1]) - end - def fnc - @fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \ - ? fnb + '.ssm.sst' - : @fns - end - def fncb - @fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \ - ? fnb + '.ssm.sst' - : @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') - end - end -end -__END__ -note usually named @opt is carried in Param (usually as @md.opt), @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 -- cgit v1.2.3