From e881dffcbeae1fcdebdc07ec4ce262564c49db86 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 1 Jul 2014 00:52:27 -0400 Subject: v5 v6: ao, doc objects, layout group open & close, identify, is_for --- data/doc/sisu/CHANGELOG_v5 | 1 + data/doc/sisu/CHANGELOG_v6 | 1 + lib/sisu/v5/ao_doc_objects.rb | 9 +++++---- lib/sisu/v5/ao_doc_str.rb | 22 +++++++++++++++++++++- lib/sisu/v6/ao_doc_objects.rb | 9 +++++---- lib/sisu/v6/ao_doc_str.rb | 22 +++++++++++++++++++++- 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 6605fc8e..9d14921a 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -43,6 +43,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.3.orig.tar.xz * book index, strip white spaces around terms (fix uppercase first character where spaces used) * quote block, insert text indent markup, exclude book index + * doc objects, layout group open & close identify is_for * code cosmetic rearrangement * ao*, param, hub, options, composite diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 266f1219..72369d35 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -33,6 +33,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.9.orig.tar.xz * book index, strip white spaces around terms (fix uppercase first character where spaces used) * quote block, insert text indent markup, exclude book index + * doc objects, layout group open & close identify is_for * code cosmetic rearrangement * ao*, param, hub, options, composite diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index 1357ee90..b372da4c 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -499,10 +499,10 @@ module SiSU_AO_DocumentStructure end end class ObjectLayout - attr_accessor :obj,:sym,:attr,:is,:of,:from,:tmp,:num + attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num def initialize @of=:layout - @is=@obj=@from=@tmp=@num=nil + @is=@is_for=@obj=@from=@tmp=@num=nil end def break(h,f=nil) #decide how to deal with of= @of #Symbol, classification - group @@ -524,13 +524,14 @@ module SiSU_AO_DocumentStructure def open_close(h,o=nil) #useful for poem & quote of= @of #Symbol, classification - group is= :open_close_tags #Symbol, classification - specific type + is_for= h[:is_for] || ((defined? o.is_for) ? o.is_for : nil) #String, text content obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use num= h[:num] || ((defined? o.num) ? o.num : nil) - @of,@is,@obj,@sym,@attr,@tmp,@num= - of, is, obj, sym, attr, tmp, num + @of,@is,@is_for,@obj,@sym,@attr,@tmp,@num= + of, is, is_for, obj, sym, attr, tmp, num self end end diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index c3b65ee1..5b93819e 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -533,6 +533,7 @@ module SiSU_AO_DocumentStructureExtract : false @num_id[:code_block] +=1 h={ + is_for: :code, obj: '', sym: :code_block_open, num: @num_id[:code_block], @@ -547,6 +548,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:poem] +=1 h={ + is_for: :poem, obj: '', sym: :poem_open, num: @num_id[:poem], @@ -561,6 +563,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:box] +=1 h={ + is_for: :box, obj: '', sym: :box_open, num: @num_id[:box], @@ -575,6 +578,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:group] +=1 h={ + is_for: :group, obj: '', sym: :group_open, num: @num_id[:group], @@ -589,6 +593,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:block] +=1 h={ + is_for: :block, obj: '', sym: :block_open, num: @num_id[:block], @@ -603,6 +608,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:alt] +=1 h={ + is_for: :alt, obj: '', sym: :alt_open, num: @num_id[:alt], @@ -613,6 +619,7 @@ module SiSU_AO_DocumentStructureExtract @@flag[:quote]=:open @num_id[:quote] +=1 h={ + is_for: :quote, obj: '', sym: :quote_open, num: @num_id[:quote], @@ -622,6 +629,7 @@ module SiSU_AO_DocumentStructureExtract elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/ @num_id[:table] +=1 h={ + is_for: :table, obj: '', sym: :table_open, num: @num_id[:table], @@ -701,6 +709,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -736,6 +745,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -771,6 +781,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -799,6 +810,7 @@ module SiSU_AO_DocumentStructureExtract tuned_file << t_o @h,@rows=nil,'' h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -834,6 +846,7 @@ module SiSU_AO_DocumentStructureExtract @tuned_code=[] tuned_file << t_o h={ + is_for: :code, obj: '', sym: :code_close, num: @num_id[:code_block], @@ -859,6 +872,7 @@ module SiSU_AO_DocumentStructureExtract or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:poem]=:off h={ + is_for: :poem, obj: '', sym: :poem_close, num: @num_id[:poem], @@ -877,6 +891,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h) tuned_file << t_o h={ + is_for: :box, obj: '', sym: :box_close, num: @num_id[:box], @@ -895,6 +910,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o h={ + is_for: :group, obj: '', sym: :group_close, num: @num_id[:group], @@ -912,7 +928,9 @@ module SiSU_AO_DocumentStructureExtract @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o - h={ obj: '', + h={ + is_for: :block, + obj: '', sym: :block_close, num: @num_id[:block], } @@ -930,6 +948,7 @@ module SiSU_AO_DocumentStructureExtract @tuned_block=[] tuned_file << t_o h={ + is_for: :alt, obj: '', sym: :alt_close, num: @num_id[:alt], @@ -938,6 +957,7 @@ module SiSU_AO_DocumentStructureExtract elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m @@flag[:quote]=:off h={ + is_for: :quote, obj: '', sym: :quote_close, num: @num_id[:quote], diff --git a/lib/sisu/v6/ao_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb index 909bb600..44660469 100644 --- a/lib/sisu/v6/ao_doc_objects.rb +++ b/lib/sisu/v6/ao_doc_objects.rb @@ -499,10 +499,10 @@ module SiSU_AO_DocumentStructure end end class ObjectLayout - attr_accessor :obj,:sym,:attr,:is,:of,:from,:tmp,:num + attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num def initialize @of=:layout - @is=@obj=@from=@tmp=@num=nil + @is=@is_for=@obj=@from=@tmp=@num=nil end def break(h,f=nil) #decide how to deal with of= @of #Symbol, classification - group @@ -524,13 +524,14 @@ module SiSU_AO_DocumentStructure def open_close(h,o=nil) #useful for poem & quote of= @of #Symbol, classification - group is= :open_close_tags #Symbol, classification - specific type + is_for= h[:is_for] || ((defined? o.is_for) ? o.is_for : nil) #String, text content obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use num= h[:num] || ((defined? o.num) ? o.num : nil) - @of,@is,@obj,@sym,@attr,@tmp,@num= - of, is, obj, sym, attr, tmp, num + @of,@is,@is_for,@obj,@sym,@attr,@tmp,@num= + of, is, is_for, obj, sym, attr, tmp, num self end end diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index 001b2aef..0c07eee7 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -533,6 +533,7 @@ module SiSU_AO_DocumentStructureExtract : false @num_id[:code_block] +=1 h={ + is_for: :code, obj: '', sym: :code_block_open, num: @num_id[:code_block], @@ -547,6 +548,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:poem] +=1 h={ + is_for: :poem, obj: '', sym: :poem_open, num: @num_id[:poem], @@ -561,6 +563,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:box] +=1 h={ + is_for: :box, obj: '', sym: :box_open, num: @num_id[:box], @@ -575,6 +578,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:group] +=1 h={ + is_for: :group, obj: '', sym: :group_open, num: @num_id[:group], @@ -589,6 +593,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:block] +=1 h={ + is_for: :block, obj: '', sym: :block_open, num: @num_id[:block], @@ -603,6 +608,7 @@ module SiSU_AO_DocumentStructureExtract end @num_id[:alt] +=1 h={ + is_for: :alt, obj: '', sym: :alt_open, num: @num_id[:alt], @@ -613,6 +619,7 @@ module SiSU_AO_DocumentStructureExtract @@flag[:quote]=:open @num_id[:quote] +=1 h={ + is_for: :quote, obj: '', sym: :quote_open, num: @num_id[:quote], @@ -622,6 +629,7 @@ module SiSU_AO_DocumentStructureExtract elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/ @num_id[:table] +=1 h={ + is_for: :table, obj: '', sym: :table_open, num: @num_id[:table], @@ -701,6 +709,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -736,6 +745,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -771,6 +781,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -799,6 +810,7 @@ module SiSU_AO_DocumentStructureExtract tuned_file << t_o @h,@rows=nil,'' h={ + is_for: :table, obj: '', sym: :table_close, num: @num_id[:table], @@ -834,6 +846,7 @@ module SiSU_AO_DocumentStructureExtract @tuned_code=[] tuned_file << t_o h={ + is_for: :code, obj: '', sym: :code_close, num: @num_id[:code_block], @@ -859,6 +872,7 @@ module SiSU_AO_DocumentStructureExtract or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:poem]=:off h={ + is_for: :poem, obj: '', sym: :poem_close, num: @num_id[:poem], @@ -877,6 +891,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h) tuned_file << t_o h={ + is_for: :box, obj: '', sym: :box_close, num: @num_id[:box], @@ -895,6 +910,7 @@ module SiSU_AO_DocumentStructureExtract t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o h={ + is_for: :group, obj: '', sym: :group_close, num: @num_id[:group], @@ -912,7 +928,9 @@ module SiSU_AO_DocumentStructureExtract @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o - h={ obj: '', + h={ + is_for: :block, + obj: '', sym: :block_close, num: @num_id[:block], } @@ -930,6 +948,7 @@ module SiSU_AO_DocumentStructureExtract @tuned_block=[] tuned_file << t_o h={ + is_for: :alt, obj: '', sym: :alt_close, num: @num_id[:alt], @@ -938,6 +957,7 @@ module SiSU_AO_DocumentStructureExtract elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m @@flag[:quote]=:off h={ + is_for: :quote, obj: '', sym: :quote_close, num: @num_id[:quote], -- cgit v1.2.3