aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/src_shared.rb63
-rw-r--r--lib/sisu/v6/src_shared.rb63
2 files changed, 84 insertions, 42 deletions
diff --git a/lib/sisu/v5/src_shared.rb b/lib/sisu/v5/src_shared.rb
index bbeebdc1..a4b3a974 100644
--- a/lib/sisu/v5/src_shared.rb
+++ b/lib/sisu/v5/src_shared.rb
@@ -80,6 +80,7 @@ module SiSU_Source
processing_sisupod.make
path_pod=processing_sisupod.paths[:sisupod]
path_pod_fnb=processing_sisupod.paths[:fnb]
+ @doc_import_list=[]
FileUtils::mkdir_p(path_pod) unless FileTest.directory?(path_pod)
@path_pod={
fnb: path_pod_fnb,
@@ -107,12 +108,13 @@ module SiSU_Source
end
unless @opt.fns.empty?
directories
- pod_source_build #this needs to be built in case of multi-lingual for all of them, before single pass tar
+ file_array=IO.readlines(@opt.fno,'')
+ doc_import_list=pod_source_build(file_array) #this needs to be built in case of multi-lingual for all of them, before single pass tar
+ doc_import_list=[@opt.fno, doc_import_list].flatten
+ image_extraction(doc_import_list)
+ language_versions
end
end
- def directories
- SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
- end
def images_extract(f,images) # consider using param info
rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
if f !~/^%+\s/ \
@@ -121,31 +123,17 @@ module SiSU_Source
end
images.flatten
end
- def pod_source_build
- @pwd=Dir.pwd
+ def image_extraction(doc_import_list)
@rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/
- file_array=IO.readlines(@opt.fno,'')
- images,doc_import_list=[],[]
doc_import_dir=@opt.sub_location
- file_array.each do |f| #% work area
- if f !~/^%+\s/
- f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
- if f !~/^%+\s/ \
- and f =~@rgx_image
- images=images_extract(f,images)
- end
- if @opt.fno =~/\.ssm$/
- doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
- end
- end
- end
+ images=[]
if doc_import_list.length > 0
doc_import_list=doc_import_list.uniq.flatten
doc_import_list.each do |fn|
file_array=IO.readlines(fn,'')
file_array.each do |f| #% work area
+ f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
if f !~/^%+\s/ \
and f =~@rgx_image
images=images_extract(f,images)
@@ -207,7 +195,10 @@ module SiSU_Source
end
end
end
+ end
+ def language_versions
x=@env.document_language_versions_found #check multiple document language versions (param not used)
+ doc_import_dir=@opt.sub_location
if x[:f] \
and x[:f].length > 0 #store multiple document language versions, sisupod
x[:f].each do |f|
@@ -277,6 +268,36 @@ module SiSU_Source
end
end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
end
+ def directories
+ SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
+ end
+ def ssm_doc_import_list(f)
+ if @opt.fno =~/\.ssm$/
+ doc_import_list=[]
+ doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
+ doc_import_list.flatten.each do |i|
+ if i =~/.ssi/
+ file_array=IO.readlines(i,'')
+ pod_source_build(file_array)
+ end
+ end
+ end
+ doc_import_list.uniq.flatten
+ end
+ def pod_source_build(file_array)
+ @pwd=Dir.pwd
+ @rgx_doc_import_list=/^<<\s*(\S+?\.ss[ti])/
+ doc_import_list=[]
+ file_array.each do |f| #% work area
+ if f !~/^%+\s/
+ if @opt.fno =~/\.ssm$/
+ @doc_import_list << ssm_doc_import_list(f)
+ doc_import_list=@doc_import_list.flatten.uniq
+ end
+ end
+ end
+ doc_import_list
+ end
end
end
__END__
diff --git a/lib/sisu/v6/src_shared.rb b/lib/sisu/v6/src_shared.rb
index ec021974..cee7e1c5 100644
--- a/lib/sisu/v6/src_shared.rb
+++ b/lib/sisu/v6/src_shared.rb
@@ -80,6 +80,7 @@ module SiSU_Source
processing_sisupod.make
path_pod=processing_sisupod.paths[:sisupod]
path_pod_fnb=processing_sisupod.paths[:fnb]
+ @doc_import_list=[]
FileUtils::mkdir_p(path_pod) unless FileTest.directory?(path_pod)
@path_pod={
fnb: path_pod_fnb,
@@ -107,12 +108,13 @@ module SiSU_Source
end
unless @opt.fns.empty?
directories
- pod_source_build #this needs to be built in case of multi-lingual for all of them, before single pass tar
+ file_array=IO.readlines(@opt.fno,'')
+ doc_import_list=pod_source_build(file_array) #this needs to be built in case of multi-lingual for all of them, before single pass tar
+ doc_import_list=[@opt.fno, doc_import_list].flatten
+ image_extraction(doc_import_list)
+ language_versions
end
end
- def directories
- SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
- end
def images_extract(f,images) # consider using param info
rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
if f !~/^%+\s/ \
@@ -121,31 +123,17 @@ module SiSU_Source
end
images.flatten
end
- def pod_source_build
- @pwd=Dir.pwd
+ def image_extraction(doc_import_list)
@rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/
- file_array=IO.readlines(@opt.fno,'')
- images,doc_import_list=[],[]
doc_import_dir=@opt.sub_location
- file_array.each do |f| #% work area
- if f !~/^%+\s/
- f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
- if f !~/^%+\s/ \
- and f =~@rgx_image
- images=images_extract(f,images)
- end
- if @opt.fno =~/\.ssm$/
- doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
- end
- end
- end
+ images=[]
if doc_import_list.length > 0
doc_import_list=doc_import_list.uniq.flatten
doc_import_list.each do |fn|
file_array=IO.readlines(fn,'')
file_array.each do |f| #% work area
+ f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image)
if f !~/^%+\s/ \
and f =~@rgx_image
images=images_extract(f,images)
@@ -207,7 +195,10 @@ module SiSU_Source
end
end
end
+ end
+ def language_versions
x=@env.document_language_versions_found #check multiple document language versions (param not used)
+ doc_import_dir=@opt.sub_location
if x[:f] \
and x[:f].length > 0 #store multiple document language versions, sisupod
x[:f].each do |f|
@@ -277,6 +268,36 @@ module SiSU_Source
end
end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
end
+ def directories
+ SiSU_Env::InfoEnv.new.sisupod_v4(@opt)
+ end
+ def ssm_doc_import_list(f)
+ if @opt.fno =~/\.ssm$/
+ doc_import_list=[]
+ doc_import_list << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
+ doc_import_list.flatten.each do |i|
+ if i =~/.ssi/
+ file_array=IO.readlines(i,'')
+ pod_source_build(file_array)
+ end
+ end
+ end
+ doc_import_list.uniq.flatten
+ end
+ def pod_source_build(file_array)
+ @pwd=Dir.pwd
+ @rgx_doc_import_list=/^<<\s*(\S+?\.ss[ti])/
+ doc_import_list=[]
+ file_array.each do |f| #% work area
+ if f !~/^%+\s/
+ if @opt.fno =~/\.ssm$/
+ @doc_import_list << ssm_doc_import_list(f)
+ doc_import_list=@doc_import_list.flatten.uniq
+ end
+ end
+ end
+ doc_import_list
+ end
end
end
__END__