From a44bbf20b1f06c938ae0579a7771005995273c0c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Jul 2011 20:12:52 -0400 Subject: v3: epub, opf fixes --- lib/sisu/v3/epub_format.rb | 90 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v3/epub_format.rb') diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index e75ad112..9f169f5e 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1037,16 +1037,90 @@ WOK def metadata #metadata dc author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ - x=@md.creator.author.gsub!(//,'>') - @md.creator.author.gsub!(/<br(?: \/)?>/,'
') - %{\n #{x}} + m='' + @md.creator.author_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.author.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + translator=if defined? @md.creator.translator \ + and @md.creator.translator =~/\S+/ + m='' + @md.creator.translator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.translator.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ - x=@md.creator.illustrator.gsub!(//,'>') - @md.creator.illustrator.gsub!(/<br(?: \/)?>/,'
') - %{\n #{x}} + m='' + @md.creator.illustrator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(//,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.illustrator.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + date_published=if defined? @md.date.published \ + and @md.date.published =~/\S+/ + x=@md.date.published.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + subject=if defined? @md.classify.subject \ + and @md.classify.subject =~/\S+/ + x=@md.classify.subject.dup + x.gsub!(//,'>') + x.gsub!(/<br(?: \/)?>/,'
') + %{\n #{x}} + else '' + end + language=if defined? @md.opt.lng \ + and @md.opt.lng =~/\S+/ + language=@md.opt.lng.gsub(/
/,'
') + %{\n #{language}} else '' end rights=if defined? @md.rights.all \ @@ -1058,10 +1132,8 @@ WOK < #{@md.title.full} - #{author}#{illustrator} - en-US + #{author}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} ... - #{rights} urn:uuid:#{@md.dgst[1]} WOK -- cgit v1.2.3