aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/ao_doc_str.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v6/ao_doc_str.rb')
-rw-r--r--lib/sisu/v6/ao_doc_str.rb39
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb
index 25735de7..6e7a103f 100644
--- a/lib/sisu/v6/ao_doc_str.rb
+++ b/lib/sisu/v6/ao_doc_str.rb
@@ -305,6 +305,18 @@ module SiSU_AO_DocumentStructureExtract
next
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
+ unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
+ idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m
+ m=$1
+ m=m.split(/[ ]*\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+]\d+)\s+/,'\1')
+ t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
+ idx_array_and_hash=construct_idx_array_and_hash(m)
+ idx_array_and_hash[:hash]
+ else nil
+ end
+ end
if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
and @@flag[:code]==:off \
@@ -314,17 +326,6 @@ module SiSU_AO_DocumentStructureExtract
and @@flag[:alt]==:off \
and @@flag[:box]==:off \
and @@flag[:table]==:off
- unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
- idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1
- m=m.split(/[ ]*\n/).join(' ').
- gsub(/\s+([|:;])\s+/,'\1').
- gsub(/\s+([+]\d+)\s+/,'\1')
- t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
- idx_array_and_hash=construct_idx_array_and_hash(m)
- idx_array_and_hash[:hash]
- else nil
- end
- end
t_o=case t_o
when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
@@ -842,14 +843,17 @@ module SiSU_AO_DocumentStructureExtract
if (@@flag[:code]==:curls \
&& t_o =~/^\}code/) \
or (@@flag[:code]==:tics \
- && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m)
@@flag[:code]=:off
- @tuned_code[-1].
- gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ if @tuned_code[-1]
+ @tuned_code[-1].
+ gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ end
obj=@tuned_code.join("\n")
tags=[]
h={
obj: obj,
+ idx: idx,
syntax: @@flag[:lngsyn],
tags: tags,
num: @num_id[:code_block],
@@ -897,6 +901,7 @@ module SiSU_AO_DocumentStructureExtract
h={
is_for: :poem,
obj: '',
+ idx: idx,
sym: :poem_close,
num: @num_id[:poem],
}
@@ -909,6 +914,7 @@ module SiSU_AO_DocumentStructureExtract
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:box],
}
@@ -918,6 +924,7 @@ module SiSU_AO_DocumentStructureExtract
h={
is_for: :box,
obj: '',
+ idx: idx,
sym: :box_close,
num: @num_id[:box],
}
@@ -930,6 +937,7 @@ module SiSU_AO_DocumentStructureExtract
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:group],
}
@@ -951,6 +959,7 @@ module SiSU_AO_DocumentStructureExtract
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:block],
}
@@ -972,6 +981,7 @@ module SiSU_AO_DocumentStructureExtract
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:alt],
}
@@ -990,6 +1000,7 @@ module SiSU_AO_DocumentStructureExtract
@@flag[:quote]=:off
h={
is_for: :quote,
+ idx: idx,
obj: '',
sym: :quote_close,
num: @num_id[:quote],