« Springtime on the speaking circuit: Denmark, Norway, and Open Komodo | Main | How to Remove a Stubborn MSI »

Presentation Tip: Haml Rocks!

2008 is the year of the talk for me. Next week I'll be speaking on OpenKomodo and Ruby in Scandinavia.  Later this spring I'll be giving some tips on speeding up Ajax code at the Vancouver OpenWeb conference, and I'll be talking about GreaseMonkey and reprising the Ajax talk at Bellingham's Linuxfest Northwest at the end of April (two separate talks, although combining Ajax and GM might be interesting).

I've started using s5 to present my material, but authoring it is tedious, even with the assistance of Komodo's snippets and automatic abbreviations. I wondered if I could use Haml outside Rails, and sure enough it's easy to do. My presentation now looks something like this:

.slide
  .h1 Stuff about my topic
  .ul
    .li point 1
    .li point 2
    .li final point

Or if you prefer the Takahashi Method:

.slide
  .h1 Topic
 
.slide
  .h1 Another

I then convert it with this simple Ruby program:

#!/usr/bin/env ruby

require 'haml'

pre = <<__EOF__
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
... # The boilerplate at the start of every s5 HTML document.
...
<h1>[Title]</h1>
<h2>[Sub-title] </h2>
</div>
</div>
<div class="presentation">
__EOF__
source = File.open("talk.haml", 'r') {|fd| fd.read }
engine = Haml::Engine.new(source)
post = <<__EOF__
</div>
</body>
</html>
__EOF__

puts pre + engine.render + post

True, I don't get the fancy wipes and swirly transitions between slides by using s5, but I can live with the tradeoff.

Comments

You might try S9 - a Ruby gem that lets you author your slides using an easy-to-read and easy-to-write plain text format - wiki-style and as a bonus you can create gradient themes using Scalable Vector Graphics (SVG). Official S5 support is on the way, if it doesn't work already using cut-n-paste. Cheers.

Hi Gerald,

I've got S9 in my radar, but wanted to warm up just using S5. Finding the tagging tedious and repetitive, I started writing some Komodo abbreviations, and then figured I should finally try Haml.

Where are S6 through S8?

Regards,
Eric

Post a comment

If you have a TypeKey or TypePad account, please Sign In