From c041ea2efdc0f1c6d2ecb07f9f29ba3ddf37a39f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 3 Oct 2012 00:24:05 -0400 Subject: v4: param (header make), pdf, footer --- data/doc/sisu/CHANGELOG_v4 | 1 + lib/sisu/v4/param.rb | 26 ++++++++++++++++++++++++++ lib/sisu/v4/texpdf_format.rb | 13 +++---------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 27a4aa17..a9174dce 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -53,3 +53,4 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.0.orig.tar.xz * html, home button * text button * image/icon button + * pdf, footer diff --git a/lib/sisu/v4/param.rb b/lib/sisu/v4/param.rb index 740a7598..f9607df2 100644 --- a/lib/sisu/v4/param.rb +++ b/lib/sisu/v4/param.rb @@ -1071,6 +1071,12 @@ module SiSU_Param else nil end end + def footer + s=if @h['footer'] + @h['footer'].split(/\s*;\s*/) + else nil + end + end self end def current_publisher @@ -1162,6 +1168,7 @@ module SiSU_Param else ".#{@opt.lng}" end + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } @rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg @@ -1361,6 +1368,25 @@ module SiSU_Param ? @make.manpage.section : 1 end + if defined? @make.footer \ + and @make.footer.is_a?(Array) + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } #already set + @footer_links[:left]=if @make.footer[0]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[0])[1,2] + { say: say, url: url } + else + { say: '', url: '' } + end + @footer_links[:center]=if @make.footer[1]=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + say,url=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(@make.footer[1])[1,2] + { say: say, url: url } + else + { say: '', url: '' } + end + @footer_links + else #already set + @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } + end if defined? @make.home_button_text \ and @make.home_button_text.is_a?(Array) a_idx=0 diff --git a/lib/sisu/v4/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb index 3c2d9231..223633de 100644 --- a/lib/sisu/v4/texpdf_format.rb +++ b/lib/sisu/v4/texpdf_format.rb @@ -1422,16 +1422,9 @@ WOK "\\rhead[ ]{ }\n" end def footer - base_prog_txt=if @md.base_program - case @md.base_program - when /kdissert/i; " \\\\ \\href{http://freehackers.org/~tnagy/kdissert/}{Kdissert}" - else '' - end - else '' - end - "\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@vz.url_footer_signature}}{#{@vz.txt_signature}}#{base_prog_txt}}\n" + - "\\cfoot[\\href{#{@vz.url_home}}{#{@vz.url_txt}}]{\\href{#{@vz.url_home}}{#{@vz.url_txt}}}\n" + - "\\rfoot[\\tiny \\href{#{@vz.url_sisu}}{#{@vz.txt_signature}}]{\\textrm{\\thepage}}\n" + f="\\lfoot[\\textrm{\\thepage}]{\\tiny \\href{#{@md.footer_links[:left][:url]}}{#{@md.footer_links[:left][:say]}}}\n" + + "\\cfoot{\\href{#{@md.footer_links[:center][:url]}}{#{@md.footer_links[:center][:say]}}}\n" + + "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end def site if not @vz.url_home.empty? \ -- cgit v1.2.3