From ff4ceb260ae3931072810a0ada124841d3b8e032 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 16 Dec 2010 23:19:35 -0500 Subject: document objects: page break; object separator (introduced & used, adjust later) * object separator introduced (requested Cory Doctorow, implementation not discussed) * dal_syntax, object separator syntax (<:---> or <:ols>) * constants, object separator * vim syntax highlighting, match object separator * document objects: page break; object separator (introduced & used) * dal, page break and object separator objects * represent page break and object separator: plaintext, html, epub, odf, texpdf (adjust later) --- lib/sisu/v2/odf.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lib/sisu/v2/odf.rb') diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index 769870eb..d19945c0 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -411,6 +411,18 @@ module SiSU_ODF end dob end + def obj_break(dob) + if dob.is =='break' + br=SiSU_ODF_format::Format_obj_break.new(@md,dob) + if dob.obj==Mx[:br_page] \ + or dob.obj==Mx[:br_page_new] + dob=br.br_page + elsif dob.obj==Mx[:obj_ln_sep] + dob=br.obj_sep + end + end + dob + end def odf_structure(md,dob) @md,@dob=md,dob dob=if dob.is !='code' @@ -431,6 +443,8 @@ module SiSU_ODF @@odf[:body] << code(dob).obj << @br*2 elsif dob.is=='table' #elsif dob.obj =~ /') - dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/, - ' ') dob.obj.gsub!(/©/,'©') #too arbitrary dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, @@ -517,7 +529,6 @@ module SiSU_ODF dob.obj.gsub!(/\\copy(?:right)?\b/,'©') dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') dob.obj.gsub!(/\44/,'$') #$ watch - dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/(.+?)<\/a>/,'\1') dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links wordlist=dob.obj.scan(/\S+/) @@ -528,7 +539,7 @@ module SiSU_ODF if defined? dob.ocn and dob.ocn =~/\d+/ @p_num=SiSU_ODF_format::Paragraph_number.new(dob.ocn) end - if dob.is=~/heading|para|group|verse|code|table/ # extend, include other types + if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types odf_structure(@md,dob) end dob.obj.gsub!(//,' ') if dob.obj ## Clean Prepared Text -- cgit v1.2.3