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 --- data/doc/sisu/CHANGELOG_v5 | 2 ++ data/doc/sisu/CHANGELOG_v6 | 2 ++ lib/sisu/v5/ao_expand_insertions.rb | 35 +++++++++++++++++++++++++++++------ lib/sisu/v6/ao_expand_insertions.rb | 35 +++++++++++++++++++++++++++++------ 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index f0bc0f4b..bd4cd945 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.2.orig.tar.xz sisu_5.6.2.orig.tar.xz sisu_5.6.2-1.dsc +* ao_expand_insertions, blocked text match, adjust + * texpdf, output, copyright & license * syntax hilighting, restrict heading matches, minor diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 82c7d074..f7d7997d 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.3.orig.tar.xz sisu_6.2.3.orig.tar.xz sisu_6.2.3-1.dsc +* ao_expand_insertions, blocked text match, adjust + * texpdf, output, copyright & license * syntax hilighting, restrict heading matches, minor diff --git a/lib/sisu/v5/ao_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb index be326a7a..483e9fdb 100644 --- a/lib/sisu/v5/ao_expand_insertions.rb +++ b/lib/sisu/v5/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='' 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