lib/slideshow.rb in slideshow-0.1 vs lib/slideshow.rb in slideshow-0.2

- old
+ new

@@ -3,43 +3,172 @@ module Slideshow def Slideshow.create_slideshow( fn ) + +gradient = <<EOS +<svg xmlns="http://www.w3.org/2000/svg"> + + <defs> + <linearGradient id="dark" x1="0" y1="0" x2="1" y2="1"> + <stop offset="0" style="stop-color: red"/> + <stop offset="1" style="stop-color: black"/> + </linearGradient> + + <linearGradient id="dark_reverse" x1="0" y1="0" x2="1" y2="1"> + <stop offset="0" style="stop-color: black"/> + <stop offset="1" style="stop-color: red"/> + </linearGradient> + + <linearGradient id="light" x1="0" y1="0" x2="1" y2="1"> + <stop offset="0" style="stop-color: red"/> + <stop offset="1" style="stop-color: orange"/> + </linearGradient> + + <linearGradient id="top_bottom" x1="0" y1="0" x2="0" y2="1"> + <stop offset="0%" style="stop-color: red" /> + <stop offset="100%" style="stop-color: black" /> + </linearGradient> + + <linearGradient id="left_right" x1="0" y1="0" x2="1" y2="0"> + <stop offset="0%" style="stop-color: red" /> + <stop offset="100%" style="stop-color: orange" /> + </linearGradient> + + <linearGradient id="repeat" x1="0.4" y1="0.4" x2="0.5" y2="0.5" + spreadMethod="repeat"> + <stop offset="0%" style="stop-color: red" /> + <stop offset="50%" style="stop-color: orange" /> + <stop offset="100%" style="stop-color: red" /> + </linearGradient> + + <radialGradient id="radial"> + <stop offset="0%" style="stop-color: black" /> + <stop offset="100%" style="stop-color: red" /> + </radialGradient> + + + <radialGradient id="radial_off_center" fx="0.7" fy="0.7" cx="0.5" cy="0.5" r="0.4"> + <stop offset="0%" style="stop-color: orange" /> + <stop offset="100%" style="stop-color: red" /> + </radialGradient> + + <radialGradient id="radial_repeat" fx="0.5" fy="0.5" cx="0.6" cy="0.6" r="0.2" + spreadMethod="repeat"> + <stop offset="0%" style="stop-color: red" /> + <stop offset="50%" style="stop-color: orange" /> + <stop offset="100%" style="stop-color: red" /> + </radialGradient> + + </defs> + + <rect width="100%" height="100%" + style="fill: url(#dark) "/> + +</svg> +EOS + header = <<EOS <html> <head> <meta name="slideselector" content=".slide"> <meta name="titleselector" content="h1"> <meta name="stepselector" content=".step"> - <title>Slideshow</title> +<title>Slideshow</title> <style type="text/css"> - @media projection { + +@media screen { + .layout { display: none; } + + .banner { + display: block; + border: green solid thick; + padding: 1em; + font-family: sans-serif; + font-weight: bold; + margin-bottom: 2em; + } +} +@media projection { + body { + height: 100%; margin: 0px; padding: 0px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: white; + opacity: .99; +} + +.slide +{ + page-break-after: always; + padding-left: 2em; + padding-top: 2em; } -A:hover { background-color: cyan; } +.banner +{ + display: none; +} -h1, h2 { font-size: 40pt; color: black; } -h3 { font-size: 25pt; color: black; } -p, li, td, th { font-size: 18pt; color: black; } +.layout +{ + display: block; +} -pre { font-size: 16pt; color: black; } -pre.code { font-size: 16pt; color: black; background-color: silver; } +div.background { + position: fixed; + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; + z-index: -1; + } - } +a:link, a:visited { + color: white; +} +a:hover { background-color: yellow; } + +h1, h2 { font-size: 36pt; } +h3 { font-size: 25pt; } +p, li, td, th { font-size: 18pt; } + +pre { font-size: 16pt; } + +pre.code { font-size: 16pt; + background-color: black; + color: white; + padding: 5px; + border: silver thick groove; + -moz-border-radius: 11px; + } +} + </style> </head> <body> + +<div class="layout"> + <div class="background"> + <object data="$svgname" width="100%" height="100%"> + </div> +</div> + +<div class="banner"> + Turn this document into a (PowerPoint/KeyNote-style) slide show pressing F11. + (Free <a href="https://addons.mozilla.org/en-US/firefox/addon/4650">FullerScreen</a> Firefox addon required). + Learn more at the <a href="http://slideshow.rubyforge.org">Slide Show (S9)</a> + RubyForge project site. + </div> EOS footer = <<EOS </body> </html> @@ -50,12 +179,20 @@ extname = ".textile" if extname.eql?("") inname = "#{basename}#{extname}" outname = "#{basename}.html" + svgname = "#{basename}.svg" - puts "Preparing slidshow '#{outname}'..." + puts "Preparing slideshow theme '#{svgname}'..." + + out = File.new( svgname, "w+") + out << gradient + out.flush + out.close + + puts "Preparing slideshow '#{outname}'..." content = '' slide_counter = 0 infile = File.new( inname ) @@ -69,11 +206,11 @@ } content << "\n\n</div>" if slide_counter > 0 out = File.new( outname, "w+") - out << header + out << header.gsub( '$svgname', svgname ) out << RedCloth.new( content ).to_html out << footer out.flush out.close @@ -84,10 +221,10 @@ def Slideshow.main $options = {} opt=OptionParser.new do |opts| - opts.banner = "Usage: #{$0} [options] name" + opts.banner = "Usage: slideshow [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! \ No newline at end of file