Sha256: 068bea2b9293dac9c0fb3b768501eef468d2b47fec462bbadc3c9c50378e8722
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
require 'optparse' require 'RedCloth' module Slideshow def Slideshow.create_slideshow( fn ) header = <<EOS <html> <head> <meta name="slideselector" content=".slide"> <meta name="titleselector" content="h1"> <meta name="stepselector" content=".step"> <title>Slideshow</title> <style type="text/css"> @media projection { body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; } A:hover { background-color: cyan; } h1, h2 { font-size: 40pt; color: black; } h3 { font-size: 25pt; color: black; } p, li, td, th { font-size: 18pt; color: black; } pre { font-size: 16pt; color: black; } pre.code { font-size: 16pt; color: black; background-color: silver; } } </style> </head> <body> EOS footer = <<EOS </body> </html> EOS basename = File.basename( fn, '.*' ) extname = File.extname( fn ) extname = ".textile" if extname.eql?("") inname = "#{basename}#{extname}" outname = "#{basename}.html" puts "Preparing slidshow '#{outname}'..." content = '' slide_counter = 0 infile = File.new( inname ) infile.each { |line| if line.include?( 'h1.' ) then content << "\n\n</div>" if slide_counter > 0 content << "<div class='slide'>\n\n" slide_counter += 1 end content << line } content << "\n\n</div>" if slide_counter > 0 out = File.new( outname, "w+") out << header out << RedCloth.new( content ).to_html out << footer out.flush out.close puts "Done." end def Slideshow.main $options = {} opt=OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] name" # opts.on( "-s", "--style STYLE", "Select Stylesheet" ) { |s| $options[:style]=s } opts.on_tail( "-h", "--help", "Show this message" ) { puts opts.help; exit } end opt.parse! ARGV.each { |fn| Slideshow.create_slideshow( fn ) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slideshow-0.1 | lib/slideshow.rb |