From d5b13ca5b8d041c13ef8fa8f8fe4764a9e24166b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 May 2014 21:32:33 -0400 Subject: v6: param, metadata rights, line-breaks instead of semicolons separating rights * (Closes: #744358) remove trailing semicolon after :copyright: --- lib/sisu/v6/param.rb | 25 +++++++++++-------------- lib/sisu/v6/shared_metadata.rb | 11 +++++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'lib') 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]}|\\\\)+/,'
') + 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 < #{Ax[:tab]}#{@tag.capitalize}: @@ -769,6 +777,7 @@ WOK def xml_dom def meta_para inf_xml=char_enc(@inf).utf8 + inf_xml=char_enc(inf_xml).br < #{Ax[:tab]*2}#{@tag.capitalize}: @@ -786,6 +795,7 @@ WOK def xhtml_scroll def meta_para inf_xml=char_enc(@inf).utf8 + inf_xml=char_enc(inf_xml).br < #{Ax[:tab]}#{@tag.capitalize}: @@ -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 %{

#{@tag}: #{inf_xml}

} -- cgit v1.2.3