lib/showoff.rb in showoff-0.15.3 vs lib/showoff.rb in showoff-0.15.4
- old
+ new
@@ -422,10 +422,12 @@
content += sl
content += "</div>\n"
content += "<canvas class=\"annotations\"></canvas>\n"
content += "</div>\n"
+ content = final_slide_fixup(content)
+
final += update_commandline_code(content)
if seq
seq += 1
end
@@ -517,9 +519,33 @@
# Now add a target so we open all external links from notes in a new window
doc.css('a').each do |link|
link.set_attribute('target', '_blank') unless link['href'].start_with? '#'
end
+
+ doc.to_html
+ end
+
+ # TODO: damn, this one is bad. It's named generically so we can add to it if needed.
+ #
+ # This method is intended to be the dumping ground for the slide fixups that we can't do in
+ # other places until we get #615 implemented. Then this method should be refactored away.
+ #
+ def final_slide_fixup(text)
+ # Turn this into a document for munging
+ doc = Nokogiri::HTML::DocumentFragment.parse(text)
+ slide = doc.at_css 'div.slide'
+ content = doc.at_css 'div.content'
+
+ # move each notes section outside of the content div
+ doc.css('div.notes-section').each do |note|
+ content.add_next_sibling(note)
+ end
+
+ # this is a list of classes that we want applied *only* to content, and not to the slide,
+ # typically so that overly aggressive selectors don't match more than they should.
+ blacklist = ['bigtext']
+ slide['class'] = slide['class'].split.reject { |klass| blacklist.include? klass }.join(' ')
doc.to_html
end
def process_content_for_all_slides(content, num_slides, opts={})