slideshow 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,61 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
module Syntax
|
3
|
-
module ShHelper
|
4
|
-
|
5
|
-
# sh option defaults
|
6
|
-
SH_LANG = 'ruby'
|
7
|
-
SH_LINE_NUMBERS = 'true'
|
8
|
-
|
9
|
-
def sh_worker( code, opts )
|
10
|
-
|
11
|
-
lang = opts.fetch( :lang, headers.get( 'code-language', SH_LANG ))
|
12
|
-
line_numbers_value = opts.fetch( :line_numbers, headers.get( 'code-line-numbers', SH_LINE_NUMBERS ))
|
13
|
-
line_numbers = (line_numbers_value =~ /true|yes|on/i) ? true : false
|
14
|
-
|
15
|
-
# note: code gets highlighted at runtime in client (using JavaScript)
|
16
|
-
code_highlighted = CGI::escapeHTML( code )
|
17
|
-
|
18
|
-
css_class = 'code'
|
19
|
-
css_class_opt = opts.fetch( :class, nil ) # large, small, tiny, etc.
|
20
|
-
css_class << " #{css_class_opt}" if css_class_opt # e.g. use/allow multiple classes -> code small, code large, etc.
|
21
|
-
|
22
|
-
out = %{<div class='#{css_class}'><pre class='brush: #{lang} toolbar: false gutter: #{line_numbers ? 'true' : 'false'}'>}
|
23
|
-
out << code_highlighted
|
24
|
-
out << %{</pre></div>\n}
|
25
|
-
|
26
|
-
name = opts.fetch( :name, nil )
|
27
|
-
txmt_value = opts.fetch( :txmt, headers.code_txmt )
|
28
|
-
txmt = (txmt_value =~ /true|yes|on/i) ? true : false
|
29
|
-
|
30
|
-
# add optional href link for textmate
|
31
|
-
if name
|
32
|
-
out << %{<div class="codeurl">}
|
33
|
-
out << %{<a href="txmt://open?url=file://#{File.expand_path(name)}">} if txmt
|
34
|
-
out << name
|
35
|
-
out << %{</a>} if txmt
|
36
|
-
out << %{</div>\n}
|
37
|
-
end
|
38
|
-
|
39
|
-
return out
|
40
|
-
end
|
41
|
-
|
42
|
-
def sv( *args, &blk )
|
43
|
-
# check for optional hash for options
|
44
|
-
opts = args.last.kind_of?(Hash) ? args.pop : {}
|
45
|
-
|
46
|
-
code = capture_erb(&blk)
|
47
|
-
return if code.empty?
|
48
|
-
|
49
|
-
code_highlighted = sv_worker( code, opts )
|
50
|
-
|
51
|
-
concat_erb( guard_block( code_highlighted ), blk.binding )
|
52
|
-
return
|
53
|
-
end
|
54
|
-
|
55
|
-
end # module ShHelper
|
56
|
-
end # module Syntax
|
57
|
-
end # module Slideshow
|
58
|
-
|
59
|
-
class Slideshow::Gen
|
60
|
-
include Slideshow::Syntax::ShHelper
|
61
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'uv'
|
2
|
-
|
3
|
-
module Slideshow
|
4
|
-
module Syntax
|
5
|
-
module UvHelper
|
6
|
-
|
7
|
-
# uv option defaults
|
8
|
-
UV_LANG = 'ruby'
|
9
|
-
UV_LINE_NUMBERS = 'true'
|
10
|
-
UV_THEME = 'amy'
|
11
|
-
|
12
|
-
def uv_worker( code, opts )
|
13
|
-
|
14
|
-
lang = opts.fetch( :lang, UV_LANG )
|
15
|
-
line_numbers_value = opts.fetch( :line_numbers, headers.get( 'code-line-numbers', UV_LINE_NUMBERS ))
|
16
|
-
line_numbers = (line_numbers_value =~ /true|yes|on/i) ? true : false
|
17
|
-
|
18
|
-
# change all-hallows-eve (CSS-style/convention) to all_hallows_eve (uv internal-style)
|
19
|
-
theme = opts.fetch( :theme, headers.get( 'code-theme', UV_THEME )).tr( '-', '_' )
|
20
|
-
|
21
|
-
code_highlighted = Uv.parse( code, "xhtml", lang, line_numbers, theme )
|
22
|
-
|
23
|
-
# first time? copy all uv built-in themes (css styles) to temporary cache (~/.slideshow/*)
|
24
|
-
uv_first_time = session.fetch( :uv_first_time, true )
|
25
|
-
if uv_first_time
|
26
|
-
session[ :uv_first_time ] = false
|
27
|
-
logger.debug "cache_dir=#{config.cache_dir}"
|
28
|
-
|
29
|
-
FileUtils.mkdir(config.cache_dir) unless File.exists?(config.cache_dir) if config.cache_dir
|
30
|
-
Uv.copy_files "xhtml", config.cache_dir
|
31
|
-
end
|
32
|
-
|
33
|
-
# first time this theme gets used add it to content_for hash for templates to include
|
34
|
-
uv_themes = session[ :uv_themes ] ||= {}
|
35
|
-
if uv_themes[ theme ].nil?
|
36
|
-
uv_themes[ theme ] = true
|
37
|
-
|
38
|
-
theme_content = File.read( "#{config.cache_dir}/css/#{theme}.css" )
|
39
|
-
|
40
|
-
theme_out = %{/* styles for ultraviolet code syntax highlighting theme '#{theme}' */\n\n}
|
41
|
-
theme_out << theme_content
|
42
|
-
theme_out << %{\n\n}
|
43
|
-
|
44
|
-
content_for( :css, theme_out )
|
45
|
-
end
|
46
|
-
|
47
|
-
css_class = 'code'
|
48
|
-
css_class_opt = opts.fetch( :class, nil ) # large, small, tiny, etc.
|
49
|
-
css_class << " #{css_class_opt}" if css_class_opt # e.g. use/allow multiple classes -> code small, code large, etc.
|
50
|
-
|
51
|
-
name = opts.fetch( :name, nil )
|
52
|
-
txmt_value = opts.fetch( :txmt, headers.code_txmt )
|
53
|
-
txmt = (txmt_value =~ /true|yes|on/i) ? true : false
|
54
|
-
|
55
|
-
out = %{<pre class='#{css_class}'>\n}
|
56
|
-
out << code_highlighted
|
57
|
-
out << %{</pre>\n}
|
58
|
-
|
59
|
-
# add optional href link for textmate
|
60
|
-
if name
|
61
|
-
out << %{<div class="codeurl">}
|
62
|
-
out << %{<a href="txmt://open?url=file://#{File.expand_path(name)}">} if txmt
|
63
|
-
out << name
|
64
|
-
out << %{</a>} if txmt
|
65
|
-
out << %{</div>\n}
|
66
|
-
end
|
67
|
-
|
68
|
-
return out
|
69
|
-
end
|
70
|
-
|
71
|
-
def uv( *args, &blk )
|
72
|
-
# check for optional hash for options
|
73
|
-
opts = args.last.kind_of?(Hash) ? args.pop : {}
|
74
|
-
|
75
|
-
code = capture_erb(&blk)
|
76
|
-
return if code.empty?
|
77
|
-
|
78
|
-
code_highlighted = uv_worker( code, opts )
|
79
|
-
|
80
|
-
concat_erb( wrap_markup( code_highlighted ), blk.binding )
|
81
|
-
return
|
82
|
-
end
|
83
|
-
|
84
|
-
end # module UvHelper
|
85
|
-
end # module Syntax
|
86
|
-
end # module Slideshow
|
87
|
-
|
88
|
-
class Slideshow::Gen
|
89
|
-
include Slideshow::Syntax::UvHelper
|
90
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
module TextHelper
|
3
|
-
|
4
|
-
def s9_include( name, opts = {} )
|
5
|
-
puts " Including '#{name}'..."
|
6
|
-
content = File.read( name )
|
7
|
-
end
|
8
|
-
|
9
|
-
|
10
|
-
# Usage example:
|
11
|
-
# <%= code 'code/file.rb#section', :lang => 'ruby', :class => 'small' %>
|
12
|
-
# or
|
13
|
-
# <% code :lang => 'ruby' do %>
|
14
|
-
# code goes here
|
15
|
-
# <% end %>
|
16
|
-
#
|
17
|
-
|
18
|
-
def code( *args, &blk )
|
19
|
-
# check for optional hash for options
|
20
|
-
opts = args.last.kind_of?(Hash) ? args.pop : {}
|
21
|
-
|
22
|
-
name_plus_part = args.first # check for optional filename
|
23
|
-
|
24
|
-
if name_plus_part
|
25
|
-
name, part = name_plus_part.split( '#' ) # split off optional part/anchor
|
26
|
-
|
27
|
-
content = find_content_from( name, part )
|
28
|
-
|
29
|
-
# add name and part to opts so engine can use paras too
|
30
|
-
opts[ :name ] = name
|
31
|
-
opts[ :part ] = part if part
|
32
|
-
|
33
|
-
return format_code( content, opts )
|
34
|
-
elsif blk # inline code via block?
|
35
|
-
content = capture_erb(&blk)
|
36
|
-
return if content.empty?
|
37
|
-
|
38
|
-
concat_erb( format_code( content, opts ), blk.binding )
|
39
|
-
return
|
40
|
-
else
|
41
|
-
msg = '*** warning: empty code directive; inline code or file para expected'
|
42
|
-
puts msg
|
43
|
-
return wrap_markup( "<!-- #{msg} -->" )
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def find_content_from( name, part )
|
49
|
-
begin
|
50
|
-
content = File.read( name )
|
51
|
-
|
52
|
-
# note: for now content with no parts selected gets filtered too and (part) marker lines get removed from source
|
53
|
-
lines = find_part_lines_in( content, part )
|
54
|
-
|
55
|
-
if part
|
56
|
-
puts " Including code part '#{part}' in '#{name}' [#{lines.size} lines]..."
|
57
|
-
## todo: issue warning if no lines found?
|
58
|
-
else
|
59
|
-
puts " Including code in '#{name}' [#{lines.size} lines]..."
|
60
|
-
end
|
61
|
-
|
62
|
-
return lines.join
|
63
|
-
rescue Exception => e
|
64
|
-
puts "*** error: reading '#{name}': #{e}"
|
65
|
-
exit 2
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def find_part_lines_in( content, part )
|
70
|
-
result = []
|
71
|
-
state = part.nil? ? :normal : :skipping
|
72
|
-
content.each_line do |line|
|
73
|
-
if line =~ /(START|END):(\w+)/
|
74
|
-
if $2 == part
|
75
|
-
if $1 == "START"
|
76
|
-
state = :normal
|
77
|
-
else
|
78
|
-
state = :skipping
|
79
|
-
end
|
80
|
-
end
|
81
|
-
next
|
82
|
-
end
|
83
|
-
result << line unless state == :skipping
|
84
|
-
end
|
85
|
-
result
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
|
-
def format_code( code, opts )
|
90
|
-
|
91
|
-
engine = opts.fetch( :engine, headers.code_engine ).to_s.downcase
|
92
|
-
|
93
|
-
if engine == 'uv' || engine == 'ultraviolet'
|
94
|
-
if respond_to?( :uv_worker )
|
95
|
-
code_highlighted = uv_worker( code, opts )
|
96
|
-
else
|
97
|
-
puts "** error: ultraviolet gem required for syntax highlighting; install with gem install ultraviolet (or use a different engine)"
|
98
|
-
exit 2
|
99
|
-
end
|
100
|
-
elsif engine == 'cr' || engine == 'coderay'
|
101
|
-
if respond_to?( :coderay_worker )
|
102
|
-
code_highlighted = coderay_worker( code, opts )
|
103
|
-
else
|
104
|
-
puts "*** error: coderay gem required for syntax highlighting; install with gem install coderay (or use a different engine)"
|
105
|
-
exit 2
|
106
|
-
end
|
107
|
-
else
|
108
|
-
method_name = "#{engine}_worker".to_sym
|
109
|
-
if respond_to?( method_name )
|
110
|
-
# try to call custom syntax highlighting engine
|
111
|
-
code_highlighted = send( method_name, code, opts )
|
112
|
-
else
|
113
|
-
msg = "*** error: unkown syntax highlighting engine '#{engine}'; available built-in options include: uv, ultraviolet, cr, coderay"
|
114
|
-
puts msg
|
115
|
-
code_highlighted = "<!-- #{msg} -->"
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
out = %{<!-- begin code#{opts.inspect} -->\n}
|
120
|
-
out << code_highlighted
|
121
|
-
out << %{<!-- end code -->\n}
|
122
|
-
|
123
|
-
guard_block( out ) # saveguard with notextile wrapper etc./no further processing needed
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
end # module TextHelper
|
128
|
-
end # module Slideshow
|
129
|
-
|
130
|
-
Slideshow::Gen.__send__( :include, Slideshow::TextHelper )
|
@@ -1,94 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
|
3
|
-
module ManifestHelper
|
4
|
-
|
5
|
-
## shared methods for handling manifest lookups
|
6
|
-
|
7
|
-
def installed_plugin_manifest_patterns
|
8
|
-
# 1) search ./plugins
|
9
|
-
# 2) search config_dir/plugins
|
10
|
-
|
11
|
-
config_patterns = [
|
12
|
-
"#{config.config_dir}/plugins/*.{txt.plugin,plugin.txt}",
|
13
|
-
"#{config.config_dir}/plugins/*/*.{txt.plugin,plugin.txt}"
|
14
|
-
]
|
15
|
-
current_patterns = [
|
16
|
-
"plugins/*.{txt.plugin,plugin.txt}",
|
17
|
-
"plugins/*/*.{txt.plugin,plugin.txt}"
|
18
|
-
]
|
19
|
-
|
20
|
-
patterns = []
|
21
|
-
patterns += current_patterns
|
22
|
-
patterns += config_patterns
|
23
|
-
end
|
24
|
-
|
25
|
-
def installed_plugin_manifests # quickstarter templates
|
26
|
-
Pakman::Finder.new( logger ).find_manifests( installed_plugin_manifest_patterns )
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
def installed_template_manifest_patterns
|
31
|
-
# 1) search ./templates
|
32
|
-
# 2) search config_dir/templates
|
33
|
-
# 3) search gem/templates
|
34
|
-
|
35
|
-
builtin_patterns = [
|
36
|
-
"#{Slideshow.root}/templates/*.txt"
|
37
|
-
]
|
38
|
-
config_patterns = [
|
39
|
-
"#{config.config_dir}/templates/*.txt",
|
40
|
-
"#{config.config_dir}/templates/*/*.txt"
|
41
|
-
]
|
42
|
-
current_patterns = [
|
43
|
-
"templates/*.txt",
|
44
|
-
"templates/*/*.txt" # todo: use all in one line? {*.txt,*/*.txt} does it work?
|
45
|
-
]
|
46
|
-
|
47
|
-
patterns = []
|
48
|
-
patterns += current_patterns unless Slideshow.root == File.expand_path( '.' ) # don't include working dir if we test code from repo (don't include slideshow/templates)
|
49
|
-
patterns += config_patterns
|
50
|
-
patterns += builtin_patterns
|
51
|
-
end
|
52
|
-
|
53
|
-
def installed_template_manifests
|
54
|
-
## note: code moved to its own gem, that is, pakman
|
55
|
-
## see https://github.com/geraldb/pakman
|
56
|
-
|
57
|
-
## exclude manifest.txt/i (avoid confusion w/ ruby gem manifest; not a specific name anyway)
|
58
|
-
## also exclude patterns for quickstarter templates
|
59
|
-
|
60
|
-
excludes = [
|
61
|
-
'manifest.txt',
|
62
|
-
'*/manifest.txt',
|
63
|
-
'*.{txt.quick,quick.txt}',
|
64
|
-
'*/*.{txt.quick,quick.txt}'
|
65
|
-
]
|
66
|
-
|
67
|
-
Pakman::Finder.new( logger ).find_manifests( installed_template_manifest_patterns, excludes )
|
68
|
-
end
|
69
|
-
|
70
|
-
|
71
|
-
def installed_quick_manifest_patterns
|
72
|
-
# 1) search config_dir/templates
|
73
|
-
# 2) search gem/templates
|
74
|
-
|
75
|
-
builtin_patterns = [
|
76
|
-
"#{Slideshow.root}/templates/*.{txt.quick,quick.txt}"
|
77
|
-
]
|
78
|
-
config_patterns = [
|
79
|
-
"#{config.config_dir}/templates/*.{txt.quick,quick.txt}",
|
80
|
-
"#{config.config_dir}/templates/*/*.{txt.quick,quick.txt}"
|
81
|
-
]
|
82
|
-
|
83
|
-
patterns = []
|
84
|
-
patterns += config_patterns
|
85
|
-
patterns += builtin_patterns
|
86
|
-
end
|
87
|
-
|
88
|
-
def installed_quick_manifests # quickstarter templates
|
89
|
-
Pakman::Finder.new( logger ).find_manifests( installed_quick_manifest_patterns )
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
|
-
end # module Manifest
|
94
|
-
end # module Slideshow
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
module MarkdownEngines
|
3
|
-
|
4
|
-
## note: code moved to its own gem, that is, markdown
|
5
|
-
## see https://github.com/geraldb/markdown
|
6
|
-
|
7
|
-
def markdown_to_html( content )
|
8
|
-
## puts " Converting Markdown-text (#{content.length} bytes) to HTML using library '#{@markdown_libs.first}' calling '#{mn}'..."
|
9
|
-
|
10
|
-
Markdown.new( content ).to_html
|
11
|
-
end
|
12
|
-
|
13
|
-
end # module MarkdownEngines
|
14
|
-
end # module Slideshow
|
15
|
-
|
16
|
-
class Slideshow::Gen
|
17
|
-
include Slideshow::MarkdownEngines
|
18
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Slideshow
|
2
|
-
module MediawikiEngines
|
3
|
-
|
4
|
-
|
5
|
-
def setup_mediawiki_engine
|
6
|
-
return if @mediawiki_engine_setup
|
7
|
-
logger.debug 'require wikicloth -- load mediawiki library'
|
8
|
-
require 'wikicloth' # default mediawiki library
|
9
|
-
@mediawiki_engine_setup = true
|
10
|
-
rescue LoadError
|
11
|
-
puts "You're missing a library required for Mediawiki to Hypertext conversion. Please run:"
|
12
|
-
puts " $ gem install wikicloth"
|
13
|
-
# check: raise exception instead of exit e.g
|
14
|
-
# raise FatalException.new( 'Missing library dependency: wikicloth' )
|
15
|
-
exit 1
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
def mediawiki_to_html( content )
|
20
|
-
|
21
|
-
setup_mediawiki_engine()
|
22
|
-
|
23
|
-
puts " Converting Mediawiki-text (#{content.length} bytes) to HTML..."
|
24
|
-
|
25
|
-
# NB: turn off table_of_contents (TOC) auto-generation with __NOTOC__
|
26
|
-
# NB: turn off adding of edit section/markers for headings (noedit:true)
|
27
|
-
|
28
|
-
wiki = WikiCloth::Parser.new( data: "__NOTOC__\n"+content, params: {} )
|
29
|
-
|
30
|
-
content = wiki.to_html( noedit: true )
|
31
|
-
end
|
32
|
-
|
33
|
-
end # module MediawikiEngines
|
34
|
-
end # module Slideshow
|
35
|
-
|
36
|
-
class Slideshow::Gen
|
37
|
-
include Slideshow::MediawikiEngines
|
38
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'pandoc-ruby'
|
2
|
-
|
3
|
-
module Slideshow
|
4
|
-
module RestEngines # reStructuredText
|
5
|
-
|
6
|
-
def rest_to_html( content )
|
7
|
-
puts " Converting reStructuredText (#{content.length} bytes) to HTML..."
|
8
|
-
|
9
|
-
content = PandocRuby.new( content, :from => :rst, :to => :html ).convert
|
10
|
-
end
|
11
|
-
|
12
|
-
end # module RestEngines
|
13
|
-
end # module Slideshow
|
14
|
-
|
15
|
-
class Slideshow::Gen
|
16
|
-
include Slideshow::RestEngines
|
17
|
-
end
|