aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/dal_doc_str.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-06-25 00:07:44 -0400
committerRalph Amissah <ralph@amissah.com>2013-06-25 00:07:44 -0400
commitc25fc2751886278a4e7f30f127e80449160a47f1 (patch)
treed19cab06d629a995848a296409693b5890d59f60 /lib/sisu/v4/dal_doc_str.rb
parentv5: "general code cleaning" fix (diff)
v4: general code cleaning, sync with v5sisu_4.1.6
Diffstat (limited to 'lib/sisu/v4/dal_doc_str.rb')
-rw-r--r--lib/sisu/v4/dal_doc_str.rb43
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index 25c6f854..1eeae2da 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -78,7 +78,7 @@ module SiSU_DAL_DocumentStructureExtract
@pbl=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line])
end
def ln_get(lv)
- ln=case lv
+ case lv
when /A/; 1
when /B/; 2
when /C/; 3
@@ -91,10 +91,14 @@ module SiSU_DAL_DocumentStructureExtract
end
end
def image_test(str)
- boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false)
+ str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ \
+ ? true
+ : false
end
def bullet_test(str)
- bool=((str=~/\*/) ? true : false)
+ (str=~/\*/) \
+ ? true
+ : false
end
def hang_and_indent_test(str)
hang_indent=if str=~/^_([1-9])[^_]/
@@ -128,7 +132,9 @@ module SiSU_DAL_DocumentStructureExtract
[hang,indent,obj]
end
def endnote_test?(str)
- bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false)
+ (str=~/~\{.+?\}~|~\[.+?\]~/) \
+ ? true
+ : false
end
def extract_tags(str,nametag=nil)
tags=[]
@@ -146,7 +152,6 @@ module SiSU_DAL_DocumentStructureExtract
[str,tags]
end
def identify_parts
- data=@data
tuned_file=[]
@tuned_block,@tuned_code=[],[]
@@counter,@verse_count=0,0
@@ -365,7 +370,6 @@ module SiSU_DAL_DocumentStructureExtract
t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
- t_o
h={ obj: 'table end' } #introduce a counter
t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
t_o
@@ -448,20 +452,21 @@ module SiSU_DAL_DocumentStructureExtract
and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ # fix logic
sub_array=t_o.dup
@line_mode=sub_array.scan(/.+/)
- type=if @@flag['poem']; 'poem'
- t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
- poem=t_o.split(/\n\n/)
- poem.each do |v|
- v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
- obj,tags=extract_tags(v)
- h={ obj: obj, tags: tags }
- t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h)
- tuned_file << t_o
- end
+ type=if @@flag['poem']
+ t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join
+ poem=t_o.split(/\n\n/)
+ poem.each do |v|
+ v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
+ obj,tags=extract_tags(v)
+ h={ obj: obj, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h)
+ tuned_file << t_o
+ end
+ 'poem'
else 'group'
end
- @verse_count+=1 if @@flag['poem']
end
+ @verse_count+=1 if @@flag['poem']
end
if not @@flag['code']
if @@flag['poem'] \
@@ -507,7 +512,6 @@ module SiSU_DAL_DocumentStructureExtract
tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false }
tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
- tuned_file
h={ obj: 'eof' }
meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
[tuned_file,meta]
@@ -597,8 +601,7 @@ module SiSU_DAL_DocumentStructureExtract
def ocn #and auto segment numbering increment
data=@data
@o_array=[]
- node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image
- node_count_flag=false
+ node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image
regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #ยก
parent=node1=node2=node3=node4=node5=node6=nil
data.each do |dob|