Sha256: 321375bfdf998e0e47987bc13371af0593e933fe13f9e1e58de5f31b33ac777e

Contents?: true

Size: 969 Bytes

Versions: 41

Compression:

Stored size: 969 Bytes

Contents

module Slideshow
  module SourceHelper


def source( *args )

 # make everyting optional; use it like: 
 #   source( name_or_path, opts={} )

 # check for optional hash for options
 opts = args.last.kind_of?(Hash) ? args.pop : {}

 # check for optional name or path
 name_or_path = args.last.kind_of?(String) ? args.pop : "#{@name}#{@extname}" 

 link_text   = opts[:text] || '(Source)' 
 
 # add extra path (e.g. 3rd) if present
 name_or_path = "#{opts[:path]}/#{name_or_path}"   if opts[:path]
 
 # add file extension if missing (for convenience)
 name_or_path << @extname   if File.extname( name_or_path ).empty?

  base = 'http://github.com/geraldb/slideshow/raw/master/samples'

  buf = "<a href='#{base}/#{name_or_path}'>#{link_text}</a>"
  
  puts "  Adding HTML for source link to '#{name_or_path}'..."      
  
  guard_inline( buf )      
end
    
  
end # module SourceHelper
end # module Slideshow

class Slideshow::Gen
  include Slideshow::SourceHelper
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
slideshow-2.3.0 lib/slideshow/helpers/source_helper.rb
slideshow-2.2.0 lib/slideshow/helpers/source_helper.rb
slideshow-2.1.0 lib/slideshow/helpers/source_helper.rb
slideshow-2.0.1 lib/slideshow/helpers/source_helper.rb
slideshow-2.0.0 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.5 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.4 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.3 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.2 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.1 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0.beta5 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0.beta4 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0.beta3 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0.beta2 lib/slideshow/helpers/source_helper.rb
slideshow-1.2.0.beta1 lib/slideshow/helpers/source_helper.rb
slideshow-1.1.0 lib/slideshow/helpers/source_helper.rb
slideshow-1.1.0.beta8 lib/slideshow/helpers/source_helper.rb
slideshow-1.1.0.beta7 lib/slideshow/helpers/source_helper.rb
slideshow-1.1.0.beta6 lib/slideshow/helpers/source_helper.rb