showoff 0.9.10.2 → 0.9.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8278ed3a8a49ffcc69242c6222609050aa7f80ba
4
- data.tar.gz: 147263ae3d5b911b2740f9a5b6f925536aea961d
3
+ metadata.gz: e762a266993707880dc1eae62fa79e31123e462e
4
+ data.tar.gz: 7f94df77801f964db8a43212bc666c0cce17fdc3
5
5
  SHA512:
6
- metadata.gz: 50c3cb9cb6c37c7c3c773bce7e296e41e86f4af88bc7810c17af8e768a61c36563314c369cbe8bf8276b8dd55d26109b5bb6040b77adcdf9d4323f9c8f26b685
7
- data.tar.gz: 882e602571a0c1de74e3b75eb359951571bf9990cd363fdbbcf0260d40b41a28897dfb7f13e7f89e301a071b3e01b1239391d2e97ce904634802fa8872c0f800
6
+ metadata.gz: 4d8532752720e21fc485f3f1e108122ae07d3a494bfc01e3189cff9de3bc5d7341b79316375d8451a63e3bcba725d26795370e98d67208dca6915aa918a4410f
7
+ data.tar.gz: fdbb66639a9e39d159b59f4c070ab118edb3f28638f0e5d0ba9dba812defc3672e0bcd9ebeec9a8ecf949a9bd0c9b2f87f96619b9405fa688de7c2afc2579053
@@ -1,3 +1,3 @@
1
1
  # No namespace here since ShowOff is a class and I'd have to inherit from
2
2
  # Sinatra::Application (which we don't want to load here)
3
- SHOWOFF_VERSION = '0.9.10.2'
3
+ SHOWOFF_VERSION = '0.9.10.3'
data/lib/showoff.rb CHANGED
@@ -253,7 +253,8 @@ class ShowOff < Sinatra::Application
253
253
  # extract id, defaulting to none
254
254
  id = nil
255
255
  content_classes.delete_if { |x| x =~ /^#([\w-]+)/ && id = $1 }
256
- id = name unless id
256
+ id = name.dup unless id
257
+ id.gsub!(/[^-A-Za-z0-9_]/, '_') # valid HTML id characters
257
258
  @logger.debug "id: #{id}" if id
258
259
  @logger.debug "classes: #{content_classes.inspect}"
259
260
  @logger.debug "transition: #{transition}"
@@ -292,7 +293,7 @@ class ShowOff < Sinatra::Application
292
293
  sl = Tilt[:markdown].new(nil, nil, engine_options) { sl }.render
293
294
  sl = build_forms(sl, content_classes)
294
295
  sl = update_p_classes(sl)
295
- sl = process_content_for_section_tags(sl)
296
+ sl = process_content_for_section_tags(sl, name)
296
297
  sl = update_special_content(sl, @slide_count, name) # TODO: deprecated
297
298
  sl = update_image_paths(name, sl, opts)
298
299
 
@@ -346,7 +347,7 @@ class ShowOff < Sinatra::Application
346
347
  end
347
348
 
348
349
  # replace section tags with classed div tags
349
- def process_content_for_section_tags(content)
350
+ def process_content_for_section_tags(content, name = nil)
350
351
  return unless content
351
352
 
352
353
  # because this is post markdown rendering, we may need to shift a <p> tag around
@@ -358,6 +359,26 @@ class ShowOff < Sinatra::Application
358
359
  result.gsub!(/(<p>)?~~~SECTION:([^~]*)~~~/, '<div class="\2">\1')
359
360
  result.gsub!(/~~~ENDSECTION~~~(<\/p>)?/, '\1</div>')
360
361
 
362
+ filename = File.join(settings.pres_dir, '_notes', "#{name}.md")
363
+ @logger.debug "personal notes filename: #{filename}"
364
+ if File.file? filename
365
+ # TODO: shouldn't have to reparse config all the time
366
+ engine_options = ShowOffUtils.showoff_renderer_options(settings.pres_dir)
367
+
368
+ doc = Nokogiri::HTML::DocumentFragment.parse(result)
369
+ doc.css('div.notes').each do |section|
370
+ text = Tilt[:markdown].new(nil, nil, engine_options) { File.read(filename) }.render
371
+ frag = "<div class=\"personal\"><h1>Personal Notes</h1>#{text}</div>"
372
+ note = Nokogiri::HTML::DocumentFragment.parse(frag)
373
+
374
+ if section.children.size > 0
375
+ section.children.before(note)
376
+ else
377
+ section.add_child(note)
378
+ end
379
+ end
380
+ result = doc.to_html
381
+ end
361
382
  result
362
383
  end
363
384
 
@@ -315,6 +315,24 @@ div.zoomed {
315
315
  list-style-type: disc;
316
316
  }
317
317
 
318
+ #bottom #notes div.personal {
319
+ float: right;
320
+ border-left: 4px solid #999;
321
+ border-bottom: 4px solid #999;
322
+ border-radius: 0 0 0 0.5em;
323
+ padding: 0.1em 0 0.25em 0.25em;
324
+ margin: 0 0 1em 1em;
325
+ background: #eee;
326
+ max-width: 25%;
327
+ }
328
+
329
+ #bottom #notes div.personal h1 {
330
+ font-size: 1em;
331
+ font-weight: bold;
332
+ margin-top: 0;
333
+ border-bottom: 1px solid #ccc;
334
+ }
335
+
318
336
  #topbar {
319
337
  background: #4c4c4c; /* Old browsers */
320
338
  /* IE9 SVG, needs conditional override of 'filter' to 'none' */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10.2
4
+ version: 0.9.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra