aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-07-01 00:47:13 -0400
committerRalph Amissah <ralph@amissah.com>2014-07-01 00:47:23 -0400
commit844f9270e3190ec55666d787cfc8c482997cfc06 (patch)
treef1d772765da121d0827156590c269f9d1f637a15 /lib
parentv5 v6: ao, code cosmetic rearrangement (diff)
v5 v6: ao, (param), book index, strip white spaces around terms
* fix uppercase first character where spaces used
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/ao_doc_str.rb7
-rw-r--r--lib/sisu/v5/param.rb2
-rw-r--r--lib/sisu/v6/ao_doc_str.rb7
-rw-r--r--lib/sisu/v6/param.rb2
4 files changed, 10 insertions, 8 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 9743f794..c3b65ee1 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -200,6 +200,7 @@ module SiSU_AO_DocumentStructureExtract
idx_array_raw=idxraw.scan(/[^;]+/)
idx_hash,idx_array,idx_lst={},[],[]
idx_array_raw.each do |idx|
+ idx=idx.strip
idx_lst=case idx
when /\S+?\s*:/
idx_couplet_tmp=[]
@@ -308,11 +309,11 @@ module SiSU_AO_DocumentStructureExtract
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*$\Z/m; m=$1
- m=m.split(/\n/).join(' ').
+ 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*$\Z/m,'')
+ 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
diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb
index d20a0129..b2e50d41 100644
--- a/lib/sisu/v5/param.rb
+++ b/lib/sisu/v5/param.rb
@@ -1167,7 +1167,7 @@ module SiSU_Param
).txt_grey if @opt.act[:verbose][:set]==:on
end
if not @book_idx \
- and para =~/^=\{(.+?)\}\s*$/
+ and para =~/^=\{(.+?)\}[\s`]*\Z/m
@book_idx=true
end
unless @code_flag
diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb
index 675bfc90..001b2aef 100644
--- a/lib/sisu/v6/ao_doc_str.rb
+++ b/lib/sisu/v6/ao_doc_str.rb
@@ -200,6 +200,7 @@ module SiSU_AO_DocumentStructureExtract
idx_array_raw=idxraw.scan(/[^;]+/)
idx_hash,idx_array,idx_lst={},[],[]
idx_array_raw.each do |idx|
+ idx=idx.strip
idx_lst=case idx
when /\S+?\s*:/
idx_couplet_tmp=[]
@@ -308,11 +309,11 @@ module SiSU_AO_DocumentStructureExtract
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*$\Z/m; m=$1
- m=m.split(/\n/).join(' ').
+ 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*$\Z/m,'')
+ 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
diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb
index 1e7ea9de..bacee802 100644
--- a/lib/sisu/v6/param.rb
+++ b/lib/sisu/v6/param.rb
@@ -1167,7 +1167,7 @@ module SiSU_Param
).txt_grey if @opt.act[:verbose][:set]==:on
end
if not @book_idx \
- and para =~/^=\{(.+?)\}\s*$/
+ and para =~/^=\{(.+?)\}[\s`]*\Z/m
@book_idx=true
end
unless @code_flag