From df67ee1079d074dc2af54aa87187c6538e73d5d7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 10 Jan 2012 22:50:12 -0500 Subject: v3dv: class names, use more CamelCase --- lib/sisu/v3dv/dal_doc_str.rb | 120 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'lib/sisu/v3dv/dal_doc_str.rb') diff --git a/lib/sisu/v3dv/dal_doc_str.rb b/lib/sisu/v3dv/dal_doc_str.rb index 92be87fb..e51320cb 100644 --- a/lib/sisu/v3dv/dal_doc_str.rb +++ b/lib/sisu/v3dv/dal_doc_str.rb @@ -70,8 +70,8 @@ module SiSU_DocumentStructureExtract def initialize(md,data) @md,@data=md,data Instantiate.new - @pb=SiSU_DocumentStructure::Object_layout.new.break(Hx[:br_page]) - @pbn=SiSU_DocumentStructure::Object_layout.new.break(Hx[:br_page_new]) + @pb=SiSU_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) + @pbn=SiSU_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) end def ln_get(lv) ln=case lv @@ -173,7 +173,7 @@ module SiSU_DocumentStructureExtract when /^%+\s/ #comment t_o=if t_o=~/^%+\s+(.+)/ h={obj: $1} - SiSU_DocumentStructure::Object_comment.new.comment(h) + SiSU_DocumentStructure::ObjectComment.new.comment(h) else nil end when /^:?([A-C1-6])\~/ #heading / lv @@ -184,19 +184,19 @@ module SiSU_DocumentStructureExtract note=endnote_test?(obj) obj,tags=extract_tags(obj) h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } - SiSU_DocumentStructure::Object_heading.new.heading(h) + SiSU_DocumentStructure::ObjectHeading.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} - SiSU_DocumentStructure::Object_heading.new.heading(h) + SiSU_DocumentStructure::ObjectHeading.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 } - SiSU_DocumentStructure::Object_heading.new.heading(h) + SiSU_DocumentStructure::ObjectHeading.new.heading(h) else nil end when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph @@ -213,7 +213,7 @@ module SiSU_DocumentStructureExtract obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_DocumentStructure::Object_para.new.paragraph(h) + SiSU_DocumentStructure::ObjectPara.new.paragraph(h) end else nil end @@ -230,23 +230,23 @@ module SiSU_DocumentStructureExtract obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_DocumentStructure::Object_para.new.paragraph(h) + SiSU_DocumentStructure::ObjectPara.new.paragraph(h) end else nil end when /^[<\[](?:br)?:(?:pa?r|o(?:bj|---)?)[>\]]\s*$/ #[br:par] #[br:obj] - SiSU_DocumentStructure::Object_layout.new.break(Hx[:br_obj]) + SiSU_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj]) when /^(?:[<\[](?:br)?:pg[>\]]|?)\s*$/ #[br:pg] - SiSU_DocumentStructure::Object_layout.new.break(Hx[:br_page]) + SiSU_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) when /^[<\[](?:br)?:pg?n[>\]]\s*$/ #[br:pgn] - SiSU_DocumentStructure::Object_layout.new.break(Hx[:br_page_new]) + SiSU_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) obj,tags=extract_tags(t_o) unless obj=~/\A\s*\Z/m h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } - SiSU_DocumentStructure::Object_para.new.paragraph(h) + SiSU_DocumentStructure::ObjectPara.new.paragraph(h) end end elsif not @@flag['code'] @@ -255,30 +255,30 @@ module SiSU_DocumentStructureExtract @@counter=1 @codeblock_numbered=(t_o =~/^code\{#/) ? true : false h={ obj: 'code block start' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) elsif t_o =~/^poem\{/ @@flag['poem']=true h={ obj: 'poem start' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^group\{/ @@flag['group']=true h={ obj: 'group text start' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^block\{/ @@flag['block']=true h={ obj: 'block text start' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^alt\{/ @@flag['alt']=true h={ obj: 'alt text start' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << t_o elsif t_o =~/^(?:table\{|\{table)[ ~]/ h={ obj: 'table start' } #introduce a counter - ins=SiSU_DocumentStructure::Object_comment.new.comment(h) #ins=SiSU_DocumentStructure::Object_layout.new.insert(h) + ins=SiSU_DocumentStructure::ObjectComment.new.comment(h) #ins=SiSU_DocumentStructure::ObjectLayout.new.insert(h) tuned_file << ins if t_o=~/^table\{(?:~h)?\s+/ @@flag['table']=true @@ -318,10 +318,10 @@ module SiSU_DocumentStructureExtract cols.times { col << width } end h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags } - t_o=SiSU_DocumentStructure::Object_table.new.table(h) unless h.nil? + t_o=SiSU_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) t_o elsif t_o=~/^\{table(?:~h)?\s+/ m1,m2,hd=nil,nil,nil @@ -341,10 +341,10 @@ module SiSU_DocumentStructureExtract rows += r + Mx[:tc_c] end h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags } - t_o=SiSU_DocumentStructure::Object_table.new.table(h) unless h.nil? + t_o=SiSU_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) t_o end end @@ -356,12 +356,12 @@ module SiSU_DocumentStructureExtract @@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 } - t_o=SiSU_DocumentStructure::Object_table.new.table(@h) + t_o=SiSU_DocumentStructure::ObjectTable.new.table(@h) tuned_file << t_o @h,@rows=nil,'' t_o h={ obj: 'table end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) t_o else if t_o !~/^table\{/ \ @@ -379,11 +379,11 @@ module SiSU_DocumentStructureExtract obj=@tuned_code.join("\n") tags=[] h={ obj: obj, tags: tags, number_: @codeblock_numbered } - t_o=SiSU_DocumentStructure::Object_block_txt.new.code(h) + t_o=SiSU_DocumentStructure::ObjectBlockTxt.new.code(h) @tuned_code=[] tuned_file << t_o h={ obj: 'code block end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) end if @@flag['code'] \ and t_o.class==String \ @@ -404,37 +404,37 @@ module SiSU_DocumentStructureExtract and t_o =~/^\}poem/ @@flag['poem']=false h={ obj: 'poem end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.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 } @tuned_block=[] - t_o=SiSU_DocumentStructure::Object_block_txt.new.group(h) + t_o=SiSU_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o h={ obj: 'group text end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.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 } @tuned_block=[] - t_o=SiSU_DocumentStructure::Object_block_txt.new.block(h) + t_o=SiSU_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o h={ obj: 'block text end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.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 } - t_o=SiSU_DocumentStructure::Object_block_txt.new.alt(h) + t_o=SiSU_DocumentStructure::ObjectBlockTxt.new.alt(h) @tuned_block=[] tuned_file << t_o h={ obj: 'alt text end' } #introduce a counter - t_o=SiSU_DocumentStructure::Object_comment.new.comment(h) #t_o=SiSU_DocumentStructure::Object_layout.new.insert(h) + t_o=SiSU_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DocumentStructure::ObjectLayout.new.insert(h) end if @@flag['poem'] \ or @@flag['group'] \ @@ -450,7 +450,7 @@ module SiSU_DocumentStructureExtract v.gsub!(/\n/m,"#{Mx[:br_nl]}\n") obj,tags=extract_tags(v) h={ obj: obj, tags: tags } - t_o=SiSU_DocumentStructure::Object_block_txt.new.verse(h) + t_o=SiSU_DocumentStructure::ObjectBlockTxt.new.verse(h) tuned_file << t_o end else 'group' @@ -484,32 +484,32 @@ module SiSU_DocumentStructureExtract if @md.flag_endnotes tuned_file << @pb h={ ln: 2, obj: 'Endnotes', autonum_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'Endnotes', name: 'endnotes', autonum_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Endnotes' } end if @md.book_idx tuned_file << @pb h={ ln: 2, obj: 'Index', autonum_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'Index', name: 'book_index', autonum_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ obj: 'Index' } end tuned_file << @pb h={ ln: 2, obj: 'Metadata', autonum_: false, ocn_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) tuned_file << @pb h={ ln: 2, obj: 'Manifest', autonum_: false, ocn_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) h={ ln: 4, obj: 'SiSU Manifest, alternative outputs etc.', name: 'sisu_manifest', autonum_: false, ocn_: false } - tuned_file << SiSU_DocumentStructure::Object_heading.new.heading_insert(h) + tuned_file << SiSU_DocumentStructure::ObjectHeading.new.heading_insert(h) tuned_file h={ obj: 'eof' } - meta=SiSU_DocumentStructure::Object_metadata.new.metadata(@metadata) + meta=SiSU_DocumentStructure::ObjectMetadata.new.metadata(@metadata) [tuned_file,meta] end def table_rows_and_columns_array(table_str) @@ -522,24 +522,24 @@ module SiSU_DocumentStructureExtract end def meta_heading(h) h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' } - SiSU_DocumentStructure::Object_heading.new.heading(h) + SiSU_DocumentStructure::ObjectHeading.new.heading(h) end def meta_para(str) h={ obj: str, ocn_: false } - SiSU_DocumentStructure::Object_para.new.paragraph(h) + SiSU_DocumentStructure::ObjectPara.new.paragraph(h) end def metadata meta=[] - dir=SiSU_Env::Info_env.new(@md.fns) + dir=SiSU_Env::InfoEnv.new(@md.fns) base_html="#{dir.url.root}/#{@md.fnb}" - l=SiSU_Env::Standardise_language.new(@md.opt.lng).language + l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language language=l[:n] tr=SiSU_Translate::Source.new(@md,language) meta << @pb h={ ln: 2, obj: 'Metadata', ocn_: false } - meta << SiSU_DocumentStructure::Object_heading.new.heading(h) + meta << SiSU_DocumentStructure::ObjectHeading.new.heading(h) h={ ln: 4, name: 'metadata', obj: 'Metadata', autonum_: false, ocn_: false } - meta << SiSU_DocumentStructure::Object_heading.new.heading(h) #add ocnm + meta << SiSU_DocumentStructure::ObjectHeading.new.heading(h) #add ocnm s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}" meta << meta_para(s) s="#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC)" #add ocnm @@ -781,22 +781,22 @@ module SiSU_DocumentStructureExtract @dob=case @dob.obj when /^#{@md.lv1}/ h={ lv: 'A', ln: 1 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv2}/ h={ lv: 'B', ln: 2 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv3}/ h={ lv: 'C', ln: 3 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv4}/ h={ lv: '1', ln: 4 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv5}/ h={ lv: '2', ln: 5 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv6}/ h={ lv: '3', ln: 6 } - SiSU_DocumentStructure::Object_heading.new.heading(h,@dob) + SiSU_DocumentStructure::ObjectHeading.new.heading(h,@dob) else @dob end else @dob @@ -954,19 +954,19 @@ module SiSU_DocumentStructureExtract dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}/,'') if dob.is=='para' h={ obj: dob.obj, ocn_: false, ocn: nil } - dob=SiSU_DocumentStructure::Object_para.new.paragraph(h,dob) + dob=SiSU_DocumentStructure::ObjectPara.new.paragraph(h,dob) elsif dob.is=='heading' h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true } - dob=SiSU_DocumentStructure::Object_heading.new.heading(h,dob) + dob=SiSU_DocumentStructure::ObjectHeading.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 } - dob=SiSU_DocumentStructure::Object_para.new.paragraph(h,dob) + dob=SiSU_DocumentStructure::ObjectPara.new.paragraph(h,dob) elsif dob.is=='heading' h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false } - dob=SiSU_DocumentStructure::Object_heading.new.heading(h,dob) + dob=SiSU_DocumentStructure::ObjectHeading.new.heading(h,dob) end else dob end @@ -1080,7 +1080,7 @@ module SiSU_DocumentStructureExtract when '6'; 9 end h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } - SiSU_DocumentStructure::Object_structure.new.xml_dom(h) #downstream code utilise else ignore like comments + SiSU_DocumentStructure::ObjectStructure.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' } -- cgit v1.2.3