diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-07-26 20:16:49 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-07-26 20:16:49 -0400 |
commit | 2e6af20c3742adb42c756568fda2c05f7abd6d03 (patch) | |
tree | 5a0121ec974d40accd532473a5eb010db6ab0713 /lib | |
parent | v3: qrcode, manifest, (++), QR code (metadata) images for manifest (diff) |
v3: param, manifest, qrcode, epub, added creator.editor field
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v3/manifest.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 21 | ||||
-rw-r--r-- | lib/sisu/v3/qrcode.rb | 5 |
4 files changed, 54 insertions, 1 deletions
diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 9f169f5e..6879c933 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1057,6 +1057,28 @@ WOK %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end + editor=if defined? @md.creator.editor \ + and @md.creator.editor =~/\S+/ + m='' + @md.creator.editor_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!(/>/,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.editor.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} + else '' + end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @@ -1132,7 +1154,7 @@ WOK <<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> - #{author}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} + #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} <dc:identifier id="bookid">...</dc:identifier> <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> </metadata> diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index c6db7f25..f94534a4 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -490,6 +490,11 @@ WOK id,info=@translate.author,@md.creator.author metadata(id,info) end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end if defined? @md.creator.contributor \ and @md.creator.contributor=~/\S+/ id,info=@translate.contributor,@md.creator.contributor diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 2d2c22c0..c33bab75 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -300,6 +300,27 @@ module SiSU_Param names=name_format(s) names[:name_a_h] end + def editor + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil + s=if s + l,n=Db[:col_name],'creator.editor' + validate_length(s,l,n) + else nil + end + end + def editor_detail + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil + end def contributor names=@h['contributor'] \ ? name_format(@h['contributor']) \ diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index 0e9cad4a..b31bc7a5 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -485,6 +485,11 @@ WOK metadata(id,info) md_title_info(id,info) end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end if defined? @md.creator.contributor \ and @md.creator.contributor=~/\S+/ id,info=@translate.contributor,@md.creator.contributor |