From a93f8d5da9c2104ebd370ddfcc51021b5a858920 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 11 Jul 2014 00:14:36 -0400 Subject: v5 v6: src, sisupod composite source, nested includes --- data/doc/sisu/CHANGELOG_v5 | 3 +++ data/doc/sisu/CHANGELOG_v6 | 3 +++ lib/sisu/v5/src_shared.rb | 63 ++++++++++++++++++++++++++++++---------------- lib/sisu/v6/src_shared.rb | 63 ++++++++++++++++++++++++++++++---------------- 4 files changed, 90 insertions(+), 42 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index a87629fa..2cca5ac9 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -71,6 +71,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.5.0.orig.tar.xz ~ requires testing ~ version bump, new behavior added to .ssi one of the 3 sisu filetypes +* src, sisupod composite source, nested includes + follow rules for ao_composite (described above) + %% 5.4.5.orig.tar.xz (2014-07-07:27/1) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.4.5 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.4.5-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index c4a7d1a9..ae42efe7 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -61,6 +61,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.1.0.orig.tar.xz ~ requires testing ~ version bump, new behavior added to .ssi one of the 3 sisu filetypes +* src, sisupod composite source, nested includes + follow rules for ao_composite (described above) + %% 6.0.11.orig.tar.xz (2014-07-07:27/1) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.0.11 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.0.11-1 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__ -- cgit v1.2.3