diff options
Diffstat (limited to 'lib/sisu/v3/dal_doc_str.rb')
-rw-r--r-- | lib/sisu/v3/dal_doc_str.rb | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index 8ed8bbda..365973eb 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -144,7 +144,7 @@ module SiSU_document_structure_extract t_o=nil when /^%+\s/ #comment t_o=if t_o=~/^%+\s+(.+)/ - h={:obj=>$1} + h={obj: $1} SiSU_document_structure::Object_comment.new.comment(h) else nil end @@ -155,19 +155,19 @@ module SiSU_document_structure_extract obj=$1 note=endnote_test?(obj) obj,tags=extract_tags(obj) - h={:lv=>lv,:ln=>ln,:obj=>obj,:idx=>idx,:tags=>tags} + h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } SiSU_document_structure::Object_heading.new.heading(h) elsif t_o=~/^:?[A-C1-6]\~(\S+?)-\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj) - h={:lv=>lv,:name=>name,:obj=>obj,:idx=>idx,:autonum_=>false,:tags=>tags} + h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags} SiSU_document_structure::Object_heading.new.heading(h) elsif t_o=~/^:?[A-C1-6]\~(\S+)\s+(.+)/m name,obj=$1,$2 note=endnote_test?(obj) obj,tags=extract_tags(obj,name) - h={:lv=>lv,:name=>name,:obj=>obj,:idx=>idx,:tags=>tags} + h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags } SiSU_document_structure::Object_heading.new.heading(h) else nil end @@ -179,7 +179,7 @@ module SiSU_document_structure_extract image=image_test(obj) note=endnote_test?(obj) obj,tags=extract_tags(obj) - h={:bullet_=>bullet,:indent=>indent,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags} + h={ bullet_: bullet, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) else nil end @@ -193,7 +193,7 @@ module SiSU_document_structure_extract image=image_test(t_o) note=endnote_test?(t_o) obj,tags=extract_tags(t_o) - h={:bullet_=>false,:indent=>0,:obj=>obj,:idx=>idx,:note_=>note,:image_=>image,:tags=>tags} + h={ bullet_: false, indent: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) end elsif not @@flag['code'] @@ -201,30 +201,30 @@ module SiSU_document_structure_extract @@flag['code']=true @@counter=1 @codeblock_numbered=(t_o =~/^code\{#/) ? true : false - h={:obj=>'code block start'} #introduce a counter + h={ obj: 'code block start' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) elsif t_o =~/^poem\{/ @@flag['poem']=true - h={:obj=>'poem start'} #introduce a counter + h={ obj: 'poem start' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) tuned_file << t_o elsif t_o =~/^group\{/ @@flag['group']=true - h={:obj=>'group text start'} #introduce a counter + h={ obj: 'group text start' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) tuned_file << t_o elsif t_o =~/^block\{/ @@flag['block']=true - h={:obj=>'block text start'} #introduce a counter + h={ obj: 'block text start' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) tuned_file << t_o elsif t_o =~/^alt\{/ @@flag['alt']=true - h={:obj=>'alt text start'} #introduce a counter + h={ obj: 'alt text start' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) tuned_file << t_o elsif t_o =~/^(?:table\{|\{table)[ ~]/ - h={:obj=>'table start'} #introduce a counter + h={ obj: 'table start' } #introduce a counter ins=SiSU_document_structure::Object_comment.new.comment(h) #ins=SiSU_document_structure::Object_layout.new.insert(h) tuned_file << ins if t_o=~/^table\{(?:~h)?\s+/ @@ -240,7 +240,7 @@ module SiSU_document_structure_extract col=$2.scan(/\d+/) heading=false end - @h={:head_=>heading,:cols=>cols,:widths=>col,:idx=>idx} + @h={ head_: heading, cols: cols, widths: col, idx: idx } elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m m1,m2,hd=nil,nil,nil tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one @@ -264,10 +264,10 @@ module SiSU_document_structure_extract width=100.00/cols cols.times { col << width } end - h={:head_=>hd,:cols=>cols,:widths=>col,:obj=>rows,:idx=>idx,:tags=>tags} + h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags } t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil? tuned_file << t_o - h={:obj=>'table end'} #introduce a counter + h={ obj: 'table end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) t_o elsif t_o=~/^\{table(?:~h)?\s+/ @@ -287,10 +287,10 @@ module SiSU_document_structure_extract r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={:head_=>hd,:cols=>col.length,:widths=>col,:obj=>rows,:idx=>idx,:tags=>tags} + h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags } t_o=SiSU_document_structure::Object_table.new.table(h) unless h.nil? tuned_file << t_o - h={:obj=>'table end'} #introduce a counter + h={ obj: 'table end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) t_o end @@ -302,12 +302,12 @@ module SiSU_document_structure_extract and t_o =~/^\}table/ #two table representations should be consolidated as one @@flag['table']=false headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx] - @h={:head_=>headings,:cols=>columns,:widths=>widths,:idx=>idx,:obj=>@rows} + @h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows } t_o=SiSU_document_structure::Object_table.new.table(@h) tuned_file << t_o @h,@rows=nil,'' t_o - h={:obj=>'table end'} #introduce a counter + h={ obj: 'table end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) t_o else @@ -322,11 +322,11 @@ module SiSU_document_structure_extract if t_o =~/^\}code/ @@flag['code']=false obj,tags=extract_tags(@tuned_code.join("\n")) - h={:obj=>obj,:tags=>tags,:number_=>@codeblock_numbered} + h={ obj: obj, tags: tags, number_: @codeblock_numbered } t_o=SiSU_document_structure::Object_block_txt.new.code(h) @tuned_code=[] tuned_file << t_o - h={:obj=>'code block end'} #introduce a counter + h={ obj: 'code block end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) end if @@flag['code'] \ @@ -347,37 +347,37 @@ module SiSU_document_structure_extract if @@flag['poem'] \ and t_o =~/^\}poem/ @@flag['poem']=false - h={:obj=>'poem end'} #introduce a counter + h={ obj: 'poem end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) elsif ( @@flag['group'] \ and t_o =~/^\}group/ ) @@flag['group']=false obj,tags=extract_tags(@tuned_block.join("\n")) - h={:obj=>obj,:tags=>tags} + h={ obj: obj, tags: tags } @tuned_block=[] t_o=SiSU_document_structure::Object_block_txt.new.group(h) tuned_file << t_o - h={:obj=>'group text end'} #introduce a counter + h={ obj: 'group text end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) elsif ( @@flag['block'] \ and t_o =~/^\}block/ ) @@flag['block']=false obj,tags=extract_tags(@tuned_block.join("\n")) - h={:obj=>obj,:tags=>tags} + h={ obj: obj, tags: tags } @tuned_block=[] t_o=SiSU_document_structure::Object_block_txt.new.block(h) tuned_file << t_o - h={:obj=>'block text end'} #introduce a counter + h={ obj: 'block text end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) elsif ( @@flag['alt'] \ and t_o =~/^\}alt/ ) @@flag['alt']=false obj,tags=extract_tags(@tuned_block.join("\n")) - h={:obj=>obj,:tags=>tags} + h={ obj: obj, tags: tags } t_o=SiSU_document_structure::Object_block_txt.new.alt(h) @tuned_block=[] tuned_file << t_o - h={:obj=>'alt text end'} #introduce a counter + h={ obj: 'alt text end' } #introduce a counter t_o=SiSU_document_structure::Object_comment.new.comment(h) #t_o=SiSU_document_structure::Object_layout.new.insert(h) end if @@flag['poem'] \ @@ -393,7 +393,7 @@ module SiSU_document_structure_extract poem.each do |v| v.gsub!(/\n/m,"#{Mx[:br_nl]}\n") obj,tags=extract_tags(v) - h={:obj=>obj,:tags=>tags} + h={ obj: obj, tags: tags } t_o=SiSU_document_structure::Object_block_txt.new.verse(h) tuned_file << t_o end @@ -427,32 +427,32 @@ module SiSU_document_structure_extract end if @md.flag_endnotes tuned_file << @pb - h={:ln=>2,:obj=>'Endnotes',:autonum_=>false} + h={ ln: 2, obj: 'Endnotes', autonum_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:ln=>4,:obj=>'Endnotes',:name=>'endnotes',:autonum_=>false} + h={ ln: 4, obj: 'Endnotes', name: 'endnotes', autonum_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:obj=>'Endnotes'} + h={ obj: 'Endnotes' } end if @md.book_idx tuned_file << @pb - h={:ln=>2,:obj=>'Index',:autonum_=>false} + h={ ln: 2, obj: 'Index', autonum_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:ln=>4,:obj=>'Index',:name=>'book_index',:autonum_=>false} + h={ ln: 4, obj: 'Index', name: 'book_index', autonum_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:obj=>'Index'} + h={ obj: 'Index' } end tuned_file << @pb - h={:ln=>2,:obj=>'Metadata',:autonum_=>false,:ocn_=>false} + h={ ln: 2, obj: 'Metadata', autonum_: false, ocn_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:ln=>4,:obj=>'SiSU Metadata, document information',:name=>'metadata',:autonum_=>false,:ocn_=>false} + h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) tuned_file << @pb - h={:ln=>2,:obj=>'Manifest',:autonum_=>false,:ocn_=>false} + h={ ln: 2, obj: 'Manifest', autonum_: false, ocn_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) - h={:ln=>4,:obj=>'SiSU Manifest, alternative outputs etc.',:name=>'sisu_manifest',:autonum_=>false,:ocn_=>false} + h={ ln: 4, obj: 'SiSU Manifest, alternative outputs etc.', name: 'sisu_manifest', autonum_: false, ocn_: false } tuned_file << SiSU_document_structure::Object_heading.new.heading_insert(h) tuned_file - h={:obj=>'eof'} + h={ obj: 'eof' } meta=SiSU_document_structure::Object_metadata.new.metadata(@metadata) [tuned_file,meta] end @@ -465,11 +465,11 @@ module SiSU_document_structure_extract table end def meta_heading(h) - h={:lv=>h[:lv],:ln=>h[:ln],:name=>h[:name],:obj=>h[:obj],:ocn=>'0'} + h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' } SiSU_document_structure::Object_heading.new.heading(h) end def meta_para(str) - h={:obj=>str,:ocn_=>false} + h={ obj: str, ocn_: false } SiSU_document_structure::Object_para.new.paragraph(h) end def metadata @@ -480,9 +480,9 @@ module SiSU_document_structure_extract language=l[:l] tr=SiSU_Translate::Source.new(@md,language) meta << @pb - h={:ln=>2,:obj=>'Metadata',:ocn_=>false} + h={ ln: 2, obj: 'Metadata', ocn_: false } meta << SiSU_document_structure::Object_heading.new.heading(h) - h={:ln=>4,:name=>'metadata',:obj=>'Metadata',:autonum_=>false,:ocn_=>false} + h={ ln: 4, name: 'metadata', obj: 'Metadata', autonum_: false, ocn_: false } meta << SiSU_document_structure::Object_heading.new.heading(h) #add ocnm s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}" meta << meta_para(s) @@ -723,22 +723,22 @@ module SiSU_document_structure_extract and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv1}/ - h={:lv=>'A',:ln=>1} + h={ lv: 'A', ln: 1 } SiSU_document_structure::Object_heading.new.heading(h,@dob) when /^#{@md.lv2}/ - h={:lv=>'B',:ln=>2} + h={ lv: 'B', ln: 2 } SiSU_document_structure::Object_heading.new.heading(h,@dob) when /^#{@md.lv3}/ - h={:lv=>'C',:ln=>3} + h={ lv: 'C', ln: 3 } SiSU_document_structure::Object_heading.new.heading(h,@dob) when /^#{@md.lv4}/ - h={:lv=>'1',:ln=>4} + h={ lv: '1', ln: 4 } SiSU_document_structure::Object_heading.new.heading(h,@dob) when /^#{@md.lv5}/ - h={:lv=>'2',:ln=>5} + h={ lv: '2', ln: 5 } SiSU_document_structure::Object_heading.new.heading(h,@dob) when /^#{@md.lv6}/ - h={:lv=>'3',:ln=>6} + h={ lv: '3', ln: 6 } SiSU_document_structure::Object_heading.new.heading(h,@dob) else @dob end @@ -896,19 +896,19 @@ module SiSU_document_structure_extract elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/ dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}/,'') if dob.is=='para' - h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil} + h={ obj: dob.obj, ocn_: false, ocn: nil } dob=SiSU_document_structure::Object_para.new.paragraph(h,dob) elsif dob.is=='heading' - h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil,:toc_=>true} + h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true } dob=SiSU_document_structure::Object_heading.new.heading(h,dob) end elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/ dob.obj.gsub!(/#{Mx[:pa_non_object_dummy_heading]}/,'') if dob.is=='para' - h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil} + h={ obj: dob.obj, ocn_: false, ocn: nil } dob=SiSU_document_structure::Object_para.new.paragraph(h,dob) elsif dob.is=='heading' - h={:obj=>dob.obj,:ocn_=>false,:ocn=>nil,:toc_=>false} + h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false } dob=SiSU_document_structure::Object_heading.new.heading(h,dob) end else dob @@ -940,7 +940,7 @@ module SiSU_document_structure_extract data=@data tuned_file=[] hs=[0,false,false,false] - t={:lv =>@s[0],:status =>'open'} + t={ lv: @s[0], status: 'open' } tuned_file << tags(t) if @md.cmd =~/V/ puts "\nXML sisu structure outline --->\n" @@ -1022,11 +1022,11 @@ module SiSU_document_structure_extract when '5'; 8 when '6'; 9 end - h={:tag=>tag,:node=>o[:node],:lv =>o[:lv],:ln =>ln,:status =>o[:status]} + h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } SiSU_document_structure::Object_structure.new.xml_dom(h) #downstream code utilise else ignore like comments end def tag_open(o,tag) - t={:lv =>tag[o.ln],:node =>o.node,:status =>'open'} + t={ lv: tag[o.ln], node: o.node, status: 'open' } t_o=tags(t) t_o end @@ -1035,116 +1035,116 @@ module SiSU_document_structure_extract case hs[0] when 1 if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end when 2 if (lev <= 2) and hs[2] - t={:lv =>@s[2],:status =>'close'} + t={ lv: @s[2], status: 'close' } ary << tags(t) end if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end when 3 if (lev <= 3) and hs[3] - t={:lv =>@s[3],:status =>'close'} + t={ lv: @s[3], status: 'close' } ary << tags(t) end if (lev <= 2) and hs[2] - t={:lv =>@s[2],:status =>'close'} + t={ lv: @s[2], status: 'close' } ary << tags(t) end if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end when 4 if (lev <= 4) - t={:lv =>@s[4],:status =>'close'} + t={ lv: @s[4], status: 'close' } ary << tags(t) end if (lev <= 3) and hs[3] - t={:lv =>@s[3],:status =>'close'} + t={ lv: @s[3], status: 'close' } ary << tags(t) end if (lev <= 2) and hs[2] - t={:lv =>@s[2],:status =>'close'} + t={ lv: @s[2], status: 'close' } ary << tags(t) end if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end when 5 if (lev <= 5) - t={:lv =>@s[5],:status =>'close'} + t={ lv: @s[5], status: 'close' } ary << tags(t) end if (lev <= 4) - t={:lv =>@s[4],:status =>'close'} + t={ lv: @s[4], status: 'close' } ary << tags(t) end if (lev <= 3) and hs[3] - t={:lv =>@s[3],:status =>'close'} + t={ lv: @s[3], status: 'close' } ary << tags(t) end if (lev <= 2) and hs[2] - t={:lv =>@s[2],:status =>'close'} + t={ lv: @s[2], status: 'close' } ary << tags(t) end if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end when 6 if (lev <= 6) - t={:lv =>@s[6],:status =>'close'} + t={ lv: @s[6], status: 'close' } ary << tags(t) end if (lev <= 5) - t={:lv =>@s[5],:status =>'close'} + t={ lv: @s[5], status: 'close' } ary << tags(t) end if (lev <= 4) - t={:lv =>@s[4],:status =>'close'} + t={ lv: @s[4], status: 'close' } ary << tags(t) end if (lev <= 3) and hs[3] - t={:lv =>@s[3],:status =>'close'} + t={ lv: @s[3], status: 'close' } ary << tags(t) end if (lev <= 2) and hs[2] - t={:lv =>@s[2],:status =>'close'} + t={ lv: @s[2], status: 'close' } ary << tags(t) end if (lev <= 1) and hs[1] - t={:lv =>@s[1],:status =>'close'} + t={ lv: @s[1], status: 'close' } ary << tags(t) end if (lev==0) - t={:lv =>@s[0],:status =>'close'} + t={ lv: @s[0], status: 'close' } ary << tags(t) end end |