slideshow 0.9.1 → 0.9.2

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 (37) hide show
  1. data/History.rdoc +9 -0
  2. data/Manifest.txt +11 -9
  3. data/config/slideshow.builtin.yml +11 -3
  4. data/config/slideshow.yml +6 -0
  5. data/lib/slideshow.rb +11 -3
  6. data/lib/slideshow/config.rb +19 -4
  7. data/lib/slideshow/filters/debug_filter.rb +44 -0
  8. data/lib/slideshow/filters/headers_filter.rb +4 -3
  9. data/lib/slideshow/filters/text_filter.rb +218 -43
  10. data/lib/slideshow/gen.rb +35 -25
  11. data/lib/slideshow/helpers/analytics_helper.rb +7 -4
  12. data/lib/slideshow/helpers/background_helper.rb +91 -0
  13. data/lib/slideshow/helpers/capture_helper.rb +4 -2
  14. data/lib/slideshow/helpers/directive_helper.rb +42 -0
  15. data/lib/slideshow/helpers/markdown_helper.rb +18 -0
  16. data/lib/slideshow/helpers/source_helper.rb +39 -0
  17. data/lib/slideshow/helpers/step_helper.rb +6 -4
  18. data/lib/slideshow/helpers/{coderay_helper.rb → syntax/coderay_helper.rb} +9 -3
  19. data/lib/slideshow/helpers/syntax/sh_helper.rb +48 -0
  20. data/lib/slideshow/helpers/{uv_helper.rb → syntax/uv_helper.rb} +9 -4
  21. data/lib/slideshow/helpers/table_helper.rb +8 -6
  22. data/lib/slideshow/helpers/text_helper.rb +7 -5
  23. data/lib/slideshow/markdown.rb +4 -2
  24. data/lib/slideshow/opts.rb +1 -1
  25. data/lib/slideshow/textile.rb +5 -4
  26. data/templates/s6.txt +15 -5
  27. data/templates/s6.txt.gen +6 -5
  28. data/templates/s6/slides.css +0 -3
  29. data/templates/{s6/header.html.erb → slides.html.erb} +33 -23
  30. data/templates/{s6/header.pdf.html.erb → slides.pdf.html.erb} +10 -1
  31. data/templates/style.css.erb +35 -0
  32. metadata +15 -13
  33. data/templates/gradient.svg.erb +0 -59
  34. data/templates/s6.txt.sample +0 -16
  35. data/templates/s6/footer.html.erb +0 -4
  36. data/templates/s6/footer.pdf.html.erb +0 -3
  37. data/templates/s6/style.css.erb +0 -33
data/History.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.9.2 / 2010-07-11
2
+
3
+ * Change default template pack from s6gradients to s6blank
4
+ * Added syntax highlighting helper (sh) for SyntaxHighlighter JavaScript Library
5
+ * Added gradient and background helper
6
+ * Added simplified parameters for Django-style expressions and statements
7
+ * Added support for %-directives (e.g. %helper, %css, %yourown, etc)
8
+ * Minor fixes
9
+
1
10
  === 0.9 / 2010-07-04
2
11
 
3
12
  * Added support for !SLIDE (and alternative syntax %slide)
data/Manifest.txt CHANGED
@@ -7,32 +7,34 @@ config/slideshow.builtin.yml
7
7
  config/slideshow.yml
8
8
  lib/slideshow.rb
9
9
  lib/slideshow/config.rb
10
+ lib/slideshow/filters/debug_filter.rb
10
11
  lib/slideshow/filters/headers_filter.rb
11
12
  lib/slideshow/filters/text_filter.rb
12
13
  lib/slideshow/gen.rb
13
14
  lib/slideshow/helpers/analytics_helper.rb
15
+ lib/slideshow/helpers/background_helper.rb
14
16
  lib/slideshow/helpers/capture_helper.rb
15
- lib/slideshow/helpers/coderay_helper.rb
17
+ lib/slideshow/helpers/directive_helper.rb
18
+ lib/slideshow/helpers/markdown_helper.rb
19
+ lib/slideshow/helpers/source_helper.rb
16
20
  lib/slideshow/helpers/step_helper.rb
21
+ lib/slideshow/helpers/syntax/coderay_helper.rb
22
+ lib/slideshow/helpers/syntax/sh_helper.rb
23
+ lib/slideshow/helpers/syntax/uv_helper.rb
17
24
  lib/slideshow/helpers/table_helper.rb
18
25
  lib/slideshow/helpers/text_helper.rb
19
- lib/slideshow/helpers/uv_helper.rb
20
26
  lib/slideshow/markdown.rb
21
27
  lib/slideshow/opts.rb
22
28
  lib/slideshow/slide.rb
23
29
  lib/slideshow/textile.rb
24
- templates/gradient.svg.erb
25
30
  templates/s6.txt
26
31
  templates/s6.txt.gen
27
- templates/s6.txt.sample
28
- templates/s6/footer.html.erb
29
- templates/s6/footer.pdf.html.erb
30
- templates/s6/header.html.erb
31
- templates/s6/header.pdf.html.erb
32
32
  templates/s6/jquery.js
33
33
  templates/s6/outline.css
34
34
  templates/s6/print.css
35
35
  templates/s6/slides.core.js
36
36
  templates/s6/slides.css
37
37
  templates/s6/slides.js
38
- templates/s6/style.css.erb
38
+ templates/slides.html.erb
39
+ templates/slides.pdf.html.erb
40
+ templates/style.css.erb
@@ -6,16 +6,24 @@
6
6
  # libs: [ whatever ]
7
7
 
8
8
 
9
- # text filters
9
+ helper:
10
+ unparsed: [ slide, style ]
11
+ renames: [ include, class ]
12
+ exprs: [ class, clear ]
10
13
 
14
+ # text filters
11
15
  filters:
16
+ - skip-end-directive
17
+ - directives_bang_style_to_percent_style
18
+ - directives_percent_style
12
19
  - comments-percent-style
13
20
  - leading-headers
14
- - skip-end-directive
15
21
  - erb-django-style
16
- - include-helper-hack
22
+ - erb-rename-helper-hack
23
+ - dump_content_to_file_debug_text_erb
17
24
  - erb
18
25
  - code-block-curly-style
26
+ - dump_content_to_file_debug_text
19
27
 
20
28
 
21
29
  # markup (textile, markdown) config
data/config/slideshow.yml CHANGED
@@ -40,6 +40,8 @@ headers:
40
40
  # map shortcut to URI
41
41
 
42
42
  fetch:
43
+ s6gradients: http://github.com/geraldb/slideshow-s6-gradients/raw/master/s6gradients.txt
44
+ s6syntax: http://github.com/geraldb/slideshow-s6-syntax-highlighter/raw/master/s6syntax.txt
43
45
  s6blank: http://github.com/geraldb/slideshow-s6-blank/raw/master/s6blank.txt
44
46
  s5blank: http://github.com/geraldb/slideshow-s5-blank/raw/master/s5blank.txt
45
47
  s5themes: http://github.com/geraldb/slideshow-s5-themes/raw/master/s5themes.txt
@@ -53,6 +55,10 @@ analytics:
53
55
  google: UA-XXX
54
56
 
55
57
 
58
+ helper:
59
+ renames: []
60
+ exprs: []
61
+
56
62
  ### markup (textile, markdown) config
57
63
 
58
64
  # filters to run before markup processing
data/lib/slideshow.rb CHANGED
@@ -14,6 +14,7 @@ require 'net/http'
14
14
  require 'ostruct'
15
15
  require 'date'
16
16
  require 'yaml'
17
+ require 'cgi'
17
18
 
18
19
  # required gems
19
20
  require 'redcloth' # default textile library
@@ -34,15 +35,22 @@ require 'slideshow/helpers/capture_helper'
34
35
  require 'slideshow/helpers/analytics_helper'
35
36
  require 'slideshow/helpers/table_helper'
36
37
  require 'slideshow/helpers/step_helper'
38
+ require 'slideshow/helpers/background_helper'
39
+ require 'slideshow/helpers/source_helper'
40
+ require 'slideshow/helpers/directive_helper'
41
+ require 'slideshow/helpers/markdown_helper'
42
+
43
+ require 'slideshow/helpers/syntax/sh_helper'
37
44
 
38
45
  # load built-in filters
39
46
  require 'slideshow/filters/headers_filter'
40
47
  require 'slideshow/filters/text_filter'
48
+ require 'slideshow/filters/debug_filter'
41
49
 
42
50
 
43
51
  module Slideshow
44
52
 
45
- VERSION = '0.9.1'
53
+ VERSION = '0.9.2'
46
54
 
47
55
  # version string for generator meta tag (includes ruby version)
48
56
  def Slideshow.generator
@@ -70,8 +78,8 @@ end # module Slideshow
70
78
  # gem install coderay
71
79
  # gem install ultraviolet etc.
72
80
  BUILTIN_OPT_HELPERS = [
73
- 'slideshow/helpers/uv_helper.rb',
74
- 'slideshow/helpers/coderay_helper.rb',
81
+ 'slideshow/helpers/syntax/uv_helper.rb',
82
+ 'slideshow/helpers/syntax/coderay_helper.rb',
75
83
  ]
76
84
 
77
85
  BUILTIN_OPT_HELPERS.each do |helper|
@@ -39,18 +39,18 @@ class Config
39
39
  # textile:
40
40
  # extnames: [ .textile, .t ]
41
41
 
42
- @hash[ 'textile' ][ 'extnames' ] + @hash[ 'builtin' ][ 'textile' ][ 'extnames' ]
42
+ (@hash[ 'textile' ][ 'extnames' ] || []) + @hash[ 'builtin' ][ 'textile' ][ 'extnames' ]
43
43
  end
44
44
 
45
45
  def known_markdown_extnames
46
- @hash[ 'markdown' ][ 'extnames' ] + @hash[ 'builtin' ][ 'markdown' ][ 'extnames' ]
46
+ (@hash[ 'markdown' ][ 'extnames' ] || []) + @hash[ 'builtin' ][ 'markdown' ][ 'extnames' ]
47
47
  end
48
48
 
49
49
  def known_markdown_libs
50
50
  # returns an array of known markdown engines e.g.
51
51
  # [ rdiscount, rpeg-markdown, maruku, bluecloth, kramdown ]
52
52
 
53
- @hash[ 'markdown' ][ 'libs' ] + @hash[ 'builtin' ][ 'markdown' ][ 'libs' ]
53
+ (@hash[ 'markdown' ][ 'libs' ] || []) + @hash[ 'builtin' ][ 'markdown' ][ 'libs' ]
54
54
  end
55
55
 
56
56
  def known_extnames
@@ -61,7 +61,22 @@ class Config
61
61
  end
62
62
 
63
63
  def text_filters
64
- @hash[ 'builtin' ][ 'filters' ] + @hash[ 'filters' ]
64
+ @hash[ 'builtin' ][ 'filters' ] + ( @hash[ 'filters' ] || [] )
65
+ end
66
+
67
+ def helper_renames
68
+ @hash[ 'builtin' ][ 'helper' ][ 'renames' ] + ( @hash[ 'helper' ][ 'renames' ] || [] )
69
+ end
70
+
71
+ def helper_unparsed
72
+ # use unparsed params (passed along a single string)
73
+ @hash[ 'builtin' ][ 'helper' ][ 'unparsed' ]
74
+ end
75
+
76
+ def helper_exprs
77
+ # allow expression as directives (no need for %end block)
78
+ # by default directives are assumed statements (e.g. %mydir %end)
79
+ @hash[ 'builtin' ][ 'helper' ][ 'exprs' ] + ( @hash[ 'helper' ][ 'exprs' ] || [] )
65
80
  end
66
81
 
67
82
  def google_analytics_code
@@ -0,0 +1,44 @@
1
+ module Slideshow
2
+ module DebugFilter
3
+
4
+ # use it to dump content before erb merge
5
+
6
+ def dump_content_to_file_debug_text_erb( content )
7
+
8
+ return content unless logger.level == Logger::DEBUG
9
+
10
+ outname = "#{@name}.debug.text.erb"
11
+
12
+ puts " Dumping content before erb merge to #{outname}..."
13
+
14
+ File.open( outname, 'w' ) do |f|
15
+ f.write( content )
16
+ end
17
+
18
+ content
19
+ end
20
+
21
+ # use it to dump content before text-to-html conversion
22
+
23
+ def dump_content_to_file_debug_text( content )
24
+
25
+ return content unless logger.level == Logger::DEBUG
26
+
27
+ outname = "#{@name}.debug.text"
28
+
29
+ puts " Dumping content before text-to-html conversion to #{outname}..."
30
+
31
+ File.open( outname, 'w' ) do |f|
32
+ f.write( content )
33
+ end
34
+
35
+ content
36
+
37
+ end
38
+
39
+ end # module DebugFilter
40
+ end # module Slideshow
41
+
42
+ class Slideshow::Gen
43
+ include Slideshow::DebugFilter
44
+ end
@@ -1,4 +1,5 @@
1
- module HeadersFilter
1
+ module Slideshow
2
+ module HeadersFilter
2
3
 
3
4
  def leading_headers( content_with_headers )
4
5
 
@@ -38,8 +39,8 @@ def leading_headers( content_with_headers )
38
39
  end
39
40
 
40
41
  end # module HeadersFilter
41
-
42
+ end # module Slideshow
42
43
 
43
44
  class Slideshow::Gen
44
- include HeadersFilter
45
+ include Slideshow::HeadersFilter
45
46
  end
@@ -3,9 +3,91 @@
3
3
  #
4
4
  # use web filters for processing html/hypertext
5
5
 
6
- module TextFilter
6
+ module Slideshow
7
+ module TextFilter
7
8
 
8
- def comments_percent_style( content )
9
+ def directives_bang_style_to_percent_style( content )
10
+
11
+ # for compatibility allow !SLIDE/!STYLE as an alternative to %slide/%style-directive
12
+
13
+ bang_count = 0
14
+
15
+ # get unparsed helpers e.g. SLIDE|STYLE
16
+ unparsed = config.helper_unparsed.map { |item| item.upcase }.join( '|' )
17
+
18
+ content.gsub!(/^!(#{unparsed})/) do |match|
19
+ bang_count += 1
20
+ "%#{$1.downcase}"
21
+ end
22
+
23
+ puts " Patching !-directives (#{bang_count} #{config.helper_unparsed.join('/')}-directives)..."
24
+
25
+ content
26
+ end
27
+
28
+ def directives_percent_style( content )
29
+
30
+ directive_unparsed = 0
31
+ directive_expr = 0
32
+ directive_block_beg = 0
33
+ directive_block_end = 0
34
+
35
+ # process directives (plus skip %begin/%end comment-blocks)
36
+
37
+ inside_block = 0
38
+ inside_helper = false
39
+
40
+ content2 = ""
41
+
42
+ content.each_line do |line|
43
+ if line =~ /^%([a-zA-Z][a-zA-Z0-9_]*)(.*)/
44
+ directive = $1.downcase
45
+ params = $2
46
+
47
+ logger.debug "processing %-directive: #{directive}"
48
+
49
+ # slide, style
50
+ if config.helper_unparsed.include?( directive )
51
+ directive_unparsed += 1
52
+ content2 << "<%= #{directive} '#{params ? params : ''}' %>"
53
+ elsif config.helper_exprs.include?( directive )
54
+ directive_expr += 1
55
+ content2 << "<%= #{directive} #{params ? erb_simple_params(directive,params) : ''} %>"
56
+ elsif inside_helper && directive == 'end'
57
+ inside_helper = false
58
+ directive_block_end += 1
59
+ content2 << "%>"
60
+ elsif inside_block > 0 && directive == 'end'
61
+ inside_block -= 1
62
+ directive_block_end += 1
63
+ content2 << "<% end %>"
64
+ elsif [ 'comment', 'comments', 'begin', 'end' ].include?( directive ) # skip begin/end comment blocks
65
+ content2 << line
66
+ elsif [ 'helper', 'helpers' ].include?( directive )
67
+ inside_helper = true
68
+ directive_block_beg += 1
69
+ content2 << "<%"
70
+ else
71
+ inside_block += 1
72
+ directive_block_beg += 1
73
+ content2 << "<% #{directive} #{params ? erb_simple_params(directive,params) : ''} do %>"
74
+ end
75
+ else
76
+ content2 << line
77
+ end
78
+ end
79
+
80
+ puts " Preparing %-directives (" +
81
+ "#{directive_unparsed} #{config.helper_unparsed.join('/')} directives, " +
82
+ "#{directive_expr} #{config.helper_exprs.join('/')} expr-directives, " +
83
+ "#{directive_block_beg}/#{directive_block_end} block-directives)..."
84
+
85
+ content2
86
+ end
87
+
88
+
89
+
90
+ def comments_percent_style( content )
9
91
 
10
92
  # remove comments
11
93
  # % comments
@@ -18,7 +100,7 @@ module TextFilter
18
100
  comments_end = 0
19
101
 
20
102
  # remove multi-line comments
21
- content.gsub!(/^%begin.*?%end/m) do |match|
103
+ content.gsub!(/^%(begin|comment|comments).*?%end/m) do |match|
22
104
  comments_multi += 1
23
105
  ""
24
106
  end
@@ -44,8 +126,8 @@ module TextFilter
44
126
  ""
45
127
  end
46
128
 
47
- puts " Removing comments (#{comments_single} %-lines, " +
48
- "#{comments_multi} %begin/%end-blocks, #{comments_end} %end-blocks)..."
129
+ puts " Removing %-comments (#{comments_single} lines, " +
130
+ "#{comments_multi} begin/end-blocks, #{comments_end} end-blocks)..."
49
131
 
50
132
  content
51
133
  end
@@ -58,17 +140,21 @@ module TextFilter
58
140
  content
59
141
  end
60
142
 
61
- def include_helper_hack( content )
62
- # note: include is a ruby keyword; rename to __include__ so we can use it
143
+ def erb_rename_helper_hack( content )
144
+ # note: include is a ruby keyword; rename to s9_include so we can use it
145
+
146
+ rename_counter = 0
63
147
 
64
- include_counter = 0
148
+ # turn renames into something like:
149
+ # include|class etc.
150
+ renames = config.helper_renames.join( '|' )
65
151
 
66
- content.gsub!( /<%=[ \t]*include/ ) do |match|
67
- include_counter += 1
68
- '<%= __include__'
152
+ content.gsub!( /<%=[ \t]*(#{renames})/ ) do |match|
153
+ rename_counter += 1
154
+ "<%= s9_#{$1}"
69
155
  end
70
156
 
71
- puts " Patching embedded Ruby (erb) code aliases (#{include_counter} include)..."
157
+ puts " Patching embedded Ruby (erb) code for aliases (#{rename_counter} #{config.helper_renames.join('/')}-aliases)..."
72
158
 
73
159
  content
74
160
  end
@@ -81,32 +167,110 @@ module TextFilter
81
167
  content
82
168
  end
83
169
 
170
+ def erb_simple_params( method, params )
171
+
172
+ # replace params to support html like attributes e.g.
173
+ # plus add comma separator
174
+ #
175
+ # class=part -> :class => 'part'
176
+ # 3rd/tutorial -> '3rd/tutorial'
177
+ # :css -> :css
178
+
179
+ return params if params.nil? || params.strip.empty?
180
+
181
+ params.strip!
182
+ ## todo: add check for " ??
183
+ if params.include?( '=>' )
184
+ puts "** warning: skipping patching of params for helper '#{method}'; already includes '=>':"
185
+ puts " #{params}"
186
+
187
+ return params
188
+ end
189
+
190
+ before = params.clone
191
+
192
+ # 1) string-ify values and keys (that is, wrap in '')
193
+ # plus separate w/ commas
194
+ params.gsub!( /([:a-zA-Z0-9#][\w\/\-\.#()]*)|('[^'\n]*')/) do |match|
195
+ symbol = ( Regexp.last_match( 0 )[0,1] == ':' )
196
+ quoted = ( Regexp.last_match( 0 )[0,1] == "'" )
197
+ if symbol || quoted # return symbols or quoted string as is
198
+ "#{Regexp.last_match( 0 )},"
199
+ else
200
+ "'#{Regexp.last_match( 0 )}',"
201
+ end
202
+ end
203
+
204
+ # 2) symbol-ize hash keys
205
+ # change = to =>
206
+ # remove comma for key/value pairs
207
+ params.gsub!( /'(\w+)',[ \t]*=/ ) do |match|
208
+ ":#{$1}=>"
209
+ end
210
+
211
+ # 3) remove trailing comma
212
+ params.sub!( /[ \t]*,[ \t]*$/, '' )
213
+
214
+ puts " Patching params for helper '#{method}' from '#{before}' to:"
215
+ puts " #{params}"
216
+
217
+ params
218
+ end
219
+
220
+
221
+ def erb_django_simple_params( code )
222
+
223
+ # split into method/directive and parms plus convert params
224
+ code.sub!( /^[ \t]([\w.]+)(.*)/ ) do |match|
225
+ directive = $1
226
+ params = $2
227
+
228
+ "#{directive} #{params ? erb_simple_params(directive,params) : ''}"
229
+ end
230
+
231
+ code
232
+ end
233
+
84
234
  def erb_django_style( content )
85
235
 
86
236
  # replace expressions (support for single lines only)
87
237
  # {{ expr }} -> <%= expr %>
88
238
  # {% stmt %} -> <% stmt %> !! add in do if missing (for convenience)
239
+ #
240
+ # use use {{{ or {{{{ to escape expr back to literal value
241
+ # and use {%% %} to escape stmts
89
242
 
90
243
  erb_expr = 0
91
244
  erb_stmt_beg = 0
92
245
  erb_stmt_end = 0
93
246
 
94
- content.gsub!( /\{\{([^{}\n]+?)\}\}/ ) do |match|
95
- erb_expr += 1
96
- "<%= #{$1} %>"
247
+ content.gsub!( /(\{{2,4})([^{}\n]+?)(\}{2,4})/ ) do |match|
248
+ escaped = ($1.length > 2)
249
+ if escaped
250
+ "{{#{$2}}}"
251
+ else
252
+ erb_expr += 1
253
+ "<%= #{erb_django_simple_params($2)} %>"
254
+ end
97
255
  end
98
256
 
99
- content.gsub!( /\{%[ \t]*end[ \t]*%\}/ ) do |match|
100
- erb_stmt_end += 1
101
- "<% end %>"
257
+ content.gsub!( /(\{%{1,2})([ \t]*end[ \t]*)%\}/ ) do |match|
258
+ escaped = ($1.length > 2)
259
+ if escaped
260
+ "{%#{$2}%}"
261
+ else
262
+ erb_stmt_end += 1
263
+ "<% end %>"
264
+ end
102
265
  end
103
266
 
104
- content.gsub!( /\{%([^%\n]+?)%\}/ ) do |match|
105
- erb_stmt_beg += 1
106
- if $1.include?('do')
107
- "<% #{$1} %>"
267
+ content.gsub!( /(\{%{1,2})([^%\n]+?)%\}/ ) do |match|
268
+ escaped = ($1.length > 2)
269
+ if escaped
270
+ "{%#{$2}%}"
108
271
  else
109
- "<% #{$1} do %>"
272
+ erb_stmt_beg += 1
273
+ "<% #{erb_django_simple_params($2)} do %>"
110
274
  end
111
275
  end
112
276
 
@@ -119,35 +283,46 @@ module TextFilter
119
283
  def code_block_curly_style( content )
120
284
  # replace {{{ w/ <pre class='code'>
121
285
  # replace }}} w/ </pre>
286
+ # use 4-6 { or } to escape back to literal value (e.g. {{{{ or {{{{{{ => {{{ )
287
+ # note: {{{ / }}} are anchored to beginning of line ( spaces and tabs before {{{/}}}allowed )
122
288
 
123
289
  # track statistics
124
- code_begin = 0
125
- code_end = 0
126
-
127
- content.gsub!( "{{{{{{", "<pre class='code'>_S9BEGIN_" )
128
- content.gsub!( "}}}}}}", "_S9END_</pre>" )
129
-
130
- content.gsub!( "{{{" ) do |match|
131
- code_begin += 1
132
- "<pre class='code'>"
290
+ code_begin = 0
291
+ code_begin_esc = 0
292
+ code_end = 0
293
+ code_end_esc = 0
294
+
295
+ content.gsub!( /^[ \t]*(\{{3,6})/ ) do |match|
296
+ escaped = ($1.length > 3)
297
+ if escaped
298
+ code_begin_esc += 1
299
+ "{{{"
300
+ else
301
+ code_begin += 1
302
+ "<pre class='code'>"
303
+ end
133
304
  end
134
305
 
135
- content.gsub!( "}}}" ) do |match|
136
- code_end += 1
137
- "</pre>"
306
+ content.gsub!( /^[ \t]*(\}{3,6})/ ) do |match|
307
+ escaped = ($1.length > 3)
308
+ if escaped
309
+ code_end_esc += 1
310
+ "}}}"
311
+ else
312
+ code_end += 1
313
+ "</pre>"
314
+ end
138
315
  end
139
-
140
- # restore escaped {{{}}}
141
- content.gsub!( "_S9BEGIN_", "{{{" )
142
- content.gsub!( "_S9END_", "}}}" )
143
-
144
- puts " Patching code blocks (#{code_begin}/#{code_end} {{{/}}}-lines)..."
316
+
317
+ puts " Patching {{{/}}}-code blocks (#{code_begin}/#{code_end} blocks, " +
318
+ "#{code_begin_esc}/#{code_end_esc} escaped blocks)..."
145
319
 
146
320
  content
147
321
  end
148
322
 
149
- end
323
+ end # module TextFilter
324
+ end # module Slideshow
150
325
 
151
326
  class Slideshow::Gen
152
- include TextFilter
327
+ include Slideshow::TextFilter
153
328
  end