aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/odf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/odf.rb')
-rw-r--r--lib/sisu/v5/odf.rb31
1 files changed, 5 insertions, 26 deletions
diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb
index 671cc350..281bd7a4 100644
--- a/lib/sisu/v5/odf.rb
+++ b/lib/sisu/v5/odf.rb
@@ -164,22 +164,13 @@ module SiSU_ODF
@@odf[:metadata]=SiSU_Metadata::Summary.new(@md).odf.metadata
end
def odf_tail
- generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version]
- lastdone="Last Generated on: #{Time.now}"
- rubyv="Ruby version: #{@md.ruby_version}"
- sc=if @md.sc_info
- "Source file: #{@md.sc_filename}\nVersion number: #{@md.sc_number}\nVersion date: #{@md.sc_date}\n"
- else ''
- end
- url=@md.fnb
- fn=@md.file.base_filename.manifest
manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}"
@@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> &lt;<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>&gt;</text:p>}
@@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
@@odf[:tail] << "\n</office:text></office:body></office:document-content>"
end
def set_bookmark_tag(dob)
- tags=SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
+ SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
end
def heading(dob,p_num)
m=/#{$1}/
@@ -205,7 +196,6 @@ module SiSU_ODF
dob
end
def toc(dob,p_num)
- m=/#{$1}/
hardspace=(dob.lv =~/[A-C]/i) \
? '<text:p text:style-name="Standard"/>'
: ''
@@ -216,7 +206,7 @@ module SiSU_ODF
dob
end
def image_src(i)
- image_source=if @md.fns =~/\.ss[tm]$/ \
+ if @md.fns =~/\.ss[tm]$/ \
and FileTest.file?("#{@env.path.image_source_include}/#{i}") #review
@env.path.image_source_include
elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/
@@ -245,7 +235,7 @@ module SiSU_ODF
def image_odf(img)
# copy image to od image directory (unless exists)
# divide pixel dimension by 37.79485 and retain 3 decimal places
- m,u=img[1],img[2]
+ m=img[1]
i=/^(\S+?\.(?:png|jpg|gif))/.match(m).captures.join if m =~/^(\S+?\.(?:png|jpg|gif))/
c=/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/.match(m).captures.join if m =~/^\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"/
w,h=/\s(\d+)x(\d+)/.match(m).captures if m =~/\s\d+x\d+/
@@ -254,7 +244,6 @@ module SiSU_ODF
h=/([0-9]+\.\d{0,3})/.match(h).captures.join
w=/([0-9]+\.\d{0,3})/.match(w).captures.join
image_source=image_src(i)
- pwd=Dir.pwd
if image_source
if FileTest.file?("#{image_source}/#{i}")
FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}")
@@ -315,7 +304,7 @@ module SiSU_ODF
t
end
def text_link_odf_bookmark(txt,url,trail)
- map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
+ SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
%{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{txt.strip}</text:bookmark-ref>#{trail}}
end
def text_link(dob)
@@ -582,7 +571,7 @@ module SiSU_ODF
wordlist
end
def markup(data) # Used for major markup instructions
- safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
+ #safe_characters=/[^a-zA-Z0-9}{\/?,."';:)(><\-_&!@%~#\]\[*=$| \n+`#{Mx[:tc_p]}]/u
dir=SiSU_Env::InfoEnv.new(@md.fns)
dir.path.odt_bld
@data_mod,@endnotes,@level,@cont,@copen,@odf_contents_close=Array.new(6){[]}
@@ -590,7 +579,6 @@ module SiSU_ODF
(0..6).each { |x| @cont[x]=@level[x]=false }
(4..6).each { |x| @odf_contents_close[x]='' }
odf_tail #($1,$2)
- fix=[]
bullet=image_src('bullet_09.png')
if bullet
if FileTest.file?("#{bullet}/bullet_09.png")
@@ -726,13 +714,6 @@ WOK
x
else ''
end
- breakpage=if @md.pagenew \
- or @md.pagebreak
- ' fo:break-before="page"'
- elsif @md.pageline ##fix
- ''
- else ''
- end
x=<<WOK
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/>
@@ -753,10 +734,8 @@ WOK
def post
end
def publish
- divider='='
content=[]
br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>'
- data=@data
content <<
@@odf[:head] <<
@@odf[:toc] <<