slideshow-models 2.5.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +45 -37
  3. data/README.md +3 -2
  4. data/Rakefile +3 -5
  5. data/config/slideshow.yml +7 -14
  6. data/lib/slideshow/commands/fetch.rb +2 -4
  7. data/lib/slideshow/commands/gen.rb +57 -161
  8. data/lib/slideshow/commands/list.rb +2 -4
  9. data/lib/slideshow/commands/plugins.rb +2 -4
  10. data/lib/slideshow/commands/quick.rb +5 -8
  11. data/lib/slideshow/config.rb +11 -50
  12. data/lib/slideshow/drops.rb +35 -0
  13. data/lib/slideshow/filters/debug_filter.rb +3 -3
  14. data/lib/slideshow/filters/slide_filter.rb +1 -67
  15. data/lib/slideshow/filters/text_filter.rb +1 -18
  16. data/lib/slideshow/helpers/background_helper.rb +1 -0
  17. data/lib/slideshow/helpers/step_helper.rb +1 -1
  18. data/lib/slideshow/manifest_helpers.rb +4 -0
  19. data/lib/slideshow/markdown.rb +27 -0
  20. data/lib/slideshow/models.rb +9 -13
  21. data/lib/slideshow/models/deck.rb +188 -0
  22. data/lib/slideshow/{slide.rb → models/slide.rb} +9 -4
  23. data/lib/slideshow/opts.rb +117 -0
  24. data/lib/slideshow/version.rb +2 -2
  25. data/test/helper.rb +9 -0
  26. data/test/samples/test.md +29 -0
  27. data/test/samples/test_content_for.md +25 -0
  28. data/test/templates/test/test.html +52 -0
  29. data/test/templates/test/test.txt +5 -0
  30. data/test/test_gen.rb +54 -0
  31. data/test/test_kramdown.rb +67 -0
  32. data/test/test_slide.rb +44 -0
  33. data/test/test_version.rb +29 -0
  34. metadata +25 -17
  35. data/lib/slideshow/helpers/markdown_helper.rb +0 -20
  36. data/lib/slideshow/markup/markdown.rb +0 -20
  37. data/lib/slideshow/markup/mediawiki.rb +0 -40
  38. data/lib/slideshow/markup/rest.rb +0 -19
  39. data/lib/slideshow/markup/textile.rb +0 -70
@@ -0,0 +1,5 @@
1
+ ######
2
+ # simple test manifest
3
+
4
+ __file__.html test.html
5
+
data/test/test_gen.rb ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_gen.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestGen < MiniTest::Test
12
+
13
+ def test_gen_test
14
+
15
+ opts = Slideshow::Opts.new
16
+
17
+ opts.test = true # (auto-)includes templates from /test/templates
18
+ opts.verbose = true # turn on (verbose) debug output
19
+ opts.manifest = 'test'
20
+ opts.output_path = "#{Slideshow.root}/tmp/#{Time.now.to_i}"
21
+
22
+ config = Slideshow::Config.new( opts )
23
+ config.load
24
+ config.dump
25
+
26
+ g = Slideshow::Gen.new( config )
27
+ g.create_slideshow( "#{Slideshow.root}/test/samples/test.md" )
28
+
29
+ assert true
30
+ end # method test_gen
31
+
32
+
33
+ def test_gen_test_content_for
34
+
35
+ opts = Slideshow::Opts.new
36
+
37
+ opts.test = true # (auto-)includes templates from /test/templates
38
+ opts.verbose = true # turn on (verbose) debug output
39
+ opts.manifest = 'test'
40
+ opts.output_path = "#{Slideshow.root}/tmp/#{Time.now.to_i}"
41
+
42
+ config = Slideshow::Config.new( opts )
43
+ config.load
44
+ config.dump
45
+
46
+ g = Slideshow::Gen.new( config )
47
+ g.create_slideshow( "#{Slideshow.root}/test/samples/test_content_for.md" )
48
+
49
+ assert true
50
+ end # method test_gen
51
+
52
+
53
+ end # class TestGen
54
+
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_kramdown.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestKramdown < MiniTest::Test
12
+
13
+ def test_to_html
14
+
15
+ config = {
16
+ 'input' => 'GFM',
17
+ 'hard_wrap' => false
18
+ }
19
+
20
+ content =<<EOS
21
+ # Heading 1
22
+
23
+ some text with `code` and some more text
24
+ and some more text
25
+
26
+ ```
27
+ a code block
28
+ ```
29
+
30
+ some more text
31
+ EOS
32
+
33
+ html = Kramdown::Document.new(content, config).to_html
34
+ pp html
35
+ assert true
36
+ end # method test_to_html
37
+
38
+
39
+ def test_rouge
40
+
41
+ config = {
42
+ 'input' => 'GFM',
43
+ 'hard_wrap' => false,
44
+ 'syntax_highlighter' => 'rouge'
45
+ }
46
+
47
+ content =<<EOS
48
+ # Heading 1
49
+
50
+ some text with `code` and some more text
51
+ and some more text
52
+
53
+ ```ruby
54
+ puts 'Hello, World!'
55
+ ```
56
+
57
+ some more text
58
+ EOS
59
+
60
+ html = Kramdown::Document.new(content, config).to_html
61
+ pp html
62
+ assert true
63
+ end # method test_rouge
64
+
65
+
66
+ end # class TestKramdown
67
+
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_slide.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestSlide < MiniTest::Test
12
+
13
+ def test_slide1
14
+
15
+
16
+ content =<<EOS
17
+ <h1 id="test-header-1">test header 1</h1>
18
+
19
+ <p>test content 1</p>
20
+ EOS
21
+
22
+ slide = Slideshow::Slide.new( content, header_level: 1 )
23
+
24
+ puts "header:"
25
+ pp slide.header
26
+ puts "content:"
27
+ pp slide.content
28
+ puts "content_without_header:"
29
+ pp slide.content_without_header
30
+ puts "classes:"
31
+ pp slide.classes
32
+ puts "data_attributes:"
33
+ pp slide.data_attributes
34
+
35
+ assert_equal %Q{<h1 id="test-header-1">test header 1</h1>}, slide.header
36
+ assert_equal content, slide.content
37
+ assert_equal nil, slide.classes
38
+ assert_equal nil, slide.data_attributes
39
+
40
+ end # method test_slide
41
+
42
+
43
+ end # class TestSlide
44
+
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_version.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestVersion < MiniTest::Test
12
+
13
+ def test_version
14
+
15
+ puts "version:"
16
+ puts Slideshow.version
17
+ puts "root:"
18
+ puts Slideshow.root
19
+ puts "generator:"
20
+ puts Slideshow.generator
21
+ puts "banner:"
22
+ puts Slideshow.banner
23
+
24
+ assert true
25
+ end # method test_version
26
+
27
+
28
+ end # class TestVersion
29
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slideshow-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2016-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: props
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.6.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: markdown
42
+ name: kramdown
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2.0
47
+ version: 1.10.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.0
54
+ version: 1.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: textutils
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: activesupport
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,16 +114,16 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.13'
117
+ version: '3.14'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.13'
124
+ version: '3.14'
125
125
  description: slideshow-models - slide show (S9) models 'n' machinery for easy (re)use
126
- email: webslideshow@googlegroups.com
126
+ email: wwwmake@googlegroups.com
127
127
  executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files:
@@ -144,6 +144,7 @@ files:
144
144
  - lib/slideshow/commands/plugins.rb
145
145
  - lib/slideshow/commands/quick.rb
146
146
  - lib/slideshow/config.rb
147
+ - lib/slideshow/drops.rb
147
148
  - lib/slideshow/filters/debug_filter.rb
148
149
  - lib/slideshow/filters/headers_filter.rb
149
150
  - lib/slideshow/filters/slide_filter.rb
@@ -152,7 +153,6 @@ files:
152
153
  - lib/slideshow/helpers/background_helper.rb
153
154
  - lib/slideshow/helpers/capture_helper.rb
154
155
  - lib/slideshow/helpers/directive_helper.rb
155
- - lib/slideshow/helpers/markdown_helper.rb
156
156
  - lib/slideshow/helpers/source_helper.rb
157
157
  - lib/slideshow/helpers/step_helper.rb
158
158
  - lib/slideshow/helpers/syntax/coderay_helper.rb
@@ -160,14 +160,22 @@ files:
160
160
  - lib/slideshow/helpers/syntax/uv_helper.rb
161
161
  - lib/slideshow/helpers/text_helper.rb
162
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
163
+ - lib/slideshow/markdown.rb
167
164
  - lib/slideshow/models.rb
165
+ - lib/slideshow/models/deck.rb
166
+ - lib/slideshow/models/slide.rb
167
+ - lib/slideshow/opts.rb
168
168
  - lib/slideshow/plugin_helpers.rb
169
- - lib/slideshow/slide.rb
170
169
  - lib/slideshow/version.rb
170
+ - test/helper.rb
171
+ - test/samples/test.md
172
+ - test/samples/test_content_for.md
173
+ - test/templates/test/test.html
174
+ - test/templates/test/test.txt
175
+ - test/test_gen.rb
176
+ - test/test_kramdown.rb
177
+ - test/test_slide.rb
178
+ - test/test_version.rb
171
179
  homepage: https://github.com/slideshow-s9/slideshow-models
172
180
  licenses:
173
181
  - Public Domain
@@ -190,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
198
  version: '0'
191
199
  requirements: []
192
200
  rubyforge_project:
193
- rubygems_version: 2.4.2
201
+ rubygems_version: 2.2.3
194
202
  signing_key:
195
203
  specification_version: 4
196
204
  summary: slideshow-models - slide show (S9) models 'n' machinery for easy (re)use
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Slideshow
4
- module MarkdownHelper
5
-
6
- def s9_class( clazz )
7
- "{: .#{clazz.strip}}"
8
- end
9
-
10
- def clear
11
- "{: .clear}"
12
- end
13
-
14
-
15
- end # module MarkdownHelper
16
- end # module Slideshow
17
-
18
- class Slideshow::Gen
19
- include Slideshow::MarkdownHelper
20
- end
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Slideshow
4
- module MarkdownEngines
5
-
6
- ## note: code moved to its own gem, that is, markdown
7
- ## see https://github.com/geraldb/markdown
8
-
9
- def markdown_to_html( content )
10
- ## puts " Converting Markdown-text (#{content.length} bytes) to HTML using library '#{@markdown_libs.first}' calling '#{mn}'..."
11
-
12
- Markdown.new( content ).to_html
13
- end
14
-
15
- end # module MarkdownEngines
16
- end # module Slideshow
17
-
18
- class Slideshow::Gen
19
- include Slideshow::MarkdownEngines
20
- end
@@ -1,40 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Slideshow
4
- module MediawikiEngines
5
-
6
-
7
- def setup_mediawiki_engine
8
- return if @mediawiki_engine_setup
9
- logger.debug 'require wikicloth -- load mediawiki library'
10
- require 'wikicloth' # default mediawiki library
11
- @mediawiki_engine_setup = true
12
- rescue LoadError
13
- puts "You're missing a library required for Mediawiki to Hypertext conversion. Please run:"
14
- puts " $ gem install wikicloth"
15
- # check: raise exception instead of exit e.g
16
- # raise FatalException.new( 'Missing library dependency: wikicloth' )
17
- exit 1
18
- end
19
-
20
-
21
- def mediawiki_to_html( content )
22
-
23
- setup_mediawiki_engine()
24
-
25
- puts " Converting Mediawiki-text (#{content.length} bytes) to HTML..."
26
-
27
- # NB: turn off table_of_contents (TOC) auto-generation with __NOTOC__
28
- # NB: turn off adding of edit section/markers for headings (noedit:true)
29
-
30
- wiki = WikiCloth::Parser.new( data: "__NOTOC__\n"+content, params: {} )
31
-
32
- content = wiki.to_html( noedit: true )
33
- end
34
-
35
- end # module MediawikiEngines
36
- end # module Slideshow
37
-
38
- class Slideshow::Gen
39
- include Slideshow::MediawikiEngines
40
- end
@@ -1,19 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'pandoc-ruby'
4
-
5
- module Slideshow
6
- module RestEngines # reStructuredText
7
-
8
- def rest_to_html( content )
9
- puts " Converting reStructuredText (#{content.length} bytes) to HTML..."
10
-
11
- content = PandocRuby.new( content, :from => :rst, :to => :html ).convert
12
- end
13
-
14
- end # module RestEngines
15
- end # module Slideshow
16
-
17
- class Slideshow::Gen
18
- include Slideshow::RestEngines
19
- end
@@ -1,70 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Slideshow
4
- module TextileEngines
5
-
6
- def redcloth_java_fix_escape_nonascii( txt )
7
- txt.chars.map{ |x| x.size > 1 ? "&##{x.unpack("U*")};" : x }.join
8
- end
9
-
10
- def redcloth_java_fix_escape_nonascii_exclude_pre( txt )
11
-
12
- buf = ""
13
- from = 0
14
-
15
- while (pos = txt.index( /<pre.*?>.*?<\/pre>/m, from ))
16
- # add text before pre block escaped
17
- buf << redcloth_java_fix_escape_nonascii( txt[ from, pos-from] )
18
-
19
- # add pre block unescaped (otherwise html entities get escaped twice)
20
- from = Regexp.last_match.end(0)
21
- buf << txt[pos, from-pos]
22
- end
23
- buf << redcloth_java_fix_escape_nonascii( txt[from, txt.length-from] )
24
-
25
- buf
26
- end
27
-
28
-
29
- def setup_textile_engine
30
- return if @textile_engine_setup
31
- logger.debug 'require redcloth -- load textile library'
32
- require 'redcloth' # default textile library
33
- @textile_engine_setup = true
34
- rescue LoadError
35
- puts "You're missing a library required for Textile to Hypertext conversion. Please run:"
36
- puts " $ gem install RedCloth"
37
- # check: raise exception instead of exit e.g
38
- # raise FatalException.new( 'Missing library dependency: RedCloth' )
39
- exit 1
40
- end
41
-
42
-
43
- def textile_to_html( content )
44
-
45
- setup_textile_engine() # optinal lib; extra; load only textile lib if used (soft dependency)
46
-
47
- puts " Converting Textile-text (#{content.length} bytes) to HTML..."
48
-
49
- # JRuby workaround for RedCloth 4 multi-byte character bug
50
- # see http://jgarber.lighthouseapp.com/projects/13054/tickets/149-redcloth-4-doesnt-support-multi-bytes-content
51
- # basically convert non-ascii chars (>127) to html entities
52
-
53
- if RedCloth::EXTENSION_LANGUAGE == "Java"
54
- puts " Patching RedCloth for Java; converting non-Ascii/multi-byte chars to HTML-entities..."
55
- content = redcloth_java_fix_escape_nonascii_exclude_pre( content )
56
- end
57
-
58
- # turn off hard line breaks
59
- # turn off span caps (see http://rubybook.ca/2008/08/16/redcloth)
60
- red = RedCloth.new( content, [:no_span_caps] )
61
- red.hard_breaks = false
62
- content = red.to_html
63
- end
64
-
65
- end # module TextileEngines
66
- end # module Slideshow
67
-
68
- class Slideshow::Gen
69
- include Slideshow::TextileEngines
70
- end