From 6c757d0138dc18aa176a64c751487ea40ef5641c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Aug 2014 18:34:11 -0400 Subject: v5 v6: cosmetic code --- lib/sisu/v6/ao_expand_insertions.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/sisu/v6/ao_expand_insertions.rb') diff --git a/lib/sisu/v6/ao_expand_insertions.rb b/lib/sisu/v6/ao_expand_insertions.rb index 45a3a4ab..63cdc942 100644 --- a/lib/sisu/v6/ao_expand_insertions.rb +++ b/lib/sisu/v6/ao_expand_insertions.rb @@ -142,7 +142,7 @@ module SiSU_AO_Insertions } end def path_and_file(fn,pth) - "#{@base_path}/#{pth}/#{fn}" + @base_path + '/' + pth + '/' + fn end def manifest fn=@md.file.base_filename.manifest(fnh) @@ -150,7 +150,7 @@ module SiSU_AO_Insertions end def html_toc fn=@md.file.base_filename.html_segtoc(fnh) - "#{@base_path}/html/#{@linked_doc}/#{fn}" + @base_path + '/html/' + @linked_doc + '/' + fn end def html_doc fn=@md.file.base_filename.html_scroll(fnh) @@ -158,7 +158,7 @@ module SiSU_AO_Insertions end def html_concordance fn=@md.file.base_filename.html_concordance - "#{@base_path}/html/#{@linked_doc}/#{fn}" + @base_path + '/html/' + @linked_doc + '/' + fn end def epub fn=@md.file.base_filename.epub(fnh) @@ -197,16 +197,17 @@ module SiSU_AO_Insertions path_and_file(fn,'digest') end def source - "#{@base_path}/src/#{@src}" + @base_path + '/src/' + @src end def sisupod - "#{@base_path}/src/#{@src}.zip" + @base_path + '/src/' + @src + '.zip' end self end def by_filetype(linked_doc,lng,src=nil) @linked_doc,@lng,@src=linked_doc,lng,src - @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).language_code_insert + @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng). + language_code_insert @base_path="#{@md.file.output_path.base.url}" def fnh { @@ -215,7 +216,7 @@ module SiSU_AO_Insertions } end def path_and_file(fn,pth) - "#{@base_path}/#{pth}/#{fn}" + @base_path + '/' + pth + '/' + fn end def manifest fn=@md.file.base_filename.manifest(fnh) @@ -270,10 +271,10 @@ module SiSU_AO_Insertions path_and_file(fn,'digest') end def source - "#{@base_path}/src/#{@src}" + @base_path + '/src/' + @src end def sisupod - "#{@base_path}/src/#{@src}.zip" + @base_path + '/src/' + @src + '.zip' end self end @@ -289,8 +290,8 @@ module SiSU_AO_Insertions end def path_and_file(fn,pth=nil) (pth.nil?) \ - ? "#{@base_path}/#{fn}" - : "#{@base_path}/#{pth}/#{fn}" + ? @base_path + '/' + fn + : @base_path + '/' + pth + '/' + fn end def manifest fn=@md.file.base_filename.manifest(fnh) @@ -345,10 +346,10 @@ module SiSU_AO_Insertions path_and_file(fn) end def source - "#{@base_path}/#{@src}" + @base_path + '/' + @src end def sisupod - "#{@base_path}/#{@src}.zip" + @base_path + '/' + @src + '.zip' end self end @@ -366,7 +367,6 @@ module SiSU_AO_Insertions if para !~/^%+\s/ \ and not codeblock_ \ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ - manifest=nil @u=SiSU_Env::InfoEnv.new.url m_cmd='' if defined? @u.remote -- cgit v1.2.3 From 0fda4e964a07556aa2de453b841eba46524b84b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Aug 2014 18:45:06 -0400 Subject: v5 v6: ao_expand_insertions, blocked text match, adjust --- lib/sisu/v6/ao_expand_insertions.rb | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'lib/sisu/v6/ao_expand_insertions.rb') diff --git a/lib/sisu/v6/ao_expand_insertions.rb b/lib/sisu/v6/ao_expand_insertions.rb index 63cdc942..8eb0e5c4 100644 --- a/lib/sisu/v6/ao_expand_insertions.rb +++ b/lib/sisu/v6/ao_expand_insertions.rb @@ -356,16 +356,39 @@ module SiSU_AO_Insertions def expand_insertions? data=@data tuned_file,tuned_file_tmp=[],[] - codeblock_=false + codeblock_={ + status: :false, + type: :na, + } data.each do |para| - codeblock_=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/ - true - elsif para =~/^(?:\}code|```(?:\s|$))/m - false + codeblock_=if para =~/^code(?:\.[a-z][0-9a-z_]+)?\{/ \ + and codeblock_[:status]==:false + { + status: :true, + type: :curl, + } + elsif para =~/^```[ ]+code(?:\.[a-z][0-9a-z_]+)?/ \ + and codeblock_[:status]==:false + { + status: :true, + type: :tics, + } + elsif codeblock_[:type]==:curl \ + and para =~/^\}code/m + { + status: :false, + type: :na, + } + elsif codeblock_[:type]==:tics \ + and para =~/^```(?:\s|$)/m + { + status: :false, + type: :na, + } else codeblock_ end if para !~/^%+\s/ \ - and not codeblock_ \ + and codeblock_[:status] != :true \ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ @u=SiSU_Env::InfoEnv.new.url m_cmd='' -- cgit v1.2.3