slideshow 1.1.0.beta3 → 1.1.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/config/slideshow.builtin.yml +2 -32
- data/config/slideshow.yml +55 -37
- data/lib/slideshow.rb +1 -1
- data/lib/slideshow/config.rb +60 -53
- data/lib/slideshow/gen.rb +3 -1
- data/lib/slideshow/opts.rb +8 -8
- metadata +7 -7
data/Rakefile
CHANGED
@@ -1,38 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# access or overwrite using nested builtin context e.g.
|
4
|
-
# builtin:
|
5
|
-
# textile:
|
6
|
-
# libs: [ whatever ]
|
1
|
+
####################
|
2
|
+
### builtin configuration (not configurable by user now)
|
7
3
|
|
8
4
|
|
9
5
|
helper:
|
10
6
|
unparsed: [ slide, style ]
|
11
7
|
renames: [ include, class ]
|
12
8
|
exprs: [ class, clear ]
|
13
|
-
|
14
|
-
# text filters
|
15
|
-
filters:
|
16
|
-
- skip-end-directive
|
17
|
-
- directives_bang_style_to_percent_style
|
18
|
-
- directives_percent_style
|
19
|
-
- comments-percent-style
|
20
|
-
- leading-headers
|
21
|
-
- erb-django-style
|
22
|
-
- erb-rename-helper-hack
|
23
|
-
- dump_content_to_file_debug_text_erb
|
24
|
-
- erb
|
25
|
-
- code-block-curly-style
|
26
|
-
- dump_content_to_file_debug_text
|
27
|
-
|
28
|
-
|
29
|
-
# markup (textile, markdown, rest) config
|
30
|
-
|
31
|
-
textile:
|
32
|
-
extnames: [ .textile, .t ]
|
33
|
-
|
34
|
-
rest:
|
35
|
-
extnames: [ .rst, .rest ]
|
36
|
-
|
37
|
-
markdown:
|
38
|
-
extnames: [ .markdown, .m, .mark, .mkdn, .md, .txt, .text ]
|
data/config/slideshow.yml
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
-
|
1
|
+
#########################################
|
2
|
+
# slideshow configuration defaults
|
2
3
|
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
4
|
+
# override settings in:
|
5
|
+
# ~/slideshow.yml in home folder
|
6
|
+
# or
|
7
|
+
# ./slideshow.yml in working folder
|
7
8
|
|
8
|
-
|
9
|
+
|
10
|
+
######################
|
11
|
+
# lets you define default/fallback headers
|
9
12
|
|
10
13
|
headers:
|
11
|
-
generator: <%= Slideshow.generator %>
|
14
|
+
generator: "<%= Slideshow.generator %>"
|
12
15
|
author: Your Name Here
|
13
16
|
email: Your Email Here
|
14
17
|
company: Your Company Here
|
15
18
|
title: Your Title Here
|
16
19
|
subtitle: Your Subtitle Here
|
17
20
|
footer: Your Footer Here
|
18
|
-
subfooter: Your Subfooter Here
|
19
|
-
date: <%= Date.today %>
|
21
|
+
subfooter: Your Subfooter Here
|
22
|
+
date: "<%= Date.today %>"
|
20
23
|
|
21
24
|
# todo: use nested config?? eg.
|
22
25
|
# gradient:
|
@@ -36,39 +39,54 @@ headers:
|
|
36
39
|
|
37
40
|
|
38
41
|
|
39
|
-
# shortcuts for fetching template packs
|
40
|
-
# map shortcut to URI
|
41
|
-
|
42
|
-
fetch:
|
43
|
-
s6syntax: https://github.com/geraldb/slideshow-s6-syntax-highlighter/raw/master/s6syntax.txt
|
44
|
-
s6blank: https://github.com/geraldb/slideshow-s6-blank/raw/master/s6blank.txt
|
45
|
-
s5blank: https://github.com/geraldb/slideshow-s5-blank/raw/master/s5blank.txt
|
46
|
-
s5themes: https://github.com/geraldb/slideshow-s5-themes/raw/master/s5themes.txt
|
47
|
-
fullerscreen: https://github.com/geraldb/slideshow-fullerscreen/raw/master/fullerscreen.txt
|
48
|
-
slidy: https://github.com/geraldb/slideshow-slidy/raw/master/slidy.txt
|
49
|
-
g5: https://github.com/geraldb/slideshow-google-html5-slides/raw/master/g5.txt
|
50
|
-
slippy: https://github.com/geraldb/slideshow-slippy/raw/master/slippy.txt
|
51
|
-
csss: https://github.com/geraldb/slideshow-csss/raw/master/csss.txt
|
52
|
-
deck.js: https://github.com/geraldb/slideshow-deck.js/raw/master/deck.js.txt
|
53
|
-
impress.js: https://github.com/geraldb/slideshow-impress.js/raw/master/impress.js.txt
|
54
|
-
shower: https://github.com/geraldb/slideshow-shower/raw/master/shower.txt
|
55
42
|
|
56
43
|
# your google analytics code
|
57
44
|
analytics:
|
58
|
-
|
59
|
-
|
45
|
+
google: UA-XXX
|
60
46
|
|
61
|
-
helper:
|
62
|
-
renames: []
|
63
|
-
exprs: []
|
64
47
|
|
65
|
-
|
48
|
+
########################################################3
|
49
|
+
### text/markup (textile, markdown) processing config
|
66
50
|
|
67
51
|
# filters to run before markup processing
|
68
|
-
filters:
|
69
|
-
|
52
|
+
filters:
|
53
|
+
- skip-end-directive
|
54
|
+
- directives_bang_style_to_percent_style
|
55
|
+
- directives_percent_style
|
56
|
+
- comments-percent-style
|
57
|
+
- leading-headers
|
58
|
+
- erb-django-style
|
59
|
+
- erb-rename-helper-hack
|
60
|
+
- dump_content_to_file_debug_text_erb
|
61
|
+
- erb
|
62
|
+
- code-block-curly-style
|
63
|
+
- dump_content_to_file_debug_text
|
64
|
+
|
65
|
+
|
66
|
+
# markup (textile, markdown, rest) config
|
67
|
+
|
70
68
|
textile:
|
71
|
-
extnames: []
|
72
|
-
|
73
|
-
|
74
|
-
extnames: []
|
69
|
+
extnames: [ .textile, .t ]
|
70
|
+
|
71
|
+
rest:
|
72
|
+
extnames: [ .rst, .rest ]
|
73
|
+
|
74
|
+
# NB: markdown now configured in markdown.yml (using markdown gem)
|
75
|
+
|
76
|
+
|
77
|
+
#############################
|
78
|
+
# shortcuts for fetching template packs
|
79
|
+
# map shortcut to URI
|
80
|
+
fetch:
|
81
|
+
s6syntax: https://github.com/geraldb/slideshow-s6-syntax-highlighter/raw/master/s6syntax.txt
|
82
|
+
s6blank: https://github.com/geraldb/slideshow-s6-blank/raw/master/s6blank.txt
|
83
|
+
s5blank: https://github.com/geraldb/slideshow-s5-blank/raw/master/s5blank.txt
|
84
|
+
s5themes: https://github.com/geraldb/slideshow-s5-themes/raw/master/s5themes.txt
|
85
|
+
fullerscreen: https://github.com/geraldb/slideshow-fullerscreen/raw/master/fullerscreen.txt
|
86
|
+
slidy: https://github.com/geraldb/slideshow-slidy/raw/master/slidy.txt
|
87
|
+
g5: https://github.com/geraldb/slideshow-google-html5-slides/raw/master/g5.txt
|
88
|
+
slippy: https://github.com/geraldb/slideshow-slippy/raw/master/slippy.txt
|
89
|
+
csss: https://github.com/geraldb/slideshow-csss/raw/master/csss.txt
|
90
|
+
deck.js: https://github.com/geraldb/slideshow-deck.js/raw/master/deck.js.txt
|
91
|
+
impress.js: https://github.com/geraldb/slideshow-impress.js/raw/master/impress.js.txt
|
92
|
+
shower: https://github.com/geraldb/slideshow-shower/raw/master/shower.txt
|
data/lib/slideshow.rb
CHANGED
data/lib/slideshow/config.rb
CHANGED
@@ -3,69 +3,72 @@ module Slideshow
|
|
3
3
|
class Config
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
|
6
|
+
# do nothing for now
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
value = @hash[ normalize_key( key ) ]
|
11
|
-
if value.nil?
|
12
|
-
puts "** Warning: config key '#{key}' undefined (returning nil)"
|
13
|
-
end
|
9
|
+
def load
|
14
10
|
|
15
|
-
value
|
16
|
-
end
|
17
|
-
|
18
|
-
def load
|
19
11
|
# load builtin config file @ <gem>/config/slideshow.yml
|
20
|
-
|
21
|
-
|
12
|
+
#
|
13
|
+
# NB: builtin use a different hierachy (not linked to default/home/user/cli props)
|
14
|
+
# for now builtin has no erb processing
|
15
|
+
# user cannot override builtin settings (only defaults see below)
|
16
|
+
props_builtin_file = File.join( Slideshow.root, 'config', 'slideshow.builtin.yml' )
|
17
|
+
@props_builtin = Props.load_file( props_builtin_file )
|
22
18
|
|
23
|
-
# run through erb
|
24
|
-
config_txt = File.read( config_file )
|
25
|
-
config_txt = ERB.new( config_txt ).result( binding() )
|
26
|
-
|
27
|
-
@hash = YAML.load( config_txt )
|
28
|
-
|
29
|
-
# for now builtin has no erb processing; add builtin hash to main hash
|
30
|
-
@hash[ 'builtin' ] = YAML.load_file( config_builtin_file )
|
31
|
-
|
32
|
-
# todo/fix: merge config files
|
33
|
-
# check more locations
|
34
19
|
|
35
|
-
|
20
|
+
props_default_file = File.join( Slideshow.root, 'config', 'slideshow.yml' )
|
21
|
+
@props = @props_default = Props.load_file_with_erb( props_default_file, binding() )
|
22
|
+
|
23
|
+
# check for user settings (slideshow.yml) in home folder
|
24
|
+
|
25
|
+
props_home_file = File.join( Env.home, 'slideshow.yml' )
|
26
|
+
if File.exists?( props_home_file )
|
27
|
+
puts "Loading settings from '#{props_home_file}'..."
|
28
|
+
@props = @props_home = Props.load_file_with_erb( props_home_file, binding(), @props )
|
29
|
+
end
|
30
|
+
|
31
|
+
# check for user settings (slideshow.yml) in working folder
|
36
32
|
|
37
|
-
|
38
|
-
if File.exists?(
|
39
|
-
puts "Loading settings from '#{
|
40
|
-
@
|
41
|
-
end
|
42
|
-
|
33
|
+
props_work_file = File.join( '.', 'slideshow.yml' )
|
34
|
+
if File.exists?( props_work_file )
|
35
|
+
puts "Loading settings from '#{props_work_file}'..."
|
36
|
+
@props = @props_work = Props.load_file_with_erb( props_work_file, binding(), @props )
|
37
|
+
end
|
43
38
|
end
|
44
39
|
|
40
|
+
|
41
|
+
def header( key )
|
42
|
+
@props.fetch_from_section( 'headers', normalize_key( key ), nil )
|
43
|
+
end
|
44
|
+
|
45
45
|
def markdown_post_processing?( lib )
|
46
|
-
|
46
|
+
## todo: normalize key/lib???
|
47
|
+
@props.fetch_from_section( lib, 'post-processing', true )
|
47
48
|
end
|
48
49
|
|
49
50
|
def known_rest_extnames
|
50
|
-
@
|
51
|
+
@props.fetch_from_section( 'rest', 'extnames', [] )
|
51
52
|
end
|
52
53
|
|
53
54
|
def known_textile_extnames
|
54
|
-
|
55
|
-
# [ '.textile', '.t' ]
|
56
|
-
#
|
57
|
-
# using nested key
|
58
|
-
# textile:
|
59
|
-
# extnames: [ .textile, .t ]
|
60
|
-
|
61
|
-
@hash[ 'textile' ][ 'extnames' ] + @hash[ 'builtin' ][ 'textile' ][ 'extnames' ]
|
55
|
+
@props.fetch_from_section( 'textile', 'extnames', [] )
|
62
56
|
end
|
63
57
|
|
64
58
|
def known_markdown_extnames
|
65
|
-
|
59
|
+
## delegate config to Markdown gem for now
|
60
|
+
## todo/fix: how to pass on setting to Markdown gem??
|
61
|
+
Markdown.extnames
|
66
62
|
end
|
67
63
|
|
68
64
|
def known_extnames
|
65
|
+
# returns an array of known file extensions e.g.
|
66
|
+
# [ '.textile', '.t' ]
|
67
|
+
#
|
68
|
+
# using nested key
|
69
|
+
# textile:
|
70
|
+
# extnames: [ .textile, .t ]
|
71
|
+
#
|
69
72
|
# ruby check: is it better self. ?? or more confusing
|
70
73
|
# possible conflict only with write access (e.g. prop=)
|
71
74
|
|
@@ -73,32 +76,36 @@ class Config
|
|
73
76
|
end
|
74
77
|
|
75
78
|
def text_filters
|
76
|
-
@
|
79
|
+
@props.fetch( 'filters', [] )
|
80
|
+
end
|
81
|
+
|
82
|
+
def google_analytics_code
|
83
|
+
@props.fetch_from_section( 'analytics', 'google', nil )
|
77
84
|
end
|
78
85
|
|
86
|
+
def map_fetch_shortcut( key )
|
87
|
+
## todo: normalize key???
|
88
|
+
@props.fetch_from_section( 'fetch', key, nil )
|
89
|
+
end
|
90
|
+
|
79
91
|
def helper_renames
|
80
|
-
|
92
|
+
## NB: for now user cannot override/extent renames
|
93
|
+
@props_builtin['helper']['renames']
|
81
94
|
end
|
82
95
|
|
83
96
|
def helper_unparsed
|
97
|
+
## NB: for now user cannot override/extent unparsed helpers
|
84
98
|
# use unparsed params (passed along a single string)
|
85
|
-
@
|
99
|
+
@props_builtin['helper']['unparsed']
|
86
100
|
end
|
87
101
|
|
88
102
|
def helper_exprs
|
103
|
+
## NB: for now user cannot override/extent helper exprs
|
89
104
|
# allow expression as directives (no need for %end block)
|
90
105
|
# by default directives are assumed statements (e.g. %mydir %end)
|
91
|
-
@
|
106
|
+
@props_builtin['helper']['exprs']
|
92
107
|
end
|
93
108
|
|
94
|
-
def google_analytics_code
|
95
|
-
@hash[ 'analytics' ][ 'google' ]
|
96
|
-
end
|
97
|
-
|
98
|
-
def map_fetch_shortcut( key )
|
99
|
-
@hash[ 'fetch' ][ key ]
|
100
|
-
end
|
101
|
-
|
102
109
|
private
|
103
110
|
|
104
111
|
def normalize_key( key )
|
data/lib/slideshow/gen.rb
CHANGED
@@ -5,8 +5,9 @@ class Gen
|
|
5
5
|
def initialize
|
6
6
|
@logger = Logger.new(STDOUT)
|
7
7
|
@logger.level = Logger::INFO
|
8
|
-
|
8
|
+
|
9
9
|
@config = Config.new
|
10
|
+
@opts = Opts.new( @config )
|
10
11
|
end
|
11
12
|
|
12
13
|
attr_reader :logger, :opts, :config
|
@@ -14,6 +15,7 @@ class Gen
|
|
14
15
|
|
15
16
|
def headers
|
16
17
|
# give access to helpers to opts with a different name
|
18
|
+
### fix/todo: use a headers wrapper?? delegation to opts.header(key) lookup??
|
17
19
|
@opts
|
18
20
|
end
|
19
21
|
|
data/lib/slideshow/opts.rb
CHANGED
@@ -5,8 +5,9 @@ module Slideshow
|
|
5
5
|
|
6
6
|
class Opts
|
7
7
|
|
8
|
-
def initialize
|
9
|
-
@hash
|
8
|
+
def initialize( config )
|
9
|
+
@hash = {}
|
10
|
+
@config = config
|
10
11
|
end
|
11
12
|
|
12
13
|
def put( key, value )
|
@@ -35,18 +36,17 @@ class Opts
|
|
35
36
|
def has_gradient?
|
36
37
|
# has user defined gradient (using headers)? (default values do NOT count)
|
37
38
|
@hash.has_key?( :gradient_theme ) || @hash.has_key?( :gradient_colors )
|
38
|
-
end
|
39
|
-
|
40
|
-
|
39
|
+
end
|
41
40
|
|
42
41
|
def []( key )
|
43
42
|
value = get( key )
|
43
|
+
value = @config.header( key ) if value.nil? # try lookup in config properties next
|
44
|
+
|
44
45
|
if value.nil?
|
45
46
|
puts "** Warning: header '#{key}' undefined"
|
46
|
-
"- #{key} not found -"
|
47
|
-
else
|
48
|
-
value
|
47
|
+
value = "- #{key} not found -"
|
49
48
|
end
|
49
|
+
value
|
50
50
|
end
|
51
51
|
|
52
52
|
def generate?
|
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:
|
4
|
+
hash: -829632114
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 1.1.0.
|
11
|
+
- 4
|
12
|
+
version: 1.1.0.beta4
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Gerald Bauer
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-06-
|
20
|
+
date: 2012-06-10 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: RedCloth
|
@@ -91,12 +91,12 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
94
|
+
hash: 23
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
-
|
97
|
+
- 2
|
98
98
|
- 0
|
99
|
-
version: 0.
|
99
|
+
version: 0.2.0
|
100
100
|
type: :runtime
|
101
101
|
version_requirements: *id005
|
102
102
|
- !ruby/object:Gem::Dependency
|