lib/showoff.rb in showoff-0.14.3 vs lib/showoff.rb in showoff-0.15.0
- old
+ new
@@ -1202,12 +1202,14 @@
html = process_markdown(slide, content, {})
doc = Nokogiri::HTML::DocumentFragment.parse(html)
if index == 'all'
doc.css(classes).collect do |code|
- lang = code.attr('class') =~ /language-(\S*)/ ? $1 : nil
- [lang, code.text]
+ classes = code.attr('class').split rescue []
+ lang = classes.shift =~ /language-(\S*)/ ? $1 : nil
+
+ [lang, code.text, classes]
end
else
doc.css(classes)[index.to_i].text rescue 'Invalid code block index'
end
end
@@ -1408,22 +1410,23 @@
# websockets don't use the same auth standards
# we use a session cookie to identify the presenter
if valid_cookie()
name = control['name']
slide = control['slide'].to_i
+ increment = control['increment'].to_i rescue 0
# check to see if we need to enable a download link
if @@downloads.has_key?(slide)
@logger.debug "Enabling file download for slide #{name}"
@@downloads[slide][0] = true
end
# update the current slide pointer
@logger.debug "Updated current slide to #{name}"
- @@current = { :name => name, :number => slide }
+ @@current = { :name => name, :number => slide, :increment => increment }
# schedule a notification for all clients
- EM.next_tick { settings.sockets.each{|s| s.send({ 'message' => 'current', 'current' => @@current[:number] }.to_json) } }
+ EM.next_tick { settings.sockets.each{|s| s.send({ 'message' => 'current', 'current' => @@current[:number], 'increment' => @@current[:increment] }.to_json) } }
end
when 'register'
# save a list of presenters
if valid_cookie()