From fb6abb03ac0cfa136afbe1ca0471c14f9bbb52b4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 31 Jan 2013 18:43:17 -0500 Subject: v4 v3: dal (obj), html, br_page* behavior in html depending on origin of break * markup specified v auto --- lib/sisu/v3/dal_doc_objects.rb | 13 +++++++------ lib/sisu/v3/dal_doc_str.rb | 4 ++-- lib/sisu/v3/html_scroll.rb | 6 ++++-- lib/sisu/v3/html_segments.rb | 4 +++- lib/sisu/v4/dal_doc_objects.rb | 13 +++++++------ lib/sisu/v4/dal_doc_str.rb | 4 ++-- lib/sisu/v4/html_scroll.rb | 6 ++++-- lib/sisu/v4/html_segments.rb | 4 +++- 8 files changed, 32 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index 37dfdcd3..13fd8ddb 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -420,17 +420,18 @@ module SiSU_DAL_DocumentStructure end end class ObjectLayout - attr_accessor :obj,:is,:of,:tmp + attr_accessor :obj,:is,:of,:from,:tmp def initialize @of=:layout - @is=@obj=@tmp=nil + @is=@obj=@from=@tmp=nil end - def break(h,o=nil) #decide how to deal with, perhaps no obj? + def break(h,f=nil) #decide how to deal with of= @of #String, classification - group is= :break #String, classification - specific type - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@tmp=of,is,obj,tmp + obj= h[:obj] #String, text content + from= f + tmp= h[:tmp] #available for processing, empty after use + @of,@is,@obj,@from,@tmp=of,is,obj,from,tmp self end def insert(h,o=nil) #decide how to deal with, could mimic paragraph? diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index dafed778..a04ad3ad 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -236,9 +236,9 @@ module SiSU_DAL_DocumentStructureExtract when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj] SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj]) when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg] - SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup) when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn] - SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index ec07e6a4..15bea9eb 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -99,8 +99,7 @@ module SiSU_HTML_Scroll @rcdc=true end dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links - gsub(/href="#{Xx[:segment]}/m,'href="'). - gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'


') + gsub(/href="#{Xx[:segment]}/m,'href="') if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/ unless dob.is ==:code dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') @@ -123,6 +122,9 @@ module SiSU_HTML_Scroll elsif dob.ln==6 sto.heading_body6 end + elsif dob.is==:break \ + and dob.from==:markup + '


' elsif dob.is==:heading_insert x=if dob.ln==1 unless dob.obj.empty? diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index b48c6ddd..a10409f6 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -474,7 +474,9 @@ module SiSU_HTML_Seg sto.code elsif dob.is==:table sto.table - elsif dob.is==:break + elsif dob.is==:break \ + and dob.from==:markup + '


' end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type diff --git a/lib/sisu/v4/dal_doc_objects.rb b/lib/sisu/v4/dal_doc_objects.rb index 37dfdcd3..13fd8ddb 100644 --- a/lib/sisu/v4/dal_doc_objects.rb +++ b/lib/sisu/v4/dal_doc_objects.rb @@ -420,17 +420,18 @@ module SiSU_DAL_DocumentStructure end end class ObjectLayout - attr_accessor :obj,:is,:of,:tmp + attr_accessor :obj,:is,:of,:from,:tmp def initialize @of=:layout - @is=@obj=@tmp=nil + @is=@obj=@from=@tmp=nil end - def break(h,o=nil) #decide how to deal with, perhaps no obj? + def break(h,f=nil) #decide how to deal with of= @of #String, classification - group is= :break #String, classification - specific type - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@obj,@tmp=of,is,obj,tmp + obj= h[:obj] #String, text content + from= f + tmp= h[:tmp] #available for processing, empty after use + @of,@is,@obj,@from,@tmp=of,is,obj,from,tmp self end def insert(h,o=nil) #decide how to deal with, could mimic paragraph? diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb index dafed778..a04ad3ad 100644 --- a/lib/sisu/v4/dal_doc_str.rb +++ b/lib/sisu/v4/dal_doc_str.rb @@ -236,9 +236,9 @@ module SiSU_DAL_DocumentStructureExtract when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj] SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj]) when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg] - SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page],:markup) when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn] - SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) + SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new],:markup) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) diff --git a/lib/sisu/v4/html_scroll.rb b/lib/sisu/v4/html_scroll.rb index bccc96ff..f8d104bb 100644 --- a/lib/sisu/v4/html_scroll.rb +++ b/lib/sisu/v4/html_scroll.rb @@ -99,8 +99,7 @@ module SiSU_HTML_Scroll @rcdc=true end dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links - gsub(/href="#{Xx[:segment]}/m,'href="'). - gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'


') + gsub(/href="#{Xx[:segment]}/m,'href="') if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/ unless dob.is ==:code dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') @@ -123,6 +122,9 @@ module SiSU_HTML_Scroll elsif dob.ln==6 sto.heading_body6 end + elsif dob.is==:break \ + and dob.from==:markup + '


' elsif dob.is==:heading_insert x=if dob.ln==1 unless dob.obj.empty? diff --git a/lib/sisu/v4/html_segments.rb b/lib/sisu/v4/html_segments.rb index 5a110b41..543dc209 100644 --- a/lib/sisu/v4/html_segments.rb +++ b/lib/sisu/v4/html_segments.rb @@ -474,7 +474,9 @@ module SiSU_HTML_Seg sto.code elsif dob.is==:table sto.table - elsif dob.is==:break + elsif dob.is==:break \ + and dob.from==:markup + '


' end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type -- cgit v1.2.3