aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/ao_expand_insertions.rb35
-rw-r--r--lib/sisu/v6/ao_expand_insertions.rb35
2 files changed, 58 insertions, 12 deletions
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=''