aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/constants.rb1
-rw-r--r--lib/sisu/v5/hub.rb7
-rw-r--r--lib/sisu/v5/options.rb13
-rw-r--r--lib/sisu/v5/sst_convert_markup.rb3
-rw-r--r--lib/sisu/v6/constants.rb1
-rw-r--r--lib/sisu/v6/hub.rb7
-rw-r--r--lib/sisu/v6/options.rb13
-rw-r--r--lib/sisu/v6/sst_convert_markup.rb3
8 files changed, 24 insertions, 24 deletions
diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb
index 05678b32..d242ef1d 100644
--- a/lib/sisu/v5/constants.rb
+++ b/lib/sisu/v5/constants.rb
@@ -237,6 +237,7 @@ Px={
po_hilite_o: '*{', po_hilite_c: '}*',
po_monospace_o: '#{', po_monospace_c: '}#',
lng_lst: SiSU_is[:language_list],
+ lng_lst_rgx: SiSU_is[:language_list_regex],
lv1: '*',
lv2: '=',
lv3: '=',
diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb
index d9359862..5d291f9b 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -79,10 +79,9 @@ module SiSU
error('uri NOT FOUND (LoadError)')
end
class HubMaster
- def initialize(argv)
- pwd_the=Dir.pwd
+ def initialize(argv,call_path)
begin #% select what to do (set options & start processing (files selected if any))
- opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set
+ opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set
SiSU::Processing.new(opt).actions # do it
rescue
cmd=(opt ? opt.cmd : '')
@@ -90,7 +89,7 @@ module SiSU
__LINE__.to_s + ':' + __FILE__
end
ensure
- Dir.chdir(pwd_the)
+ Dir.chdir(call_path)
end
end
end
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index 591bb990..e7d0f023 100644
--- a/lib/sisu/v5/options.rb
+++ b/lib/sisu/v5/options.rb
@@ -69,7 +69,6 @@ module SiSU_Commandline
end
require_relative 'sysenv' # sysenv.rb
require_relative 'param_make' # param_make.rb
- @@sisu_call_origin_path=nil
class HeaderCommon
def sisu_document_make_instructions
@pagenew=
@@ -155,18 +154,18 @@ module SiSU_Commandline
end
end
class Options
- attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+ attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,: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)
- @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location=
- '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''
+ 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=@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?
- @@sisu_call_origin_path ||=Dir.pwd
- @base_path=@@sisu_call_origin_path
+ @call_path=call_path
+ @base_path=
+ call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'')
r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
@base_stub=@base_path.gsub(u,'\1')
diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb
index cec67960..cdceba7c 100644
--- a/lib/sisu/v5/sst_convert_markup.rb
+++ b/lib/sisu/v5/sst_convert_markup.rb
@@ -313,7 +313,8 @@ end
#%% files to match for this conversion set ------------------------->
require_relative 'options' # options.rb
argv=$*
-@opt=SiSU_Commandline::Options.new(argv)
+base_path=Dir.pwd
+@opt=SiSU_Commandline::Options.new(argv,base_path)
case @opt.mod.inspect
when /=kdi/
SiSU_Modify::ConvertMarkup.new(@opt).conversion
diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb
index 53ed226a..87611bf9 100644
--- a/lib/sisu/v6/constants.rb
+++ b/lib/sisu/v6/constants.rb
@@ -237,6 +237,7 @@ Px={
po_hilite_o: '*{', po_hilite_c: '}*',
po_monospace_o: '#{', po_monospace_c: '}#',
lng_lst: SiSU_is[:language_list],
+ lng_lst_rgx: SiSU_is[:language_list_regex],
lv1: '*',
lv2: '=',
lv3: '=',
diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb
index 94d0eb8e..7508dcbc 100644
--- a/lib/sisu/v6/hub.rb
+++ b/lib/sisu/v6/hub.rb
@@ -79,10 +79,9 @@ module SiSU
error('uri NOT FOUND (LoadError)')
end
class HubMaster
- def initialize(argv)
- pwd_the=Dir.pwd
+ def initialize(argv,call_path)
begin #% select what to do (set options & start processing (files selected if any))
- opt=SiSU_Commandline::Options.new(argv) # command line selection of what to do, files & operations set
+ opt=SiSU_Commandline::Options.new(argv,call_path) # command line selection of what to do, files & operations set
SiSU::Processing.new(opt).actions # do it
rescue
cmd=(opt ? opt.cmd : '')
@@ -90,7 +89,7 @@ module SiSU
__LINE__.to_s + ':' + __FILE__
end
ensure
- Dir.chdir(pwd_the)
+ Dir.chdir(call_path)
end
end
end
diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb
index e181ee8e..1850c6d4 100644
--- a/lib/sisu/v6/options.rb
+++ b/lib/sisu/v6/options.rb
@@ -69,7 +69,6 @@ module SiSU_Commandline
end
require_relative 'sysenv' # sysenv.rb
require_relative 'param_make' # param_make.rb
- @@sisu_call_origin_path=nil
class HeaderCommon
def sisu_document_make_instructions
@pagenew=
@@ -155,18 +154,18 @@ module SiSU_Commandline
end
end
class Options
- attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+ attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,: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)
- @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location=
- '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''
+ 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=@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?
- @@sisu_call_origin_path ||=Dir.pwd
- @base_path=@@sisu_call_origin_path
+ @call_path=call_path
+ @base_path=
+ call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'')
r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
@base_stub=@base_path.gsub(u,'\1')
diff --git a/lib/sisu/v6/sst_convert_markup.rb b/lib/sisu/v6/sst_convert_markup.rb
index 0b749fc5..8d523d0f 100644
--- a/lib/sisu/v6/sst_convert_markup.rb
+++ b/lib/sisu/v6/sst_convert_markup.rb
@@ -313,7 +313,8 @@ end
#%% files to match for this conversion set ------------------------->
require_relative 'options' # options.rb
argv=$*
-@opt=SiSU_Commandline::Options.new(argv)
+base_path=Dir.pwd
+@opt=SiSU_Commandline::Options.new(argv,base_path)
case @opt.mod.inspect
when /=kdi/
SiSU_Modify::ConvertMarkup.new(@opt).conversion