diff options
Diffstat (limited to 'lib/sisu/v4/param.rb')
-rw-r--r-- | lib/sisu/v4/param.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/sisu/v4/param.rb b/lib/sisu/v4/param.rb index b75a8808..740a7598 100644 --- a/lib/sisu/v4/param.rb +++ b/lib/sisu/v4/param.rb @@ -927,6 +927,11 @@ module SiSU_Param ? :off : :na end + def home_button_image? + (omit.list.inspect =~/"home_button_image"/) \ + ? :off + : :na + end def texpdf_font def main @h['texpdf_font'] \ @@ -1008,6 +1013,36 @@ module SiSU_Param end {w: w, h: h} end + def home_button_text + s=if @h['home_button_text'] + @h['home_button_text'].split(/\s*;\s*/) + else nil + end + #l,n=Db[:home_button],'make.home_button_text' + #validate_length(s,l,n) + end + def home_button_image + s=nil + s=if @h['home_button_image'] + s=@h['home_button_image'].split(/\s*;\s*/) + s0=s[0] #if + image={} + s=if s0 =~/{(\S+\.(?:jpg|png|gif))(?:\s+(\d+x\d+))?\s*}(?:(http:\/\/\S+)|image)/ + image[:home_button]=$1 + if $2 + image[:dimentions]=$2 + image[:w],image[:h]=/(\d+)x(\d+)/m.match(image[:dimentions])[1,2] + else + d=get_image_dimentions(image[:home_button]) + image[:w],image[:h]=d[:w],d[:h] + image[:dimentions]="#{d[:w]}x#{d[:h]}" + end + image[:link]=$3 + image + end + else nil + end + end def cover_image s=nil if @h['cover_image'] @@ -1326,6 +1361,27 @@ module SiSU_Param ? @make.manpage.section : 1 end + if defined? @make.home_button_text \ + and @make.home_button_text.is_a?(Array) + a_idx=0 + @home_button_links=[] + @make.home_button_text.each do |doc_link| + if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + @home_button_links[a_idx]={} + @home_button_links[a_idx][:say],@home_button_links[a_idx][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + a_idx +=1 + end + end + @home_button_links + end + if defined? @make.home_button_image \ + and @make.home_button_image.is_a?(Hash) + @home_button_image=@make.home_button_image + end + if defined? @make.cover_image \ + and @make.cover_image.is_a?(Hash) + @cover_image=@make.cover_image + end end @lv1 ||=/^1~/ @lv2 ||=/^2~/ @@ -1457,6 +1513,12 @@ module SiSU_Param or @cover_image[:cover] =~/\S+?.(?:jpg|png|gif)/) @ec[:image] << @cover_image[:cover] end + if @home_button_image \ + and @home_button_image.is_a?(Hash) \ + and (@home_button_image =~@rgx_image \ + or @home_button_image =~/\S+?\.(?:jpg|png|gif)/) + @ec[:image] << @home_button_image + end if @ec[:image].length > 0 @ec[:image]=@ec[:image].flatten.uniq @ec[:image].delete_if {|x| x =~/https?:\/\// } |