aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-12 21:32:33 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-12 21:32:33 -0400
commitd5b13ca5b8d041c13ef8fa8f8fe4764a9e24166b (patch)
tree6d7ce2f6d37c7914c3bca82dfa8314a235d1a1eb /lib/sisu
parentv5 v6: param, metadata add 'Copyright:' tag to output related to copyright (diff)
v6: param, metadata rights, line-breaks instead of semicolons separating rights
* (Closes: #744358) remove trailing semicolon after :copyright:
Diffstat (limited to 'lib/sisu')
-rw-r--r--lib/sisu/v6/param.rb25
-rw-r--r--lib/sisu/v6/shared_metadata.rb11
2 files changed, 22 insertions, 14 deletions
diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb
index 7cbb6ba7..60c9bb54 100644
--- a/lib/sisu/v6/param.rb
+++ b/lib/sisu/v6/param.rb
@@ -500,12 +500,9 @@ module SiSU_Param
@h=build_hash(a)
def copyright
def text #you may wish to expand to take from all
- s=if @h['copyright']
- @h['copyright']
- elsif @h['text']
- @h['text']
- elsif @h['main']
- @h['main']
+ s=if @h['copyright'] then @h['copyright']
+ elsif @h['text'] then @h['text']
+ elsif @h['main'] then @h['main']
else
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on
''
@@ -558,7 +555,7 @@ module SiSU_Param
validate_length(s,l,n)
end
def sep(str)
- (str =~/https?:\/\/\S+$/) ? ' ;' : ';'
+ ' \\\\ '
end
def all
s=if @h['all'] then @h['all']
@@ -574,36 +571,36 @@ module SiSU_Param
and copyright.translation \
and not copyright.translation.empty?
v=sep(copyright.translation)
- s +='\\\\ translation ' + copyright.translation + v
+ s +='translation: ' + copyright.translation + v
end
if defined? copyright.illustrations \
and copyright.illustrations \
and not copyright.illustrations.empty?
v=sep(copyright.illustrations)
- s +='\\\\ illustrations ' + copyright.illustrations + v
+ s +='illustrations: ' + copyright.illustrations + v
end
if defined? copyright.photographs \
and copyright.photographs \
and not copyright.photographs.empty?
v=sep(copyright.photographs)
- s +='\\\\ photographs ' + copyright.photographs + v
+ s +='photographs: ' + copyright.photographs + v
end
if defined? copyright.digitization \
and copyright.digitization \
and not copyright.digitization.empty?
v=sep(copyright.digitization)
- s +='\\\\ digitization ' + copyright.digitization + v
+ s +='digitization: ' + copyright.digitization + v
end
if defined? copyright.audio \
and copyright.audio \
and not copyright.audio.empty?
v=sep(copyright.audio)
- s +='\\\\ audio ' + copyright.audio + v
+ s +='audio: ' + copyright.audio + v
end
if defined? copyright.license \
and copyright.license \
and not copyright.license.empty?
- s +='\\\\ License: ' + copyright.license
+ s +='License: ' + copyright.license
end
if s.empty?
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on
@@ -611,7 +608,7 @@ module SiSU_Param
l,n=Db[:col_info_note],'rights.all'
validate_length(s,l,n)
end
- s
+ s=s.gsub(/ [\\]+\s+$/,'')
end
s
end
diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb
index c2fe06b9..1fa57fa7 100644
--- a/lib/sisu/v6/shared_metadata.rb
+++ b/lib/sisu/v6/shared_metadata.rb
@@ -735,6 +735,13 @@ module SiSU_Metadata
end
@s
end
+ def br
+ if @s \
+ and @s.is_a?(String)
+ @s=@s.gsub(/(?:#{Mx[:br_line]}|\\\\)+/,'<br />')
+ end
+ @s
+ end
def utf8
if @s \
and @s.is_a?(String)
@@ -752,6 +759,7 @@ module SiSU_Metadata
def xml_sax
def meta_para
inf_xml=char_enc(@inf).utf8
+ inf_xml=char_enc(inf_xml).br
<<WOK
<metadata>
#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
@@ -769,6 +777,7 @@ WOK
def xml_dom
def meta_para
inf_xml=char_enc(@inf).utf8
+ inf_xml=char_enc(inf_xml).br
<<WOK
#{Ax[:tab]}<header>
#{Ax[:tab]*2}<meta>#{@tag.capitalize}:</meta>
@@ -786,6 +795,7 @@ WOK
def xhtml_scroll
def meta_para
inf_xml=char_enc(@inf).utf8
+ inf_xml=char_enc(inf_xml).br
<<WOK
#{Ax[:tab]}<metadata>
#{Ax[:tab]}<meta>#{@tag.capitalize}:</meta>
@@ -805,6 +815,7 @@ WOK
def meta_para
inf_xml=char_enc(@inf).amp
inf_xml=char_enc(inf_xml).utf8
+ inf_xml=char_enc(inf_xml).br
%{<p class="norm">
<b>#{@tag}</b>: #{inf_xml}
</p>}