From 90f6210fe416897a7959a65d82b9de1cfa3bc572 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 29 Aug 2014 19:38:50 -0400 Subject: v5 v6: dp, texpdf, copyright_and_license, minor fix, used by texpdf --- lib/sisu/v5/dp.rb | 18 +++++++++++++++++- lib/sisu/v5/texpdf.rb | 5 ++--- lib/sisu/v6/dp.rb | 18 +++++++++++++++++- lib/sisu/v6/texpdf.rb | 5 ++--- 4 files changed, 38 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/dp.rb b/lib/sisu/v5/dp.rb index 33c6c565..00cf8525 100644 --- a/lib/sisu/v5/dp.rb +++ b/lib/sisu/v5/dp.rb @@ -158,9 +158,25 @@ module SiSU_Param class MdDefault def rights(author,date) @author,@date=author,date + def assignment(author) + 'copyright not explicitly stated, ' \ + + 'program "assigning" copyright to author: ' \ + + author + end def all s=nil if @author + #puts assignment(@author) + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d + end + s + end + def copyright_and_license + s=nil + if @author + #puts assignment(@author) s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d @@ -584,7 +600,7 @@ module SiSU_Param ' \\\\ ' end def copyright_and_license - s=if @h['all'] then @h['all'] + s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index c2c9dc70..e35c7ccf 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -448,10 +448,9 @@ module SiSU_TeX end if defined? @md.rights.all \ and not @md.rights.all.empty? - rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed - sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license) + sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.rights.copyright.copyright_and_license.dup) copymark='Copyright {\begin{small}{\copyright\end{small}} ' - #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' + #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark) @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}" end diff --git a/lib/sisu/v6/dp.rb b/lib/sisu/v6/dp.rb index 111896d7..595cee3e 100644 --- a/lib/sisu/v6/dp.rb +++ b/lib/sisu/v6/dp.rb @@ -158,9 +158,25 @@ module SiSU_Param class MdDefault def rights(author,date) @author,@date=author,date + def assignment(author) + 'copyright not explicitly stated, ' \ + + 'program "assigning" copyright to author: ' \ + + author + end def all s=nil if @author + #puts assignment(@author) + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d + end + s + end + def copyright_and_license + s=nil + if @author + #puts assignment(@author) s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d @@ -584,7 +600,7 @@ module SiSU_Param ' \\\\ ' end def copyright_and_license - s=if @h['all'] then @h['all'] + s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb index 10bfa961..57eab29d 100644 --- a/lib/sisu/v6/texpdf.rb +++ b/lib/sisu/v6/texpdf.rb @@ -448,10 +448,9 @@ module SiSU_TeX end if defined? @md.rights.all \ and not @md.rights.all.empty? - rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed - sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license) + sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.rights.copyright.copyright_and_license.dup) copymark='Copyright {\begin{small}{\copyright\end{small}} ' - #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' + #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark) @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}" end -- cgit v1.2.3