slideshow-models 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 +171 -0
- data/Manifest.txt +37 -0
- data/README.md +23 -0
- data/Rakefile +37 -0
- data/config/slideshow.builtin.yml +8 -0
- data/config/slideshow.index.yml +69 -0
- data/config/slideshow.yml +76 -0
- data/lib/slideshow/commands/fetch.rb +123 -0
- data/lib/slideshow/commands/gen.rb +330 -0
- data/lib/slideshow/commands/list.rb +72 -0
- data/lib/slideshow/commands/plugins.rb +46 -0
- data/lib/slideshow/commands/quick.rb +88 -0
- data/lib/slideshow/config.rb +243 -0
- data/lib/slideshow/filters/debug_filter.rb +75 -0
- data/lib/slideshow/filters/headers_filter.rb +46 -0
- data/lib/slideshow/filters/slide_filter.rb +114 -0
- data/lib/slideshow/filters/text_filter.rb +140 -0
- data/lib/slideshow/headers.rb +89 -0
- data/lib/slideshow/helpers/background_helper.rb +151 -0
- data/lib/slideshow/helpers/capture_helper.rb +138 -0
- data/lib/slideshow/helpers/directive_helper.rb +45 -0
- data/lib/slideshow/helpers/markdown_helper.rb +20 -0
- data/lib/slideshow/helpers/source_helper.rb +41 -0
- data/lib/slideshow/helpers/step_helper.rb +35 -0
- data/lib/slideshow/helpers/syntax/coderay_helper.rb +86 -0
- data/lib/slideshow/helpers/syntax/sh_helper.rb +63 -0
- data/lib/slideshow/helpers/syntax/uv_helper.rb +92 -0
- data/lib/slideshow/helpers/text_helper.rb +132 -0
- data/lib/slideshow/manifest_helpers.rb +99 -0
- data/lib/slideshow/markup/markdown.rb +20 -0
- data/lib/slideshow/markup/mediawiki.rb +40 -0
- data/lib/slideshow/markup/rest.rb +19 -0
- data/lib/slideshow/markup/textile.rb +70 -0
- data/lib/slideshow/models.rb +98 -0
- data/lib/slideshow/plugin_helpers.rb +64 -0
- data/lib/slideshow/slide.rb +120 -0
- data/lib/slideshow/version.rb +28 -0
- metadata +197 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Slideshow
|
4
|
+
|
5
|
+
module PluginHelper
|
6
|
+
|
7
|
+
def find_plugin_patterns
|
8
|
+
patterns = []
|
9
|
+
|
10
|
+
###
|
11
|
+
# todo/fix: only include rb files listed in plugin manifests!
|
12
|
+
# - for now load all ruby files in plugins folder
|
13
|
+
|
14
|
+
patterns << "#{config.config_dir}/plugins/**/*.rb"
|
15
|
+
|
16
|
+
######
|
17
|
+
# also allow "ad-hoc" plugins e.g. no manifest required (not installed)
|
18
|
+
# just ruby scripts in lib in config folder or working folder
|
19
|
+
|
20
|
+
patterns << "#{config.config_dir}/lib/**/*.rb"
|
21
|
+
|
22
|
+
#########
|
23
|
+
# todo/fix: only include rb files listed in plugin manifest (see above!)
|
24
|
+
|
25
|
+
patterns << 'plugins/**/*.rb'
|
26
|
+
|
27
|
+
patterns << 'lib/**/*.rb' unless Slideshow.root == File.expand_path( '.' ) # don't include lib if we are in repo (don't include slideshow/lib)
|
28
|
+
patterns
|
29
|
+
end
|
30
|
+
|
31
|
+
def find_plugins
|
32
|
+
patterns = find_plugin_patterns
|
33
|
+
|
34
|
+
plugins=[]
|
35
|
+
patterns.each do |pattern|
|
36
|
+
pattern.gsub!( '\\', '/') # normalize path; make sure all path use / only
|
37
|
+
Dir.glob( pattern ) do |plugin|
|
38
|
+
plugins << plugin
|
39
|
+
end
|
40
|
+
end
|
41
|
+
plugins
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_plugins
|
45
|
+
patterns = find_plugin_patterns
|
46
|
+
|
47
|
+
patterns.each do |pattern|
|
48
|
+
pattern.gsub!( '\\', '/') # normalize path; make sure all path use / only
|
49
|
+
Dir.glob( pattern ) do |plugin|
|
50
|
+
begin
|
51
|
+
## NB: use full_path - since Ruby 1.9.2 - ./ no longer included in load path for security
|
52
|
+
plugin_fullpath = File.expand_path( plugin ) # nb: will use Dir.pwd (e.g. ./) as second arg
|
53
|
+
puts "Loading plugins in '#{plugin}' (#{plugin_fullpath})..."
|
54
|
+
require( plugin_fullpath )
|
55
|
+
rescue Exception => e
|
56
|
+
puts "** error: failed loading plugins in '#{plugin}': #{e}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end # method load_plugins
|
61
|
+
|
62
|
+
|
63
|
+
end # module PluginHelper
|
64
|
+
end # module Slideshow
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Slideshow
|
4
|
+
|
5
|
+
class Slide
|
6
|
+
|
7
|
+
attr_accessor :logger
|
8
|
+
|
9
|
+
# NB: unparsed html source (use content_without_header
|
10
|
+
# for content without option header)
|
11
|
+
|
12
|
+
attr_accessor :content
|
13
|
+
attr_accessor :content_without_header
|
14
|
+
attr_accessor :header
|
15
|
+
attr_accessor :classes
|
16
|
+
|
17
|
+
def initialize( content, options )
|
18
|
+
@logger = options.logger
|
19
|
+
@header_level = options.header_level
|
20
|
+
|
21
|
+
@content = content
|
22
|
+
|
23
|
+
@header = nil
|
24
|
+
@content_without_header = nil
|
25
|
+
@classes = nil # NB: style classes as all in one string
|
26
|
+
@data = {}
|
27
|
+
|
28
|
+
parse()
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse
|
32
|
+
## pass 1) check for (css style) classes and data attributes
|
33
|
+
## check for css style classes
|
34
|
+
from = 0
|
35
|
+
while( pos = @content.index( /<!-- _S9(SLIDE|STYLE)_(.*?)-->/m, from ))
|
36
|
+
logger.debug " adding css classes from pi >#{$1.downcase}<: >#{$2.strip}<"
|
37
|
+
|
38
|
+
from = Regexp.last_match.end(0) # continue search later from here
|
39
|
+
|
40
|
+
values = $2.strip.dup
|
41
|
+
|
42
|
+
# remove data values (eg. x=-20 scale=4) and store in data hash
|
43
|
+
values.gsub!( /([-\w]+)[ \t]*=[ \t]*([-\w\.]+)/ ) do |_|
|
44
|
+
logger.debug " adding data pair: key=>#{$1.downcase}< value=>#{$2}<"
|
45
|
+
@data[ $1.downcase.dup ] = $2.dup
|
46
|
+
" " # replace w/ space
|
47
|
+
end
|
48
|
+
|
49
|
+
values.strip! # remove spaces # todo: use squish or similar and check for empty string
|
50
|
+
|
51
|
+
if @classes.nil?
|
52
|
+
@classes = values
|
53
|
+
else
|
54
|
+
@classes << " #{values}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
## pass 2) split slide source into header (optional) and content/body
|
59
|
+
|
60
|
+
## todo: add option split on h1/h2 etc.
|
61
|
+
|
62
|
+
# try to extract first header using non-greedy .+? pattern;
|
63
|
+
# tip test regex online at rubular.com
|
64
|
+
# note/fix: needs to get improved to also handle case for h1 wrapped into div
|
65
|
+
|
66
|
+
if @header_level == 2
|
67
|
+
pattern = /^(.*?)(<h2.*?>.*?<\/h2>)(.*)/m
|
68
|
+
else # assume header level 1
|
69
|
+
pattern = /^(.*?)(<h1.*?>.*?<\/h1>)(.*)/m
|
70
|
+
end
|
71
|
+
|
72
|
+
if @content =~ pattern
|
73
|
+
@header = $2
|
74
|
+
@content_without_header = ($1 ? $1 : '') + ($3 ? $3 : '')
|
75
|
+
logger.debug " adding slide with header (h1):\n#{@header}"
|
76
|
+
else
|
77
|
+
@header = nil # todo: set to '' empty string? why not?
|
78
|
+
@content_without_header = @content
|
79
|
+
logger.debug " adding slide with *no* header:\n#{@content}"
|
80
|
+
end
|
81
|
+
end # method parse
|
82
|
+
|
83
|
+
|
84
|
+
def data_attributes
|
85
|
+
buf = ""
|
86
|
+
@data.each do | key,value |
|
87
|
+
buf << "data-#{key}='#{value}' "
|
88
|
+
end
|
89
|
+
buf
|
90
|
+
end
|
91
|
+
|
92
|
+
################################
|
93
|
+
#### convenience helpers
|
94
|
+
|
95
|
+
def to_classic_html
|
96
|
+
buf = ""
|
97
|
+
buf << "<div class='slide "
|
98
|
+
buf << classes if classes
|
99
|
+
buf << "'>\n"
|
100
|
+
buf << content
|
101
|
+
buf << "</div>\n"
|
102
|
+
buf
|
103
|
+
end
|
104
|
+
|
105
|
+
def to_google_html5
|
106
|
+
buf = ""
|
107
|
+
buf << "<div class='slide'>\n"
|
108
|
+
buf << "<header>#{header}</header>\n" if header
|
109
|
+
buf << "<section "
|
110
|
+
buf << "class='#{classes}'" if classes
|
111
|
+
buf << "'>\n"
|
112
|
+
buf << content_without_header if content_without_header
|
113
|
+
buf << "</section>\n"
|
114
|
+
buf << "</div>\n"
|
115
|
+
buf
|
116
|
+
end
|
117
|
+
|
118
|
+
end # class Slide
|
119
|
+
|
120
|
+
end # module Slideshow
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Slideshow
|
4
|
+
|
5
|
+
MAJOR = 2
|
6
|
+
MINOR = 4
|
7
|
+
PATCH = 0
|
8
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
9
|
+
|
10
|
+
def self.version
|
11
|
+
VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.root
|
15
|
+
"#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# version string for generator meta tag (includes ruby version)
|
19
|
+
def self.generator
|
20
|
+
"Slide Show (S9) v#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.banner
|
24
|
+
"slideshow-models/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
25
|
+
end
|
26
|
+
|
27
|
+
end # module Slideshow
|
28
|
+
|
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slideshow-models
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: props
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: logutils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.6.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: markdown
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.2.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.2.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: textutils
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.10.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.10.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pakman
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rdoc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hoe
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.13'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.13'
|
125
|
+
description: slideshow-models - slide show (S9) models 'n' machinery for easy (re)use
|
126
|
+
email: webslideshow@googlegroups.com
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files:
|
130
|
+
- HISTORY.md
|
131
|
+
- Manifest.txt
|
132
|
+
- README.md
|
133
|
+
files:
|
134
|
+
- HISTORY.md
|
135
|
+
- Manifest.txt
|
136
|
+
- README.md
|
137
|
+
- Rakefile
|
138
|
+
- config/slideshow.builtin.yml
|
139
|
+
- config/slideshow.index.yml
|
140
|
+
- config/slideshow.yml
|
141
|
+
- lib/slideshow/commands/fetch.rb
|
142
|
+
- lib/slideshow/commands/gen.rb
|
143
|
+
- lib/slideshow/commands/list.rb
|
144
|
+
- lib/slideshow/commands/plugins.rb
|
145
|
+
- lib/slideshow/commands/quick.rb
|
146
|
+
- lib/slideshow/config.rb
|
147
|
+
- lib/slideshow/filters/debug_filter.rb
|
148
|
+
- lib/slideshow/filters/headers_filter.rb
|
149
|
+
- lib/slideshow/filters/slide_filter.rb
|
150
|
+
- lib/slideshow/filters/text_filter.rb
|
151
|
+
- lib/slideshow/headers.rb
|
152
|
+
- lib/slideshow/helpers/background_helper.rb
|
153
|
+
- lib/slideshow/helpers/capture_helper.rb
|
154
|
+
- lib/slideshow/helpers/directive_helper.rb
|
155
|
+
- lib/slideshow/helpers/markdown_helper.rb
|
156
|
+
- lib/slideshow/helpers/source_helper.rb
|
157
|
+
- lib/slideshow/helpers/step_helper.rb
|
158
|
+
- lib/slideshow/helpers/syntax/coderay_helper.rb
|
159
|
+
- lib/slideshow/helpers/syntax/sh_helper.rb
|
160
|
+
- lib/slideshow/helpers/syntax/uv_helper.rb
|
161
|
+
- lib/slideshow/helpers/text_helper.rb
|
162
|
+
- lib/slideshow/manifest_helpers.rb
|
163
|
+
- lib/slideshow/markup/markdown.rb
|
164
|
+
- lib/slideshow/markup/mediawiki.rb
|
165
|
+
- lib/slideshow/markup/rest.rb
|
166
|
+
- lib/slideshow/markup/textile.rb
|
167
|
+
- lib/slideshow/models.rb
|
168
|
+
- lib/slideshow/plugin_helpers.rb
|
169
|
+
- lib/slideshow/slide.rb
|
170
|
+
- lib/slideshow/version.rb
|
171
|
+
homepage: https://github.com/slideshow-s9/slideshow-models
|
172
|
+
licenses:
|
173
|
+
- Public Domain
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options:
|
177
|
+
- "--main"
|
178
|
+
- README.md
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 1.9.2
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
requirements: []
|
192
|
+
rubyforge_project:
|
193
|
+
rubygems_version: 2.4.2
|
194
|
+
signing_key:
|
195
|
+
specification_version: 4
|
196
|
+
summary: slideshow-models - slide show (S9) models 'n' machinery for easy (re)use
|
197
|
+
test_files: []
|