slideshow 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
File without changes
data/Rakefile CHANGED
File without changes
@@ -2,4 +2,4 @@
2
2
  require 'rubygems'
3
3
  require 'slideshow'
4
4
 
5
- Slideshow.main
5
+ Slideshow.main
@@ -55,7 +55,7 @@ require 'slideshow/filters/slide_filter'
55
55
 
56
56
  module Slideshow
57
57
 
58
- VERSION = '0.9.9'
58
+ VERSION = '0.9.10'
59
59
 
60
60
  # version string for generator meta tag (includes ruby version)
61
61
  def Slideshow.generator
@@ -28,14 +28,11 @@ def leading_headers( content_with_headers )
28
28
  read_headers = false
29
29
  content << line
30
30
  end
31
- end
32
-
33
- # fix: do a merge w/ config instead, possible??
34
- opts.set_defaults
31
+ end
35
32
 
36
33
  puts " Reading #{headers.length} headers: #{headers.join(', ')}..."
37
34
 
38
- content
35
+ content
39
36
  end
40
37
 
41
38
  end # module HeadersFilter
@@ -43,4 +40,4 @@ end # module Slideshow
43
40
 
44
41
  class Slideshow::Gen
45
42
  include Slideshow::HeadersFilter
46
- end
43
+ end
File without changes
@@ -1,6 +1,33 @@
1
1
  module Slideshow
2
2
  module BackgroundHelper
3
3
 
4
+ def gradient_from_headers( *args )
5
+
6
+ return "" unless headers.has_gradient? # do nothing if use hasn't set gradient headers (ignore defaults)
7
+
8
+ # lets you use headers (gradient, gradient-theme, gradient-colors)
9
+ # to define gradient (see http://slideshow.rubyforge.org/themes.html for predefined themes)
10
+
11
+ theme = headers[ :gradient_theme ]
12
+ colors = headers[ :gradient_colors ].split( ' ' ) # colors as space separated all-in-one string
13
+
14
+ # fix: first version - ignore theme for now
15
+ # todo: add support for theme
16
+
17
+ buf = "linear-gradient( #{colors.join(',') } )"
18
+
19
+
20
+ # todo: add value for headers to puts
21
+ puts " Adding CSS for gradient background style rule using headers..."
22
+ content_for( :css, <<-EOS )
23
+ .slide { background-image: -webkit-#{buf};
24
+ background-image: -mozilla-#{buf};
25
+ background-image: -ms-#{buf};
26
+ background-image: -o-#{buf};
27
+ background-image: #{buf};
28
+ }
29
+ EOS
30
+ end
4
31
 
5
32
  def gradient( *args )
6
33
 
File without changes
File without changes
File without changes
@@ -20,24 +20,27 @@ class Opts
20
20
  end
21
21
  end
22
22
 
23
- def gradient=( value )
24
- put_gradient( value, :theme, :color1, :color2 )
25
- end
26
-
27
- def gradient_colors=( value )
28
- put_gradient( value, :color1, :color2 )
29
- end
30
-
31
- def gradient_color=( value )
32
- put_gradient( value, :color1 )
23
+ def gradient=( line )
24
+ # split into theme (first value) and colors (everything else)
25
+ # e.g. diagonal red black
26
+
27
+ # todo/check: translate value w/ v.tr( '-', '_' ) ??
28
+
29
+ values = line.split( ' ' )
30
+
31
+ put( 'gradient-theme', values.first ) if values.size > 0
32
+ put( 'gradient-colors', values[ 1..-1].join( ' ' ) ) if values.size > 1
33
33
  end
34
34
 
35
- def gradient_theme=( value )
36
- put_gradient( value, :theme )
35
+ def has_gradient?
36
+ # has user defined gradient (using headers)? (default values do NOT count)
37
+ @hash.has_key?( :gradient_theme ) || @hash.has_key?( :gradient_colors )
37
38
  end
38
39
 
40
+
41
+
39
42
  def []( key )
40
- value = @hash[ normalize_key( key ) ]
43
+ value = get( key )
41
44
  if value.nil?
42
45
  puts "** Warning: header '#{key}' undefined"
43
46
  "- #{key} not found -"
@@ -55,7 +58,7 @@ class Opts
55
58
  end
56
59
 
57
60
  def fetch?
58
- get( 'fetch_uri', nil ) != nil
61
+ @hash.has_key?( :fetch_uri )
59
62
  end
60
63
 
61
64
  def fetch_uri
@@ -63,7 +66,7 @@ class Opts
63
66
  end
64
67
 
65
68
  def has_includes?
66
- @hash[ :include ]
69
+ @hash.has_key?( :include )
67
70
  end
68
71
 
69
72
  def includes
@@ -76,7 +79,7 @@ class Opts
76
79
  end
77
80
 
78
81
  def config_path
79
- get( 'config_path', nil )
82
+ get( 'config_path' )
80
83
  end
81
84
 
82
85
  def output_path
@@ -84,11 +87,11 @@ class Opts
84
87
  end
85
88
 
86
89
  def code_engine
87
- get( 'code-engine', DEFAULTS[ :code_engine ] )
90
+ get( 'code-engine' )
88
91
  end
89
92
 
90
93
  def code_txmt
91
- get( 'code-txmt', DEFAULTS[ :code_txmt ])
94
+ get( 'code-txmt' )
92
95
  end
93
96
 
94
97
 
@@ -97,41 +100,32 @@ class Opts
97
100
  :title => 'Untitled Slide Show',
98
101
  :footer => '',
99
102
  :subfooter => '',
100
- :gradient_theme => 'dark',
101
- :gradient_color1 => 'red',
102
- :gradient_color2 => 'black',
103
+ :gradient_theme => 'diagonal',
104
+ :gradient_colors => 'red black',
103
105
 
104
106
  :code_engine => 'sh', # SyntaxHighligher (sh) | ultraviolet (uv) | coderay (cr)
105
107
  :code_txmt => 'false', # Text Mate Hyperlink for Source?
106
108
  }
107
109
 
108
- def set_defaults
109
- DEFAULTS.each_pair do | key, value |
110
- @hash[ key ] = value if @hash[ key ].nil?
110
+ def get( key, default=nil )
111
+ key = normalize_key(key)
112
+ value = @hash.fetch( key, DEFAULTS[ key ] )
113
+ if value.nil?
114
+ default
115
+ else
116
+ value
111
117
  end
112
118
  end
113
119
 
114
- def get( key, default )
115
- @hash.fetch( normalize_key(key), default )
116
- end
117
-
118
120
  private
119
121
 
120
122
  def normalize_key( key )
121
123
  key.to_s.downcase.tr('-', '_').to_sym
122
124
  end
123
-
124
- # Assigns the given gradient-* keys to the values in the given string.
125
- def put_gradient( string, *keys )
126
- values = string.split( ' ' )
127
-
128
- values.zip(keys).each do |v, k|
129
- @hash[ normalize_key( "gradient-#{k}" ) ] = v.tr( '-', '_' )
130
- end
131
- end
132
-
125
+
133
126
  def get_boolean( key, default )
134
- value = @hash[ normalize_key( key ) ]
127
+ key = normalize_key( key )
128
+ value = @hash.fetch( key, DEFAULTS[ key ] )
135
129
  if value.nil?
136
130
  default
137
131
  else
@@ -7,6 +7,11 @@
7
7
  <meta name="generator" content="<%= @headers['generator'] %>">
8
8
  <meta name="author" content="<%= @headers['author']%>" >
9
9
 
10
+ <!-- helper/macro that lets you add (CSS3) gradient using headers
11
+ see http://slideshow.rubyforge.org/themes.html
12
+
13
+ <%= gradient_from_headers() %> -->
14
+
10
15
  <!-- S6 style sheet links -->
11
16
  <link rel="stylesheet" href="<%= "#{@name}.css" %>" media="projection" id="styleProjection">
12
17
  <link rel="stylesheet" href="s6/screen.css" media="screen" id="styleScreen">
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 9
10
- version: 0.9.9
9
+ - 10
10
+ version: 0.9.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-06 00:00:00 +01:00
18
+ date: 2012-02-19 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency