Sha256: 553c6fdad5d52004a0ffb94100c7e1003471d43f106b07e05223959bfe5b0f79
Contents?: true
Size: 1.29 KB
Versions: 14
Compression:
Stored size: 1.29 KB
Contents
# encoding: utf-8 module Slideshow module SlideFilter # add slide directive before h1 (tells slideshow gem where to break slides) # # e.g. changes: # <h1 id='optional' class='optional'> # to # html comment -> _S9SLIDE_ (note: rdoc can't handle html comments?) # <h1 id='optional' class='optional'> def add_slide_directive_before_h1( content ) # mark h1 for getting wrapped into slide divs # note: use just <h1 since some processors add ids e.g. <h1 id='x'> slide_count = 0 content.gsub!( /<h1/ ) do |match| slide_count += 1 "\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}" end puts " Adding #{slide_count} slide breaks (using h1 rule)..." content end # add slide directive before div h1 (for pandoc-generated html) # # e.g. changes: # <div id='header'> # <h1 id='optional' class='optional'> # to # html comment -> _S9SLIDE_ # <div id='header'> # <h1 id='optional' class='optional'> def add_slide_directive_before_div_h1( content ) slide_count = 0 content.gsub!( /<div[^>]*>\s*<h1/ ) do |match| slide_count += 1 "\n<!-- _S9SLIDE_ -->\n#{Regexp.last_match(0)}" end puts " Adding #{slide_count} slide breaks (using div_h1 rule)..." content end end # module SlideFilter end # module Slideshow class Slideshow::Gen include Slideshow::SlideFilter end
Version data entries
14 entries across 14 versions & 1 rubygems