slideshow 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.md +4 -0
- data/Manifest.txt +3 -48
- data/{README.markdown → README.md} +134 -132
- data/Rakefile +26 -17
- data/lib/slideshow.rb +19 -97
- data/lib/slideshow/cli/main.rb +38 -20
- data/lib/slideshow/cli/main_utils.rb +10 -4
- data/lib/slideshow/cli/opts.rb +3 -1
- data/lib/slideshow/cli/version.rb +26 -0
- metadata +63 -147
- data/History.markdown +0 -171
- data/config/slideshow.builtin.yml +0 -8
- data/config/slideshow.index.yml +0 -61
- data/config/slideshow.yml +0 -76
- data/lib/slideshow/cli/commands/fetch.rb +0 -121
- data/lib/slideshow/cli/commands/gen.rb +0 -330
- data/lib/slideshow/cli/commands/gen_templates.rb +0 -52
- data/lib/slideshow/cli/commands/list.rb +0 -70
- data/lib/slideshow/cli/commands/plugins.rb +0 -44
- data/lib/slideshow/cli/commands/quick.rb +0 -86
- data/lib/slideshow/config.rb +0 -241
- data/lib/slideshow/filters/debug_filter.rb +0 -74
- data/lib/slideshow/filters/headers_filter.rb +0 -45
- data/lib/slideshow/filters/slide_filter.rb +0 -113
- data/lib/slideshow/filters/text_filter.rb +0 -140
- data/lib/slideshow/headers.rb +0 -87
- data/lib/slideshow/helpers/background_helper.rb +0 -121
- data/lib/slideshow/helpers/capture_helper.rb +0 -136
- data/lib/slideshow/helpers/directive_helper.rb +0 -43
- data/lib/slideshow/helpers/markdown_helper.rb +0 -18
- data/lib/slideshow/helpers/source_helper.rb +0 -39
- data/lib/slideshow/helpers/step_helper.rb +0 -33
- data/lib/slideshow/helpers/syntax/coderay_helper.rb +0 -84
- data/lib/slideshow/helpers/syntax/sh_helper.rb +0 -61
- data/lib/slideshow/helpers/syntax/uv_helper.rb +0 -90
- data/lib/slideshow/helpers/text_helper.rb +0 -130
- data/lib/slideshow/manifest_helpers.rb +0 -94
- data/lib/slideshow/markup/markdown.rb +0 -18
- data/lib/slideshow/markup/mediawiki.rb +0 -38
- data/lib/slideshow/markup/rest.rb +0 -17
- data/lib/slideshow/markup/textile.rb +0 -68
- data/lib/slideshow/plugin_helpers.rb +0 -62
- data/lib/slideshow/slide.rb +0 -118
- data/lib/slideshow/version.rb +0 -3
- data/templates/s6.txt +0 -27
- data/templates/s6.txt.gen +0 -19
- data/templates/s6/jquery.js +0 -8176
- data/templates/s6/jquery.microsoft.js +0 -31
- data/templates/s6/jquery.slideshow.js +0 -534
- data/templates/s6/print.css +0 -1
- data/templates/s6/projection.css +0 -109
- data/templates/s6/screen.css +0 -50
- data/templates/slides.html.erb +0 -55
- data/templates/slides.pdf.html.erb +0 -62
- data/templates/style.css.erb +0 -91
- data/templates/welcome.text +0 -167
- data/templates/welcome.txt.quick +0 -6
@@ -1,74 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Slideshow
|
3
|
-
module DebugFilter
|
4
|
-
|
5
|
-
# use it to dump content before erb merge
|
6
|
-
|
7
|
-
def dump_content_to_file_debug_text_erb( content )
|
8
|
-
|
9
|
-
# NB: using attribs from mixed in class
|
10
|
-
# - opts
|
11
|
-
# - outdir
|
12
|
-
|
13
|
-
return content unless opts.verbose?
|
14
|
-
|
15
|
-
outname = "#{outdir}/#{@name}.debug.text.erb"
|
16
|
-
|
17
|
-
puts " Dumping content before erb merge to #{outname}..."
|
18
|
-
|
19
|
-
File.open( outname, 'w' ) do |f|
|
20
|
-
f.write( content )
|
21
|
-
end
|
22
|
-
|
23
|
-
content
|
24
|
-
end
|
25
|
-
|
26
|
-
# use it to dump content before html post processing
|
27
|
-
|
28
|
-
def dump_content_to_file_debug_html( content )
|
29
|
-
|
30
|
-
# NB: using attribs from mixed in class
|
31
|
-
# - opts
|
32
|
-
# - outdir
|
33
|
-
|
34
|
-
return content unless opts.verbose?
|
35
|
-
|
36
|
-
outname = "#{outdir}/#{@name}.debug.html"
|
37
|
-
|
38
|
-
puts " Dumping content before html post processing to #{outname}..."
|
39
|
-
|
40
|
-
File.open( outname, 'w' ) do |f|
|
41
|
-
f.write( content )
|
42
|
-
end
|
43
|
-
|
44
|
-
content
|
45
|
-
end
|
46
|
-
|
47
|
-
# use it to dump content before text-to-html conversion
|
48
|
-
|
49
|
-
def dump_content_to_file_debug_text( content )
|
50
|
-
|
51
|
-
# NB: using attribs from mixed in class
|
52
|
-
# - opts
|
53
|
-
# - outdir
|
54
|
-
|
55
|
-
return content unless opts.verbose?
|
56
|
-
|
57
|
-
outname = "#{outdir}/#{@name}.debug.text"
|
58
|
-
|
59
|
-
puts " Dumping content before text-to-html conversion to #{outname}..."
|
60
|
-
|
61
|
-
File.open( outname, 'w' ) do |f|
|
62
|
-
f.write( content )
|
63
|
-
end
|
64
|
-
|
65
|
-
content
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
end # module DebugFilter
|
70
|
-
end # module Slideshow
|
71
|
-
|
72
|
-
class Slideshow::Gen
|
73
|
-
include Slideshow::DebugFilter
|
74
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Slideshow
|
3
|
-
module HeadersFilter
|
4
|
-
|
5
|
-
def leading_headers( content_with_headers )
|
6
|
-
|
7
|
-
# todo: lets user override headers with command line options
|
8
|
-
# that is, lets you override options using commandline switch
|
9
|
-
|
10
|
-
# read source document; split off optional header from source
|
11
|
-
# strip leading optional headers (key/value pairs) including optional empty lines
|
12
|
-
|
13
|
-
read_headers = true
|
14
|
-
content = ""
|
15
|
-
|
16
|
-
keys = [] # track header keys for stats
|
17
|
-
|
18
|
-
content_with_headers.each_line do |line|
|
19
|
-
if read_headers && line =~ /^\s*(\w[\w-]*)[ \t]*:[ \t]*(.*)/
|
20
|
-
key = $1.downcase
|
21
|
-
value = $2.strip
|
22
|
-
|
23
|
-
keys << key
|
24
|
-
|
25
|
-
logger.debug " adding header: key=>#{key}< value=>#{value}<"
|
26
|
-
headers.put( key, value )
|
27
|
-
elsif line =~ /^\s*$/
|
28
|
-
content << line unless read_headers
|
29
|
-
else
|
30
|
-
read_headers = false
|
31
|
-
content << line
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
puts " Reading #{keys.length} headers: #{keys.join(', ')}..."
|
36
|
-
|
37
|
-
content
|
38
|
-
end
|
39
|
-
|
40
|
-
end # module HeadersFilter
|
41
|
-
end # module Slideshow
|
42
|
-
|
43
|
-
class Slideshow::Gen
|
44
|
-
include Slideshow::HeadersFilter
|
45
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Slideshow
|
3
|
-
module SlideFilter
|
4
|
-
|
5
|
-
|
6
|
-
def takahashi_slide_breaks( content )
|
7
|
-
|
8
|
-
inline_count = 0
|
9
|
-
line_count = 0
|
10
|
-
|
11
|
-
###########################
|
12
|
-
## allows one // two // three
|
13
|
-
|
14
|
-
content.gsub!( /\b[ ]+\/{2}[ ]+\b/) do |match|
|
15
|
-
inline_count += 1
|
16
|
-
## todo: use slide('') directive helper?
|
17
|
-
"\n\n<!-- _S9SLIDE_ -->\n\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
############################
|
21
|
-
## allows
|
22
|
-
##
|
23
|
-
## one
|
24
|
-
## //
|
25
|
-
## two
|
26
|
-
## //
|
27
|
-
## three
|
28
|
-
|
29
|
-
content.gsub!( /^[ ]*\/{2}[ ]*$/ ) do |match|
|
30
|
-
line_count += 1
|
31
|
-
## todo: use slide('') directive helper?
|
32
|
-
"\n\n<!-- _S9SLIDE_ -->\n\n"
|
33
|
-
end
|
34
|
-
|
35
|
-
puts " Adding #{inline_count+line_count} takahashi slide breaks (#{inline_count} //-inline, #{line_count} //-line)..."
|
36
|
-
|
37
|
-
content
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
# add slide directive before h1 (tells slideshow gem where to break slides)
|
42
|
-
#
|
43
|
-
# e.g. changes:
|
44
|
-
# <h1 id='optional' class='optional'>
|
45
|
-
# to
|
46
|
-
# html comment -> _S9SLIDE_ (note: rdoc can't handle html comments?)
|
47
|
-
# <h1 id='optional' class='optional'>
|
48
|
-
|
49
|
-
def add_slide_directive_before_h1( content )
|
50
|
-
|
51
|
-
# mark h1 for getting wrapped into slide divs
|
52
|
-
# note: use just <h1 since some processors add ids e.g. <h1 id='x'>
|
53
|
-
|
54
|
-
slide_count = 0
|
55
|
-
|
56
|
-
content.gsub!( /<h1/ ) do |match|
|
57
|
-
slide_count += 1
|
58
|
-
"\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}"
|
59
|
-
end
|
60
|
-
|
61
|
-
puts " Adding #{slide_count} slide breaks (using h1 rule)..."
|
62
|
-
|
63
|
-
content
|
64
|
-
end
|
65
|
-
|
66
|
-
def add_slide_directive_before_h2( content )
|
67
|
-
|
68
|
-
slide_count = 0
|
69
|
-
|
70
|
-
content.gsub!( /<h2/ ) do |match|
|
71
|
-
slide_count += 1
|
72
|
-
"\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}"
|
73
|
-
end
|
74
|
-
|
75
|
-
puts " Adding #{slide_count} slide breaks (using h2 rule)..."
|
76
|
-
|
77
|
-
content
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
# add slide directive before div h1 (for pandoc-generated html)
|
83
|
-
#
|
84
|
-
# e.g. changes:
|
85
|
-
# <div id='header'>
|
86
|
-
# <h1 id='optional' class='optional'>
|
87
|
-
# to
|
88
|
-
# html comment -> _S9SLIDE_
|
89
|
-
# <div id='header'>
|
90
|
-
# <h1 id='optional' class='optional'>
|
91
|
-
|
92
|
-
|
93
|
-
def add_slide_directive_before_div_h1( content )
|
94
|
-
|
95
|
-
slide_count = 0
|
96
|
-
|
97
|
-
content.gsub!( /<div[^>]*>\s*<h1/ ) do |match|
|
98
|
-
slide_count += 1
|
99
|
-
"\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}"
|
100
|
-
end
|
101
|
-
|
102
|
-
puts " Adding #{slide_count} slide breaks (using div_h1 rule)..."
|
103
|
-
|
104
|
-
content
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
end # module SlideFilter
|
109
|
-
end # module Slideshow
|
110
|
-
|
111
|
-
class Slideshow::Gen
|
112
|
-
include Slideshow::SlideFilter
|
113
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# builtin text filters
|
4
|
-
# called before text_to_html
|
5
|
-
#
|
6
|
-
# use web filters for processing html/hypertext
|
7
|
-
|
8
|
-
module Slideshow
|
9
|
-
module TextFilter
|
10
|
-
|
11
|
-
include TextUtils::Filter # include comments_percent_style, skip_end_directive, etc. filters
|
12
|
-
|
13
|
-
alias_method :old_comments_percent_style, :comments_percent_style
|
14
|
-
|
15
|
-
def comments_percent_style( content )
|
16
|
-
|
17
|
-
# skip filter for pandoc
|
18
|
-
# - pandoc uses % for its own markdown extension
|
19
|
-
return content if @markup_type == :markdown && Markdown.lib == 'pandoc-ruby'
|
20
|
-
|
21
|
-
old_comments_percent_style( content )
|
22
|
-
end
|
23
|
-
|
24
|
-
def directives_bang_style_to_percent_style( content )
|
25
|
-
|
26
|
-
# for compatibility allow !SLIDE/!STYLE as an alternative to %slide/%style-directive
|
27
|
-
|
28
|
-
bang_count = 0
|
29
|
-
|
30
|
-
# get unparsed helpers e.g. SLIDE|STYLE
|
31
|
-
unparsed = config.helper_unparsed.map { |item| item.upcase }.join( '|' )
|
32
|
-
|
33
|
-
content.gsub!(/^!(#{unparsed})(.*)$/) do |match|
|
34
|
-
bang_count += 1
|
35
|
-
"<%= #{$1.downcase} '#{$2 ? $2 : ''}' %>"
|
36
|
-
end
|
37
|
-
|
38
|
-
puts " Patching !-directives (#{bang_count} #{config.helper_unparsed.join('/')}-directives)..."
|
39
|
-
|
40
|
-
content
|
41
|
-
end
|
42
|
-
|
43
|
-
def directives_percent_style( content )
|
44
|
-
|
45
|
-
# skip filter for pandoc
|
46
|
-
# - pandoc uses % for its own markdown extension
|
47
|
-
# - don't process % pass it along/through to pandoc
|
48
|
-
|
49
|
-
return content if @markup_type == :markdown && Markdown.lib == 'pandoc-ruby'
|
50
|
-
|
51
|
-
|
52
|
-
directive_unparsed = 0
|
53
|
-
directive_expr = 0
|
54
|
-
directive_block_beg = 0
|
55
|
-
directive_block_end = 0
|
56
|
-
|
57
|
-
# process directives (plus skip %begin/%end comment-blocks)
|
58
|
-
|
59
|
-
inside_block = 0
|
60
|
-
inside_helper = false
|
61
|
-
|
62
|
-
content2 = ""
|
63
|
-
|
64
|
-
content.each_line do |line|
|
65
|
-
if line =~ /^%([a-zA-Z][a-zA-Z0-9_]*)(.*)/
|
66
|
-
directive = $1.downcase
|
67
|
-
params = $2
|
68
|
-
|
69
|
-
logger.debug "processing %-directive: #{directive}"
|
70
|
-
|
71
|
-
# slide, style
|
72
|
-
if config.helper_unparsed.include?( directive )
|
73
|
-
directive_unparsed += 1
|
74
|
-
content2 << "<%= #{directive} '#{params ? params : ''}' %>"
|
75
|
-
elsif config.helper_exprs.include?( directive )
|
76
|
-
directive_expr += 1
|
77
|
-
content2 << "<%= #{directive} #{params ? erb_simple_params(directive,params) : ''} %>"
|
78
|
-
elsif inside_helper && directive == 'end'
|
79
|
-
inside_helper = false
|
80
|
-
directive_block_end += 1
|
81
|
-
content2 << "%>"
|
82
|
-
elsif inside_block > 0 && directive == 'end'
|
83
|
-
inside_block -= 1
|
84
|
-
directive_block_end += 1
|
85
|
-
content2 << "<% end %>"
|
86
|
-
elsif [ 'comment', 'comments', 'begin', 'end' ].include?( directive ) # skip begin/end comment blocks
|
87
|
-
content2 << line
|
88
|
-
elsif [ 'helper', 'helpers' ].include?( directive )
|
89
|
-
inside_helper = true
|
90
|
-
directive_block_beg += 1
|
91
|
-
content2 << "<%"
|
92
|
-
else
|
93
|
-
inside_block += 1
|
94
|
-
directive_block_beg += 1
|
95
|
-
content2 << "<% #{directive} #{params ? erb_simple_params(directive,params) : ''} do %>"
|
96
|
-
end
|
97
|
-
else
|
98
|
-
content2 << line
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
puts " Preparing %-directives (" +
|
103
|
-
"#{directive_unparsed} #{config.helper_unparsed.join('/')} directives, " +
|
104
|
-
"#{directive_expr} #{config.helper_exprs.join('/')} expr-directives, " +
|
105
|
-
"#{directive_block_beg}/#{directive_block_end} block-directives)..."
|
106
|
-
|
107
|
-
content2
|
108
|
-
end
|
109
|
-
|
110
|
-
######################
|
111
|
-
# todo: fix move to textutils gem (including helpers and config)
|
112
|
-
#
|
113
|
-
|
114
|
-
|
115
|
-
def erb_rename_helper_hack( content )
|
116
|
-
# note: include is a ruby keyword; rename to s9_include so we can use it
|
117
|
-
|
118
|
-
rename_counter = 0
|
119
|
-
|
120
|
-
# turn renames into something like:
|
121
|
-
# include|class etc.
|
122
|
-
renames = config.helper_renames.join( '|' )
|
123
|
-
|
124
|
-
content.gsub!( /<%=[ \t]*(#{renames})/ ) do |match|
|
125
|
-
rename_counter += 1
|
126
|
-
"<%= s9_#{$1}"
|
127
|
-
end
|
128
|
-
|
129
|
-
puts " Patching embedded Ruby (erb) code for aliases (#{rename_counter} #{config.helper_renames.join('/')}-aliases)..."
|
130
|
-
|
131
|
-
content
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
|
-
end # module TextFilter
|
136
|
-
end # module Slideshow
|
137
|
-
|
138
|
-
class Slideshow::Gen
|
139
|
-
include Slideshow::TextFilter
|
140
|
-
end
|
data/lib/slideshow/headers.rb
DELETED
@@ -1,87 +0,0 @@
|
|
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
|