slideshow-models 2.5.0 → 3.0.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.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0410851655f8b99345b952432a375cc8061fb22f
4
- data.tar.gz: 4580e4340a62000f9bd0bb196516dd850a5c4c7d
3
+ metadata.gz: 9bff401667556357fa77a5b0053d5f8d33a61f8b
4
+ data.tar.gz: d07a675f210ddc960b4c41d1f772f5a986d3c404
5
5
  SHA512:
6
- metadata.gz: 846cca595221a0dd9298238f2627f89bb381df10d408033eab4f3fdb0b22692693d7631c3879c8305ab7ca0ba97c0d925aceec78200c944764b21baa2e42d3c5
7
- data.tar.gz: b19adf9a7a3e0c1da89087970e565c1c47c6209b560c553a616b62d777cb4a381f1503bbd7bad00cc69d9076f5b2d6274a80dc2245eff31c9fea517c5ae2acd4
6
+ metadata.gz: 4a941abe7d2db3333e82d49e9b8f7b4712a5f3926c2a6049ed186e06614a155366fc8e86d3aa1333cbf50e0c7d83633c8cf306186d9873e516b8ec10a1dc6d01
7
+ data.tar.gz: 34d10b6271177fa5d7fde0d125ead19ceabdd1aa1006296c8dae5c0ca75ca90b76d299e71ebbb25b2c732c6cced66a58b8a0685a4a5e2d25773fbf4d6d3d8db5
data/Manifest.txt CHANGED
@@ -1,37 +1,45 @@
1
- HISTORY.md
2
- Manifest.txt
3
- README.md
4
- Rakefile
5
- config/slideshow.builtin.yml
6
- config/slideshow.index.yml
7
- config/slideshow.yml
8
- lib/slideshow/commands/fetch.rb
9
- lib/slideshow/commands/gen.rb
10
- lib/slideshow/commands/list.rb
11
- lib/slideshow/commands/plugins.rb
12
- lib/slideshow/commands/quick.rb
13
- lib/slideshow/config.rb
14
- lib/slideshow/filters/debug_filter.rb
15
- lib/slideshow/filters/headers_filter.rb
16
- lib/slideshow/filters/slide_filter.rb
17
- lib/slideshow/filters/text_filter.rb
18
- lib/slideshow/headers.rb
19
- lib/slideshow/helpers/background_helper.rb
20
- lib/slideshow/helpers/capture_helper.rb
21
- lib/slideshow/helpers/directive_helper.rb
22
- lib/slideshow/helpers/markdown_helper.rb
23
- lib/slideshow/helpers/source_helper.rb
24
- lib/slideshow/helpers/step_helper.rb
25
- lib/slideshow/helpers/syntax/coderay_helper.rb
26
- lib/slideshow/helpers/syntax/sh_helper.rb
27
- lib/slideshow/helpers/syntax/uv_helper.rb
28
- lib/slideshow/helpers/text_helper.rb
29
- lib/slideshow/manifest_helpers.rb
30
- lib/slideshow/markup/markdown.rb
31
- lib/slideshow/markup/mediawiki.rb
32
- lib/slideshow/markup/rest.rb
33
- lib/slideshow/markup/textile.rb
34
- lib/slideshow/models.rb
35
- lib/slideshow/plugin_helpers.rb
36
- lib/slideshow/slide.rb
37
- lib/slideshow/version.rb
1
+ HISTORY.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ config/slideshow.builtin.yml
6
+ config/slideshow.index.yml
7
+ config/slideshow.yml
8
+ lib/slideshow/commands/fetch.rb
9
+ lib/slideshow/commands/gen.rb
10
+ lib/slideshow/commands/list.rb
11
+ lib/slideshow/commands/plugins.rb
12
+ lib/slideshow/commands/quick.rb
13
+ lib/slideshow/config.rb
14
+ lib/slideshow/drops.rb
15
+ lib/slideshow/filters/debug_filter.rb
16
+ lib/slideshow/filters/headers_filter.rb
17
+ lib/slideshow/filters/slide_filter.rb
18
+ lib/slideshow/filters/text_filter.rb
19
+ lib/slideshow/headers.rb
20
+ lib/slideshow/helpers/background_helper.rb
21
+ lib/slideshow/helpers/capture_helper.rb
22
+ lib/slideshow/helpers/directive_helper.rb
23
+ lib/slideshow/helpers/source_helper.rb
24
+ lib/slideshow/helpers/step_helper.rb
25
+ lib/slideshow/helpers/syntax/coderay_helper.rb
26
+ lib/slideshow/helpers/syntax/sh_helper.rb
27
+ lib/slideshow/helpers/syntax/uv_helper.rb
28
+ lib/slideshow/helpers/text_helper.rb
29
+ lib/slideshow/manifest_helpers.rb
30
+ lib/slideshow/markdown.rb
31
+ lib/slideshow/models.rb
32
+ lib/slideshow/models/deck.rb
33
+ lib/slideshow/models/slide.rb
34
+ lib/slideshow/opts.rb
35
+ lib/slideshow/plugin_helpers.rb
36
+ lib/slideshow/version.rb
37
+ test/helper.rb
38
+ test/samples/test.md
39
+ test/samples/test_content_for.md
40
+ test/templates/test/test.html
41
+ test/templates/test/test.txt
42
+ test/test_gen.rb
43
+ test/test_kramdown.rb
44
+ test/test_slide.rb
45
+ test/test_version.rb
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  * bugs :: [github.com/slideshow-s9/slideshow-models/issues](https://github.com/slideshow-s9/slideshow-models/issues)
5
5
  * gem :: [rubygems.org/gems/slideshow-models](https://rubygems.org/gems/slideshow-models)
6
6
  * rdoc :: [rubydoc.info/gems/slideshow-models](http://rubydoc.info/gems/slideshow-models)
7
- * forum :: [groups.google.com/group/webslideshow](http://groups.google.com/group/webslideshow)
7
+ * forum :: [groups.google.com/group/wwwmake](http://groups.google.com/group/wwwmake)
8
8
 
9
9
  ## USAGE
10
10
 
@@ -19,5 +19,6 @@ Use it as you please with no restrictions whatsoever.
19
19
 
20
20
  ## QUESTION? COMMENTS?
21
21
 
22
- Send them along to the [Free Web Slide Show Alternatives (S5, S6, S9, Slidy And Friends) Forum/Mailing List](http://groups.google.com/group/webslideshow).
22
+ Send them along to the [wwwmake forum/mailing list](http://groups.google.com/group/wwwmake).
23
23
  Thanks!
24
+
data/Rakefile CHANGED
@@ -11,17 +11,15 @@ Hoe.spec 'slideshow-models' do
11
11
  self.urls = ['https://github.com/slideshow-s9/slideshow-models']
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
- self.email = 'webslideshow@googlegroups.com'
14
+ self.email = 'wwwmake@googlegroups.com'
15
15
 
16
16
  self.extra_deps = [
17
17
  ['props', '>= 1.1.2'],
18
18
  ['logutils', '>= 0.6.1'],
19
- ['markdown', '>= 1.2.0'],
19
+ ['kramdown', '>= 1.10.0'],
20
20
  ['textutils', '>= 0.10.0'],
21
- ['pakman', '>= 0.5.0'],
21
+ ['pakman', '>= 0.6.0'],
22
22
  ['activesupport'],
23
- ## ['wikicloth', '>= 0.8.0'] make it a soft dependency # mediawiki markup engine
24
- ## ['RedCloth','>= 4.2.9'] make it a soft dependency # textile markup engine
25
23
  ]
26
24
 
27
25
  # switch extension to .markdown for gihub formatting
data/config/slideshow.yml CHANGED
@@ -45,9 +45,15 @@ analytics:
45
45
 
46
46
 
47
47
  ########################################################3
48
- ### text/markup (textile, markdown) processing config
48
+ ### text/markup/markdown processing config
49
49
 
50
50
  # filters to run before markup processing
51
+
52
+ ##
53
+ # check: use _ or - (can use both?)
54
+ # document here (if auto-converter)
55
+ # note: ruby names CANNOT use dash (-) e.g. must be converted to underscore (_)
56
+
51
57
  filters:
52
58
  - skip-end-directive
53
59
  - directives_bang_style_to_percent_style
@@ -58,19 +64,6 @@ filters:
58
64
  - erb-rename-helper-hack
59
65
  - dump_content_to_file_debug_text_erb
60
66
  - erb
61
- - code-block-curly-style
62
67
  - dump_content_to_file_debug_text
63
68
 
64
69
 
65
- # markup (textile, markdown, rest) config
66
-
67
- textile:
68
- extnames: [ .textile, .t ]
69
-
70
- rest:
71
- extnames: [ .rst, .rest ]
72
-
73
- mediawiki:
74
- extnames: [ .wiki, .mediawiki, .mw ]
75
-
76
- # NB: markdown now configured in markdown.yml (using markdown gem)
@@ -4,16 +4,14 @@ module Slideshow
4
4
 
5
5
  class Fetch
6
6
 
7
- ### fix: remove opts, use config (wrapped!!)
8
7
 
9
8
  include LogUtils::Logging
10
9
 
11
- def initialize( opts, config )
12
- @opts = opts
10
+ def initialize( config )
13
11
  @config = config
14
12
  end
15
13
 
16
- attr_reader :opts, :config
14
+ attr_reader :config
17
15
 
18
16
 
19
17
  def fetch_all
@@ -11,13 +11,11 @@ class Gen ## todo: rename command to build
11
11
 
12
12
  include ManifestHelper
13
13
 
14
- ### fix: remove opts, use config (wrapped!!)
15
14
 
16
- def initialize( opts, config, headers )
17
- @opts = opts
15
+ def initialize( config )
18
16
  @config = config
19
- @headers = headers
20
-
17
+ @headers = Headers.new( config )
18
+
21
19
  ## todo: check if we need to use expand_path - Dir.pwd always absolute (check ~/user etc.)
22
20
  @usrdir = File.expand_path( Dir.pwd ) # save original (current) working directory
23
21
  end
@@ -26,164 +24,41 @@ class Gen ## todo: rename command to build
26
24
  attr_reader :srcdir, :outdir, :pakdir # NB: "initalized" in create_slideshow
27
25
 
28
26
 
29
- attr_reader :opts, :config, :headers
27
+ attr_reader :config, :headers
30
28
  attr_reader :session # give helpers/plugins a session-like hash
31
29
 
32
- attr_reader :markup_type # :textile, :markdown, :mediawiki, :rest
33
-
34
- # uses configured markup processor (textile,markdown,rest,mediawiki) to generate html
35
- def text_to_html( content )
36
- content = case @markup_type
37
- when :markdown
38
- markdown_to_html( content )
39
- when :textile
40
- textile_to_html( content )
41
- when :mediawiki
42
- mediawiki_to_html( content )
43
- when :rest
44
- rest_to_html( content )
45
- end
46
- content
47
- end
48
30
 
49
31
  def guard_text( text )
50
- # todo/fix 2: note for Textile we need to differentiate between blocks and inline
32
+ # todo/fix 2: note we need to differentiate between blocks and inline
51
33
  # thus, to avoid runs - use guard_block (add a leading newline to avoid getting include in block that goes before)
52
34
 
53
35
  # todo/fix: remove wrap_markup; replace w/ guard_text
54
36
  # why: text might be css, js, not just html
55
37
 
38
+ ### !!!!!!!!!!!!
56
39
  ## todo: add print depreciation warning
57
40
 
58
41
  wrap_markup( text )
59
42
  end
60
43
 
61
- def guard_block( text )
62
- if markup_type == :textile
63
- # saveguard with notextile wrapper etc./no further processing needed
64
- # note: add leading newlines to avoid block-runons
65
- "\n\n<notextile>\n#{text}\n</notextile>\n"
66
- elsif markup_type == :markdown
67
- # wrap in newlines to avoid runons
68
- "\n\n#{text}\n\n"
69
- elsif markup_type == :mediawiki
70
- "\n\n<nowiki>\n#{text}\n</nowiki>\n"
71
- else
72
- text
73
- end
44
+ def guard_block( text ) ## use/rename to guard_text_block - why? why not?
45
+ # wrap in newlines to avoid runons
46
+ "\n\n#{text}\n\n"
74
47
  end
75
48
 
76
- def guard_inline( text )
49
+ def guard_inline( text ) ## use/rename to guard_text_inline - why? why not?
77
50
  wrap_markup( text )
78
51
  end
79
-
80
52
 
81
53
  def wrap_markup( text )
82
- if markup_type == :textile
83
- # saveguard with notextile wrapper etc./no further processing needed
84
- "<notextile>\n#{text}\n</notextile>"
85
- else
86
- text
87
- end
88
- end
89
-
90
-
91
- # move into a filter??
92
- def post_processing_slides( content )
93
-
94
- # 1) add slide breaks
95
-
96
- if config.slide? # only allow !SLIDE directives fo slide breaks?
97
- # do nothing (no extra automagic slide breaks wanted)
98
- else
99
- if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest
100
- content = add_slide_directive_before_div_h1( content )
101
- else
102
- if config.header_level == 2
103
- content = add_slide_directive_before_h2( content )
104
- else # assume level 1
105
- content = add_slide_directive_before_h1( content )
106
- end
107
- end
108
- end
109
-
110
-
111
- dump_content_to_file_debug_html( content )
112
-
113
- # 2) use generic slide break processing instruction to
114
- # split content into slides
115
-
116
- slide_counter = 0
117
-
118
- slides = []
119
- slide_buf = ""
120
-
121
- content.each_line do |line|
122
- if line.include?( '<!-- _S9SLIDE_' )
123
- if slide_counter > 0 # found start of new slide (and, thus, end of last slide)
124
- slides << slide_buf # add slide to slide stack
125
- slide_buf = "" # reset slide source buffer
126
- else # slide_counter == 0
127
- # check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)
128
- ## remove html comments and whitspaces (still any content?)
129
- ### more than just whitespace? assume its a slide
130
- if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\n\r\t ]/, '').length > 0
131
- logger.debug "add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0"
132
- slides << slide_buf
133
- slide_buf = ""
134
- else
135
- logger.debug "skipping slide_buf >#{slide_buf}< with slide_counter == 0"
136
- end
137
- end
138
- slide_counter += 1
139
- end
140
- slide_buf << line
141
- end
142
-
143
- if slide_counter > 0
144
- slides << slide_buf # add slide to slide stack
145
- slide_buf = "" # reset slide source buffer
146
- end
147
-
148
-
149
- slides2 = []
150
- slides.each do |source|
151
- slides2 << Slide.new( source, config )
152
- end
153
-
154
-
155
- puts "#{slides2.size} slides found:"
156
-
157
- slides2.each_with_index do |slide,i|
158
- print " [#{i+1}] "
159
- if slide.header.present?
160
- print slide.header
161
- else
162
- # remove html comments
163
- print "-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\n/,'$')[0..40]}"
164
- end
165
- puts
166
- end
167
-
168
-
169
- # make content2 and slide2 available to erb template
170
- # -- todo: cleanup variable names and use attr_readers for content and slide
171
-
172
- ### fix: use class SlideDeck or Deck?? for slides array?
173
-
174
- content2 = ""
175
- slides2.each do |slide|
176
- content2 << slide.to_classic_html
177
- end
178
-
179
- @content = content2
180
- @slides = slides2 # strutured content
54
+ # saveguard with wrapper etc./no further processing needed - check how to do in markdown
55
+ text
181
56
  end
182
57
 
183
58
 
184
59
  def create_slideshow( fn )
185
60
 
186
- manifest_path_or_name = opts.manifest
61
+ manifest_path_or_name = config.manifest
187
62
 
188
63
  # add .txt file extension if missing (for convenience)
189
64
  if manifest_path_or_name.downcase.ends_with?( '.txt' ) == false
@@ -216,7 +91,7 @@ class Gen ## todo: rename command to build
216
91
  manifestsrc = File.expand_path( manifestsrc, usrdir )
217
92
 
218
93
  # expand output path in current dir and make sure output path exists
219
- @outdir = File.expand_path( opts.output_path, usrdir )
94
+ @outdir = File.expand_path( config.output_path, usrdir )
220
95
  logger.debug "setting outdir to >#{outdir}<"
221
96
  FileUtils.makedirs( outdir ) unless File.directory? outdir
222
97
 
@@ -238,16 +113,9 @@ class Gen ## todo: rename command to build
238
113
 
239
114
  puts "Preparing slideshow '#{basename}'..."
240
115
 
241
- if config.known_textile_extnames.include?( extname )
242
- @markup_type = :textile
243
- elsif config.known_rest_extnames.include?( extname )
244
- @markup_type = :rest
245
- elsif config.known_mediawiki_extnames.include?( extname )
246
- @markup_type = :mediawiki
247
- else # default/fallback use markdown
248
- @markup_type = :markdown
249
- end
250
-
116
+ ### todo/fix:
117
+ ## reset headers too - why? why not?
118
+
251
119
  # shared variables for templates (binding)
252
120
  @content_for = {} # reset content_for hash
253
121
 
@@ -266,6 +134,7 @@ class Gen ## todo: rename command to build
266
134
 
267
135
  config.text_filters.each do |filter|
268
136
  mn = filter.tr( '-', '_' ).to_sym # construct method name (mn)
137
+ puts " run filter #{mn}..."
269
138
  content = send( mn, content ) # call filter e.g. include_helper_hack( content )
270
139
  end
271
140
 
@@ -277,20 +146,17 @@ class Gen ## todo: rename command to build
277
146
 
278
147
  # convert light-weight markup to hypertext
279
148
 
280
- content = text_to_html( content )
149
+ content = markdown_to_html( content )
150
+
281
151
 
282
152
  # post-processing
153
+ deck = Deck.new( content, header_level: config.header_level,
154
+ use_slide: config.slide? )
283
155
 
284
- # make content2 and slide2 available to erb template
285
- # -- todo: cleanup variable names and use attr_readers for content and slide
286
-
287
- if @markup_type == :markdown && config.markdown_post_processing?( Markdown.lib ) == false
288
- puts " Skipping post-processing (passing content through as is)..."
289
- @content = content # content all-in-one - make it available in erb templates
290
- else
291
- # sets @content (all-in-one string) and @slides (structured content; split into slides)
292
- post_processing_slides( content )
293
- end
156
+
157
+ ### todo/fix: move merge to its own
158
+ ## class e.g. commands/merge.rb or something
159
+ ## or use Merger - why? why not?
294
160
 
295
161
 
296
162
  #### pak merge
@@ -310,7 +176,37 @@ class Gen ## todo: rename command to build
310
176
 
311
177
  logger.debug( "manifestsrc >#{manifestsrc}<, pakpath >#{pakpath}<" )
312
178
 
313
- Pakman::Templater.new.merge_pak( manifestsrc, pakpath, binding, basename )
179
+ ###########################################
180
+ ## fix: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
181
+ ## todo: setup hash for binding
182
+ ctx = { 'name' => @name,
183
+ 'headers' => HeadersDrop.new( @headers ),
184
+ 'content' => deck.content,
185
+ 'slides' => deck.slides.map { |slide| SlideDrop.new(slide) }, # strutured content - use LiquidDrop - why? why not?
186
+ ## todo/fix: add content_for hash
187
+ ## and some more -- ??
188
+ }
189
+
190
+ ## add content_for entries e.g.
191
+ ## content_for :js => more_content_for_js or content_for_js or extra_js etc.
192
+ ## for now allow all three aliases
193
+
194
+ puts "content_for:"
195
+ pp @content_for
196
+
197
+ @content_for.each do |k,v|
198
+ puts " (auto-)add content_for >#{k.to_s}< to ctx:"
199
+ puts v
200
+ ctx[ "more_content_for_#{k}"] = v
201
+ ctx[ "content_for_#{k}" ] = v
202
+ ctx[ "extra_#{k}" ] = v
203
+ end
204
+
205
+ puts "ctx:"
206
+ pp ctx
207
+
208
+
209
+ Pakman::LiquidTemplater.new.merge_pak( manifestsrc, pakpath, ctx, basename )
314
210
 
315
211
  logger.debug "restoring cwd to src - new >#{srcdir}<, old >#{Dir.pwd}<"
316
212
  Dir.chdir( srcdir )