slideshow 0.9.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/config/slideshow.yml +13 -10
- data/lib/slideshow.rb +1 -1
- data/lib/slideshow/filters/debug_filter.rb +1 -0
- data/lib/slideshow/filters/headers_filter.rb +1 -0
- data/lib/slideshow/filters/slide_filter.rb +1 -0
- data/lib/slideshow/filters/text_filter.rb +2 -0
- data/lib/slideshow/gen.rb +18 -6
- data/lib/slideshow/helpers/background_helper.rb +14 -37
- data/lib/slideshow/slide.rb +23 -3
- metadata +5 -5
data/config/slideshow.yml
CHANGED
@@ -40,16 +40,19 @@ headers:
|
|
40
40
|
# map shortcut to URI
|
41
41
|
|
42
42
|
fetch:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
+
|
53
56
|
# your google analytics code
|
54
57
|
analytics:
|
55
58
|
google: UA-XXX
|
data/lib/slideshow.rb
CHANGED
data/lib/slideshow/gen.rb
CHANGED
@@ -203,25 +203,37 @@ class Gen
|
|
203
203
|
slide_source = "" # reset slide source buffer
|
204
204
|
end
|
205
205
|
|
206
|
+
|
206
207
|
## split slide source into header (optional) and content/body
|
207
|
-
## plus check for (css style) classes
|
208
|
+
## plus check for (css style) classes and data attributes
|
208
209
|
|
209
210
|
slides2 = []
|
210
211
|
slides.each do |slide_source|
|
211
212
|
slide = Slide.new
|
212
213
|
|
213
|
-
## check for css style classes
|
214
|
+
## check for css style classes
|
214
215
|
from = 0
|
215
216
|
while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE)_(.*?)-->/m, from ))
|
216
217
|
logger.debug " adding css classes from pi #{$1.downcase}: #{$2.strip}"
|
217
218
|
|
219
|
+
from = Regexp.last_match.end(0) # continue search later from here
|
220
|
+
|
221
|
+
values = $2.strip.dup
|
222
|
+
|
223
|
+
# remove data values (eg. x=-20 scale=4) and store in data hash
|
224
|
+
values.gsub!( /([-\w]+)[ \t]*=[ \t]*([-\w\.]+)/ ) do |_|
|
225
|
+
logger.debug " adding data pair: key=>#{$1.downcase}< value=>#{$2}<"
|
226
|
+
slide.data[ $1.downcase.dup ] = $2.dup
|
227
|
+
" " # replace w/ space
|
228
|
+
end
|
229
|
+
|
230
|
+
values.strip! # remove spaces # todo: use squish or similar and check for empty string
|
231
|
+
|
218
232
|
if slide.classes.nil?
|
219
|
-
slide.classes =
|
233
|
+
slide.classes = values
|
220
234
|
else
|
221
|
-
slide.classes << " #{
|
235
|
+
slide.classes << " #{values}"
|
222
236
|
end
|
223
|
-
|
224
|
-
from = Regexp.last_match.end(0)
|
225
237
|
end
|
226
238
|
|
227
239
|
# try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com
|
@@ -20,34 +20,30 @@ def gradient_from_headers( *args )
|
|
20
20
|
elsif theme == 'left-right'
|
21
21
|
buf << "linear-gradient( left, #{colors.join(', ')} )"
|
22
22
|
elsif theme == 'repeat'
|
23
|
-
buf << "repeating-linear-gradient( -60deg, "
|
24
|
-
# quick and dirty hack - for now repeat colors 10 times
|
25
|
-
9.times { buf << "#{colors.join(', ')}, " }
|
26
|
-
buf << "#{colors.join(', ')} )"
|
23
|
+
buf << "repeating-linear-gradient( -60deg, #{colors.join(', ')} 10% )"
|
27
24
|
elsif theme == 'radial'
|
28
25
|
buf << "radial-gradient( #{colors.join(', ')} )"
|
29
26
|
elsif theme == 'radial-off-center'
|
30
27
|
buf << "radial-gradient( 70% 70%, ellipse, #{colors.join(', ')} )"
|
31
28
|
elsif theme == 'radial-repeat'
|
32
|
-
buf << "repeating-radial-gradient( 60% 60%, ellipse, "
|
33
|
-
# quick and dirty hack - for now repeat colors 10 times
|
34
|
-
9.times { buf << "#{colors.join(', ')}, " }
|
35
|
-
buf << "#{colors.join(', ')} )"
|
29
|
+
buf << "repeating-radial-gradient( 60% 60%, ellipse, #{colors.join(', ')} 10% )"
|
36
30
|
else
|
37
31
|
buf << "linear-gradient( #{colors.join(', ')} )"
|
38
32
|
puts "warning: unknown gradient themes #{theme} - falling back to default"
|
39
33
|
end
|
40
34
|
|
41
|
-
# todo: add value for headers to puts
|
42
35
|
puts " Adding CSS for gradient background style rule using headers..."
|
36
|
+
puts " gradient-theme: #{theme}"
|
37
|
+
puts " gradient-colors: #{colors.join(' ')}"
|
38
|
+
|
43
39
|
content_for( :css, <<-EOS )
|
44
40
|
/****
|
45
|
-
* generated by gradient_from_headers helper
|
41
|
+
* generated by gradient_from_headers helper; using headers:
|
46
42
|
* gradient-theme: #{theme}
|
47
43
|
* gradient-colors: #{colors.join(' ')}
|
48
44
|
*/
|
49
45
|
.slide { background-image: -webkit-#{buf};
|
50
|
-
background-image: -
|
46
|
+
background-image: -moz-#{buf};
|
51
47
|
background-image: -ms-#{buf};
|
52
48
|
background-image: -o-#{buf};
|
53
49
|
background-image: #{buf};
|
@@ -64,38 +60,19 @@ def gradient( *args )
|
|
64
60
|
|
65
61
|
clazz = opts[:class] || ( 's9_gradient_linear_'+colors.join('_').gsub( /[(), ]/, '_' ).gsub( /_{2,}/, '_').gsub( /[^-\w]/, '' ) )
|
66
62
|
|
67
|
-
## generate code for webkit
|
68
63
|
|
69
|
-
|
70
|
-
webkit << "-webkit-gradient(linear, 0% 0%, 0% 100%, "
|
71
|
-
webkit << "from(#{colors.first}), to(#{colors.last})"
|
64
|
+
## generate code
|
72
65
|
|
73
|
-
|
74
|
-
more_colors = colors[ 1..-2 ]
|
75
|
-
more_colors.each_with_index do |color, i|
|
76
|
-
webkit << ", color-stop(#{(1.0/(more_colors.size+1))*(i+1)},#{color})"
|
77
|
-
end
|
78
|
-
webkit << ")"
|
79
|
-
|
80
|
-
## generate code for mozilla
|
81
|
-
|
82
|
-
mozilla = ""
|
83
|
-
mozilla << "-moz-linear-gradient(top, "
|
84
|
-
mozilla << "#{colors.first}, "
|
85
|
-
|
86
|
-
# check for additional stop colors
|
87
|
-
more_colors = colors[ 1..-2 ]
|
88
|
-
more_colors.each do |color|
|
89
|
-
mozilla << "#{color}, "
|
90
|
-
end
|
91
|
-
|
92
|
-
mozilla << "#{colors.last})"
|
66
|
+
buf = "linear-gradient(top, #{colors.join(', ')} )"
|
93
67
|
|
94
68
|
|
95
69
|
puts " Adding CSS for background style rule..."
|
96
70
|
content_for( :css, <<-EOS )
|
97
|
-
.#{clazz} { background:
|
98
|
-
background:
|
71
|
+
.#{clazz} { background-image: -webkit-#{buf};
|
72
|
+
background-image: -moz-#{buf};
|
73
|
+
background-image: -ms-#{buf};
|
74
|
+
background-image: -o-#{buf};
|
75
|
+
background-image: #{buf};
|
99
76
|
}
|
100
77
|
EOS
|
101
78
|
|
data/lib/slideshow/slide.rb
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
module Slideshow
|
2
2
|
|
3
|
-
class Slide
|
3
|
+
class Slide
|
4
|
+
|
5
|
+
attr_accessor :header
|
6
|
+
attr_accessor :content
|
7
|
+
attr_accessor :classes
|
8
|
+
attr_accessor :data
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@header = nil
|
12
|
+
@content = nil
|
13
|
+
@classes = nil
|
14
|
+
@data = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def data_attributes
|
18
|
+
buf = ""
|
19
|
+
@data.each do | key,value |
|
20
|
+
buf << "data-#{key}='#{value}' "
|
21
|
+
end
|
22
|
+
buf
|
23
|
+
end
|
4
24
|
|
5
25
|
def to_classic_html
|
6
26
|
|
@@ -19,14 +39,14 @@ module Slideshow
|
|
19
39
|
def to_google_html5
|
20
40
|
|
21
41
|
buf = ""
|
22
|
-
buf << "<div class='slide'>\n"
|
42
|
+
buf << "<div class='slide'>\n"
|
23
43
|
|
24
44
|
if header
|
25
45
|
buf << "<header>#{header}</header>\n"
|
26
46
|
end
|
27
47
|
|
28
48
|
buf << "<section class='"
|
29
|
-
buf << classes if classes
|
49
|
+
buf << classes if classes
|
30
50
|
buf << "'>\n"
|
31
51
|
|
32
52
|
buf << content if content
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.9.11
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
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: 2012-
|
18
|
+
date: 2012-03-04 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|