aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/sisu/v2/epub.rb34
-rw-r--r--lib/sisu/v2/epub_format.rb17
-rw-r--r--lib/sisu/v2/epub_segments.rb5
-rw-r--r--lib/sisu/v2/html.rb15
4 files changed, 55 insertions, 16 deletions
diff --git a/lib/sisu/v2/epub.rb b/lib/sisu/v2/epub.rb
index 6df06025..e6ab1e12 100644
--- a/lib/sisu/v2/epub.rb
+++ b/lib/sisu/v2/epub.rb
@@ -499,7 +499,8 @@ module SiSU_EPUB
segtoc << format_head_toc.head #<< ads.div.major
toc_shared << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript
segtoc << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript
- if @md.rights.all
+ if defined? @md.rights.all \
+ and @md.rights.all
rights=format_head_toc.rights.all
rights=SiSU_EPUB_Tune::Clean_xhtml.new(rights).clean
end
@@ -517,7 +518,8 @@ module SiSU_EPUB
format_txt_obj=SiSU_EPUB_Format::Format_text_object.new(@md,txt_obj)
toc_shared << format_txt_obj.center_bold
segtoc << format_txt_obj.center_bold
- if @md.creator.author
+ if defined? @md.creator.author \
+ and @md.creator.author
creator_endnote=@md.creator.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
tmp_head=creator_endnote + "\n"
txt_obj={:txt =>tmp_head}
@@ -529,21 +531,34 @@ module SiSU_EPUB
segtoc << format_head_toc.copyat
segtoc << seg_toc_band
tmp_head=nil
- if @md.prefix_a
+ if defined? @md.prefix_a \
+ and @md.prefix_a
tmp_head ||= %{#{@md.prefix_a}\n}
toc_shared << tmp_head.dup
segtoc << tmp_head.dup
end
tmp_head=nil
toc_shared << @links_guide_toc
- toc_shared << rights if @md.rights.all
- toc_shared << prefix_b if @md.prefix_b
+ if defined? @md.rights.all \
+ and @md.rights.all
+ toc_shared << rights
+ end
+ if defined? @md.prefix_b \
+ and @md.prefix_b
+ toc_shared << prefix_b
+ end
#Table of Contents added/appended here
toc_shared << @toc[:scr]
segtoc << @links_guide_toc
segtoc << @toc[:seg]
- segtoc << rights if @md.rights.all
- segtoc << prefix_b if @md.prefix_b
+ if defined? @md.rights.all \
+ and @md.rights.all
+ segtoc << rights
+ end
+ if defined? @md.prefix_b \
+ and @md.prefix_b
+ segtoc << prefix_b
+ end
#Segtoc tail added here
segtoc << seg_toc_band_bottom
segtoc << format_head_toc.xhtml_close
@@ -618,7 +633,10 @@ module SiSU_EPUB
def images
img_pth=@md.env.path.image_source_local_tex
@md.ec[:image].each do |x|
- cp("#{img_pth}/#{x}","#{@md.env.path.epub}/OPS/image") if FileTest.directory?("#{@md.env.path.epub}/OPS/image")
+ if FileTest.directory?("#{@md.env.path.epub}/OPS/image") \
+ and FileTest.file?("#{img_pth}/#{x}")
+ cp("#{img_pth}/#{x}","#{@md.env.path.epub}/OPS/image")
+ end
end
end
def concordance
diff --git a/lib/sisu/v2/epub_format.rb b/lib/sisu/v2/epub_format.rb
index 5599a435..498912a3 100644
--- a/lib/sisu/v2/epub_format.rb
+++ b/lib/sisu/v2/epub_format.rb
@@ -1024,17 +1024,28 @@ WOK
WOK
end
def metadata #metadata dc
- illustrator=if defined? @md.creator.illustrator and @md.creator.illustrator =~/\S+/
+ author=if defined? @md.creator.author \
+ and @md.creator.author =~/\S+/
+ %{\n <dc:creator opf:file-as="#{@md.creator.author}" opf:role="aut">#{@md.creator.author}</dc:creator>}
+ else ''
+ end
+ illustrator=if defined? @md.creator.illustrator \
+ and @md.creator.illustrator =~/\S+/
%{\n <dc:creator opf:file-as="#{@md.creator.illustrator}" opf:role="ill">#{@md.creator.illustrator}</dc:creator>}
else ''
end
+ rights=if defined? @md.rights.all \
+ and @md.rights.all =~/\S+/
+ %{\n <dc:rights>#{@md.rights.all}</dc:rights>}
+ else ''
+ end
<<WOK
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:title>#{@md.title.full}</dc:title>
- <dc:creator opf:file-as="#{@md.creator.author}" opf:role="aut">#{@md.creator.author}</dc:creator>#{illustrator}
+ #{author}#{illustrator}
<dc:language>en-US</dc:language>
<dc:identifier id="bookid">...</dc:identifier>
- <dc:rights>#{@md.rights.all}</dc:rights>
+ #{rights}
<dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier>
</metadata>
WOK
diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb
index 3f402c92..6436612c 100644
--- a/lib/sisu/v2/epub_segments.rb
+++ b/lib/sisu/v2/epub_segments.rb
@@ -300,7 +300,10 @@ WOK
end
@p_num ||= ''
if @@is1==1
- @author=%{<b>#{@md.creator.author}</b>\n} if @md.creator.author.to_s =~/\S/
+ if defined? @md.creator.author \
+ and @md.creator.author
+ @author=%{<b>#{@md.creator.author}</b>\n}
+ end
@@seg[:nav] << format_head_seg.navigation_band(@@segtocband)
ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
else ''
diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v2/html.rb
index 4959d683..834eefa1 100644
--- a/lib/sisu/v2/html.rb
+++ b/lib/sisu/v2/html.rb
@@ -533,7 +533,7 @@ WOK
format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj)
toc_shared << format_txt_obj.center_bold
@segtoc << format_txt_obj.center_bold
- if @md.creator.author
+ if defined? @md.creator.author
creator_endnote=@md.creator.author.gsub(/(\*+)/,%{&nbsp;<sup><a href="#notes">\\1</a></sup>})
tmp_head=creator_endnote + "\n"
txt_obj={:txt =>tmp_head}
@@ -553,13 +553,20 @@ WOK
end
tmp_head=nil
toc_shared << @links_guide_toc
- toc_shared << rights if @md.rights.all
- toc_shared << prefix_b if @md.prefix_b
+ if defined? @md.rights.all #and ? @md.rights.all
+ toc_shared << rights
+ end
+ if defined? @md.prefix_b
+ toc_shared << prefix_b
+ end
#Table of Contents added/appended here
toc_shared << @toc[:scr]
@segtoc << @links_guide_toc
@segtoc << @toc[:seg]
- @segtoc << rights if @md.rights.all
+ if defined? @md.rights.all \
+ and not @md.rights.all.empty?
+ @segtoc << rights
+ end
@segtoc << prefix_b if @md.prefix_b
#Segtoc tail added here
@segtoc << "</p>\n" #bugfix sort later DEBUGNOW