S5 with textile

I’ve started working on a presentation for skillswap. Like any paranoid coder, I want to keep my work under revision control, so I prefer a text based format. Of these, the best option presently seems to be S5. But it does require you to write a fair chunk of HTML. These days though, I prefer textile.

So, I wrote a small standalone textile processor in ruby:

#!/usr/bin/env ruby
require 'rubygems'
require_gem 'RedCloth'

This, combined with a small Makefile lets me build the S5 presentation quite simply from the textile file.

index.html: s5-head.html vc-intro-svn.txt s5-foot.html
        (cat s5-head.html; 
         ./textile vc-intro-svn.txt; 
         cat s5-foot.html) > $@

The only mildly irritating limitation is that you still have to explicitly wrap the slides in <div class='slide'>...</div>. But I can live with that.

There was still one thing missing though. If you printed out the presentation, all the links wouldn’t show up. Because textile outputs well formed xhtml, it was a simple matter to use a small bit of XSLT to harvest the links on each slide and insert a handout div listing them.

<xsl:stylesheet version="1.0"
  <xsl:output omit-xml-declaration="yes"/>
  <xsl:template match="@* | node()">
      <xsl:apply-templates select="@* | node()"/>
  <xsl:template match="div[@class='slide']">
    <div class="slide">
      <xsl:if test=".//a">
        <div class="handout">
          <p>Links from the slide:</p>
            <xsl:for-each select=".//a">
                <xsl:value-of select="."/>
                <xsl:text>: </xsl:text>
                <a href="{@href}"><xsl:value-of select="@href"/></a>

Like all XSLT, it looks more verbose than it actually is (something it shares with Java, IMHO). But it serves a useful purpose. Now, the printed slides aren’t lacking in information.


Vim Syntax for Textile

I’ve been using textile more and more these days. It’s quite convenient for writing.

But what’s annoying is that there is no support for it in Vim.

So, after a bit of messing around with the vim manual Your own syntax highlighted, I now have textile.vim.

It’s definitely a first attempt at such things. There’s a lot that it doesn’t do. But for an hours work, it’s started to highlight textile files well enough for me.

Update: PlasticBoy has a similar Vim syntax for Markdown. I should take a look and get some ideas from there…