aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v2/odf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-12-16 23:19:35 -0500
committerRalph Amissah <ralph@amissah.com>2010-12-16 23:46:13 -0500
commitff4ceb260ae3931072810a0ada124841d3b8e032 (patch)
treea736b8a7c4d7ce046d23f3cc834619e374f9bf68 /lib/sisu/v2/odf.rb
parentdal_syntax, sisu syntax modification (insist on curly braces) (diff)
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)
Diffstat (limited to 'lib/sisu/v2/odf.rb')
-rw-r--r--lib/sisu/v2/odf.rb19
1 files changed, 15 insertions, 4 deletions
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 =~ /<!Th?¡/u
@@odf[:body] << table(dob).obj << @br*2
+ elsif dob.is=='break'
+ @@odf[:body] << obj_break(dob).obj << @br*2
else
@@odf[:body] << normal(dob).obj << @br*2 # main text, contents, body KEEP
end
@@ -492,8 +506,6 @@ module SiSU_ODF
dob.obj
end
dob.obj.gsub!(/#{Mx[:br_line]}/,'<br />')
- dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,
- '<text:p text:style-name="P8"> </text:p>')
dob.obj.gsub!(/&#169;/,'©') #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/,'&#169;')
dob.obj.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
dob.obj.gsub!(/\44/,'&#36;') #$ watch
- dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'') # remove page breaks
dob.obj.gsub!(/<a href=".+?">(.+?)<\/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