slideshow 1.1.0.beta5 → 1.1.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -13,6 +13,7 @@ lib/slideshow/filters/headers_filter.rb
13
13
  lib/slideshow/filters/slide_filter.rb
14
14
  lib/slideshow/filters/text_filter.rb
15
15
  lib/slideshow/gen.rb
16
+ lib/slideshow/headers.rb
16
17
  lib/slideshow/helpers/analytics_helper.rb
17
18
  lib/slideshow/helpers/background_helper.rb
18
19
  lib/slideshow/helpers/capture_helper.rb
@@ -31,6 +32,7 @@ lib/slideshow/markup/rest.rb
31
32
  lib/slideshow/markup/textile.rb
32
33
  lib/slideshow/opts.rb
33
34
  lib/slideshow/slide.rb
35
+ lib/slideshow/version.rb
34
36
  templates/s6.txt
35
37
  templates/s6.txt.gen
36
38
  templates/s6/jquery.js
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'hoe'
2
- require './lib/slideshow.rb'
2
+ require './lib/slideshow/version.rb'
3
3
 
4
4
  Hoe.spec 'slideshow' do
5
5
 
@@ -8,6 +8,7 @@ Hoe.spec 'slideshow' do
8
8
  self.summary = 'Slide Show (S9) - A Free Web Alternative to PowerPoint and KeyNote in Ruby'
9
9
  self.urls = ['http://slideshow.rubyforge.org']
10
10
 
11
+
11
12
  self.author = 'Gerald Bauer'
12
13
  self.email = 'webslideshow@googlegroups.com'
13
14
 
data/config/slideshow.yml CHANGED
@@ -25,14 +25,13 @@ headers:
25
25
  # gradient:
26
26
  # theme: dark
27
27
  # color1:
28
- gradient-theme: dark
29
- gradient-color1: red
30
- gradient-color2: black
28
+ gradient-theme: diagonal
29
+ gradient-colors: red orange
31
30
 
32
31
  # todo: use nested config??
33
32
  #
34
- # ultraviolet (uv) | coderay (cr)
35
- code-engine: uv
33
+ # SyntaxHighligher (sh) | ultraviolet (uv) | coderay (cr)
34
+ code-engine: sh
36
35
  # Text Mate Hyperlink for Source?
37
36
  code-txmt: false
38
37
  # todo: add code-linenumbers??
data/lib/slideshow.rb CHANGED
@@ -38,7 +38,9 @@ require 'textutils' # text filters and helpers
38
38
 
39
39
 
40
40
  # our own code
41
+ require 'slideshow/version'
41
42
  require 'slideshow/opts'
43
+ require 'slideshow/headers'
42
44
  require 'slideshow/config'
43
45
  require 'slideshow/gen'
44
46
  require 'slideshow/manifest'
@@ -70,8 +72,6 @@ require 'slideshow/filters/slide_filter'
70
72
 
71
73
  module Slideshow
72
74
 
73
- VERSION = '1.1.0.beta5'
74
-
75
75
  def self.root
76
76
  "#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
77
77
  end
@@ -36,8 +36,7 @@ class Config
36
36
  @props = @props_work = Props.load_file_with_erb( props_work_file, binding(), @props )
37
37
  end
38
38
  end
39
-
40
-
39
+
41
40
  def header( key )
42
41
  @props.fetch_from_section( 'headers', normalize_key( key ), nil )
43
42
  end
@@ -4,7 +4,8 @@ module Slideshow
4
4
 
5
5
  def leading_headers( content_with_headers )
6
6
 
7
- # todo: read headers before command line options (lets you override options using commandline switch)?
7
+ # todo: lets user override headers with command line options
8
+ # that is, lets you override options using commandline switch
8
9
 
9
10
  # read source document; split off optional header from source
10
11
  # strip leading optional headers (key/value pairs) including optional empty lines
@@ -12,17 +13,17 @@ def leading_headers( content_with_headers )
12
13
  read_headers = true
13
14
  content = ""
14
15
 
15
- headers = [] # track header keys for stats
16
+ keys = [] # track header keys for stats
16
17
 
17
18
  content_with_headers.each_line do |line|
18
19
  if read_headers && line =~ /^\s*(\w[\w-]*)[ \t]*:[ \t]*(.*)/
19
20
  key = $1.downcase
20
21
  value = $2.strip
21
22
 
22
- headers << key
23
+ keys << key
23
24
 
24
- logger.debug " adding option: key=>#{key}< value=>#{value}<"
25
- opts.put( key, value )
25
+ logger.debug " adding header: key=>#{key}< value=>#{value}<"
26
+ headers.put( key, value )
26
27
  elsif line =~ /^\s*$/
27
28
  content << line unless read_headers
28
29
  else
@@ -31,7 +32,7 @@ def leading_headers( content_with_headers )
31
32
  end
32
33
  end
33
34
 
34
- puts " Reading #{headers.length} headers: #{headers.join(', ')}..."
35
+ puts " Reading #{keys.length} headers: #{keys.join(', ')}..."
35
36
 
36
37
  content
37
38
  end
data/lib/slideshow/gen.rb CHANGED
@@ -63,17 +63,20 @@ class Gen
63
63
  end
64
64
 
65
65
  # todo/fix: move to Config class
66
+ # - used in syntax/uv_helper (use config.cache_dir to access?)
67
+
66
68
  def cache_dir
67
69
  File.join( Env.home, '.slideshow' )
68
70
  end
69
71
 
72
+
70
73
  def config_dir
71
74
  unless @config_dir # first time? calculate config_dir value to "cache"
72
75
 
73
76
  if opts.config_path
74
77
  @config_dir = opts.config_path
75
78
  else
76
- @config_dir = cache_dir
79
+ @config_dir = config.cache_dir
77
80
  end
78
81
 
79
82
  # make sure path exists
@@ -0,0 +1,87 @@
1
+ module Slideshow
2
+
3
+ class Headers
4
+
5
+ def initialize( config )
6
+ @hash = {}
7
+ @config = config
8
+ end
9
+
10
+ ## todo: rename put to store like std hash method
11
+ def put( key, value )
12
+ key = normalize_key( key )
13
+ setter = "#{key}=".to_sym
14
+
15
+ if respond_to?( setter )
16
+ send( setter, value )
17
+ else
18
+ @hash[ key ] = value
19
+ end
20
+ end
21
+
22
+ def gradient=( line )
23
+ # split into theme (first value) and colors (everything else)
24
+ # e.g. diagonal red black
25
+
26
+ # todo/check: translate value w/ v.tr( '-', '_' ) ??
27
+
28
+ values = line.split( ' ' )
29
+
30
+ put( 'gradient-theme', values.first ) if values.size > 0
31
+ put( 'gradient-colors', values[ 1..-1].join( ' ' ) ) if values.size > 1
32
+ end
33
+
34
+ def has_gradient?
35
+ # has user defined gradient (using headers)? (default values do NOT count)
36
+ @hash.has_key?( :gradient_theme ) || @hash.has_key?( :gradient_colors )
37
+ end
38
+
39
+ def []( key )
40
+ value = get( key )
41
+
42
+ if value.nil?
43
+ puts "** Warning: header '#{key}' undefined"
44
+ value = "- #{key} not found -"
45
+ end
46
+ value
47
+ end
48
+
49
+ def code_engine
50
+ get( 'code-engine' )
51
+ end
52
+
53
+ def code_txmt
54
+ get( 'code-txmt' )
55
+ end
56
+
57
+
58
+ ## todo: rename get to fetch??
59
+ def get( key, default=nil )
60
+ key = normalize_key(key)
61
+ value = @hash.fetch( key, nil )
62
+ value = @config.header( key ) if value.nil? # try lookup in config properties next
63
+ if value.nil?
64
+ default
65
+ else
66
+ value
67
+ end
68
+ end
69
+
70
+ def get_boolean( key, default )
71
+ value = get( key, default )
72
+ if value.nil?
73
+ default
74
+ else
75
+ (value == true || value =~ /t|true|yes|on/i) ? true : false
76
+ end
77
+ end
78
+
79
+ private
80
+
81
+ def normalize_key( key )
82
+ key.to_s.downcase.tr('-', '_').to_sym
83
+ end
84
+
85
+ end # class Headers
86
+
87
+ end # module Slideshow
@@ -1,107 +1,8 @@
1
1
  module Slideshow
2
2
 
3
- # todo: split (command line) options and headers?
4
- # e.g. share (command line) options between slide shows (but not headers?)
5
-
6
- class Headers
7
-
8
- def initialize( config )
9
- @hash = {}
10
- @config = config
11
- end
12
-
13
- def put( key, value )
14
- key = normalize_key( key )
15
- setter = "#{key}=".to_sym
16
-
17
- if respond_to? setter
18
- send setter, value
19
- else
20
- @hash[ key ] = value
21
- end
22
- end
23
-
24
- def gradient=( line )
25
- # split into theme (first value) and colors (everything else)
26
- # e.g. diagonal red black
27
-
28
- # todo/check: translate value w/ v.tr( '-', '_' ) ??
29
-
30
- values = line.split( ' ' )
31
-
32
- put( 'gradient-theme', values.first ) if values.size > 0
33
- put( 'gradient-colors', values[ 1..-1].join( ' ' ) ) if values.size > 1
34
- end
35
-
36
- def has_gradient?
37
- # has user defined gradient (using headers)? (default values do NOT count)
38
- @hash.has_key?( :gradient_theme ) || @hash.has_key?( :gradient_colors )
39
- end
40
-
41
- def []( key )
42
- value = get( key )
43
- value = @config.header( key ) if value.nil? # try lookup in config properties next
44
-
45
- if value.nil?
46
- puts "** Warning: header '#{key}' undefined"
47
- value = "- #{key} not found -"
48
- end
49
- value
50
- end
51
-
52
- def code_engine
53
- get( 'code-engine' )
54
- end
55
-
56
- def code_txmt
57
- get( 'code-txmt' )
58
- end
59
-
60
-
61
- DEFAULTS =
62
- {
63
- :title => 'Untitled Slide Show',
64
- :footer => '',
65
- :subfooter => '',
66
- :gradient_theme => 'diagonal',
67
- :gradient_colors => 'red orange',
68
-
69
- :code_engine => 'sh', # SyntaxHighligher (sh) | ultraviolet (uv) | coderay (cr)
70
- :code_txmt => 'false', # Text Mate Hyperlink for Source?
71
- }
72
-
73
- ## todo: rename get to fetch??
74
- def get( key, default=nil )
75
- key = normalize_key(key)
76
- value = @hash.fetch( key, DEFAULTS[ key ] )
77
- if value.nil?
78
- default
79
- else
80
- value
81
- end
82
- end
83
-
84
- private
85
-
86
- def normalize_key( key )
87
- key.to_s.downcase.tr('-', '_').to_sym
88
- end
89
-
90
- def get_boolean( key, default )
91
- key = normalize_key( key )
92
- value = @hash.fetch( key, DEFAULTS[ key ] )
93
- if value.nil?
94
- default
95
- else
96
- (value == true || value =~ /true|yes|on/i) ? true : false
97
- end
98
- end
99
-
100
- end # class Headers
101
-
102
3
 
103
4
  class Opts
104
-
5
+
105
6
  def generate=(value)
106
7
  @generate = value
107
8
  end
@@ -0,0 +1,3 @@
1
+ module Slideshow
2
+ VERSION = '1.1.0.beta6'
3
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow
3
3
  version: !ruby/object:Gem::Version
4
- hash: 689500001
4
+ hash: 570047004
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - 0
10
10
  - beta
11
- - 5
12
- version: 1.1.0.beta5
11
+ - 6
12
+ version: 1.1.0.beta6
13
13
  platform: ruby
14
14
  authors:
15
15
  - Gerald Bauer
@@ -160,6 +160,7 @@ files:
160
160
  - lib/slideshow/filters/slide_filter.rb
161
161
  - lib/slideshow/filters/text_filter.rb
162
162
  - lib/slideshow/gen.rb
163
+ - lib/slideshow/headers.rb
163
164
  - lib/slideshow/helpers/analytics_helper.rb
164
165
  - lib/slideshow/helpers/background_helper.rb
165
166
  - lib/slideshow/helpers/capture_helper.rb
@@ -178,6 +179,7 @@ files:
178
179
  - lib/slideshow/markup/textile.rb
179
180
  - lib/slideshow/opts.rb
180
181
  - lib/slideshow/slide.rb
182
+ - lib/slideshow/version.rb
181
183
  - templates/s6.txt
182
184
  - templates/s6.txt.gen
183
185
  - templates/s6/jquery.js