aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-07-26 20:16:49 -0400
committerRalph Amissah <ralph@amissah.com>2011-07-26 20:16:49 -0400
commit2e6af20c3742adb42c756568fda2c05f7abd6d03 (patch)
tree5a0121ec974d40accd532473a5eb010db6ab0713
parentv3: qrcode, manifest, (++), QR code (metadata) images for manifest (diff)
v3: param, manifest, qrcode, epub, added creator.editor field
-rw-r--r--data/doc/sisu/CHANGELOG_v32
-rw-r--r--lib/sisu/v3/epub_format.rb24
-rw-r--r--lib/sisu/v3/manifest.rb5
-rw-r--r--lib/sisu/v3/param.rb21
-rw-r--r--lib/sisu/v3/qrcode.rb5
5 files changed, 56 insertions, 1 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 89c0bf6b..47270aaa 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -20,6 +20,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.14.orig.tar.gz
sisu_3.0.14-1.dsc
sisu_3.0.14-1.debian.tar.gz
+ * param, manifest, qrcode, epub, added creator.editor field
+
* qrcode, sysenv, manifest, generate & add QR code images of metadata to
manifest (using qrencode) (consider where and how else to use images)
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!(/</,'&lt;'); m.gsub!(/>/,'&gt;')
+ m.gsub!(/&lt;br(?: \/)?&gt;/,';')
+ end
+ x=@md.creator.editor.dup
+ x.gsub!(/</,'&lt;'); x.gsub!(/>/,'&gt;')
+ x.gsub!(/&lt;br(?: \/)?&gt;/,'<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