September 8, 2008

Scrippets 1.0

Scrippets is a text-to-HTML converter for screenplays developed by screenwriter John August. It was modeled after John Gruber’s delightful Markdown format, which allows for easy text-to-HTML conversion for blogs and such, only much cooler. Let me explain…

The Problem

The thing you’ll first notice about a screenplay is that it comes in a very specific format. The problem John August discovered is that the format that a screenplay comes in doesn’t translate well to a web page. So, being the omega-level geek that he is, John developed a CSS format to turn an HTML formatted screenplay into a beautiful on-screen facsimile of the printed page, and, in typical John August fashion, he released this CSS to the world to use.

But, John wanted an easier way to do all this. Unfortunately, his method required him to manually type out all the HTML, which is pretty boring. So during the writer’s strike John developed a Ruby script to automatically convert a plain text version of the screenplay format to an HTML one, which could then be styled by his CSS.

Great, but what about the rest of the less-geeky world?

John came up with the fantastic idea of creating a WordPress plugin to automatically do the text-to-HTML conversion, and automatically add the needed CSS to allow a person a super-easy way to start use this plain text format, and end up with perfectly styled screenplay text on screen.

This is the concept behind Scrippets.

What Does This Have to Do with Me?

Long story short, I wrote the WordPress plugin.

How It Works

Just download the plugin from WordPress.org, unzip it, copy it to your wp-content/plugins directory, and activate it from your Admin plugins panel (as you would any other plugin in). That’s it! Now you can start using Scrippets on your blog.

So what is does a Scrippet look like? The following is an example of a Scrippet:

[scrippet]
INT. HOUSE - DAY

MARY yells across the hall to FRANK.

MARY
Anything you want to tell me?

FRANK (O.S.)
I swear, honey, I don't know how mayonnaise got in the piano.

CUT TO:

FRANK

running out of the bathroom.

FRANK
(terrified)
There are bees in the toliet!
[/scrippet]

And the following is how it will look on your Scrippet enabled blog (note, you need to visit this page outside an RSS reader to see it in all its glory):

INT. HOUSE - DAY

MARY yells across the hall to FRANK.

MARY

Anything you want to tell me?

FRANK (O.S.)

I swear, honey, I don’t know how mayonnaise got in the piano.

CUT TO:

FRANK

running out of the bathroom.

FRANK

(terrified)

There are bees in the toliet!

Awesome? I think so.

Two things to note:

  • You MUST include the [scrippet][/scrippet] blocks around the text. That is the only way the plugin knows there’s a Scrippet there.
  • You have to use the correct line spacing. That is, you have to have a blank line between a line of action and a character cue, and no blank line between a character cue and a parenthetical or dialogue line.

Basically, just try and make it look like the above example and you’ll be good to go.

BBPRESS

bbPress is a forum software based on WordPress, and suffice it to say that it was relatively easy to port the plugin over to it (even though bbPress is poorly documented). If you’d like BB Scrippets, you can get them here.

What About Non-WordPress Blogs and Other PHP Web Apps?

Note: this is for programmers and other super-geeks.

I can’t speak for John, but I think it would be totally awesome for Scrippets to DOMINATE all the Internets. To assist in this, I designed the plugin to be modular. In the wp-scrippets folder you download you will find a file called scrippetize.php. This file contains the core scrippetize function that does all the work, and is available under one of those really liberal MIT licenses.

To incorporate it into your own PHP project all you have to do is add require('scrippetize.php'); to your PHP script, and use the scrippetize function in the following way:

$formatted_text = scrippetize($text, $wrap_before, $wrap_after);

It’s important to note that the $wrap_before and $wrap_after parameters are optional.

Therefore,

scrippetize($text);

does the same thing as

scrippetize($text, '', '');

From there, just pull the scrippets.css file out of the plugin folder and add that to your HTML page header, and you’re good to go.

Pretty simple, I think.

What About Non-PHP Projects?

Will Carlough, who assisted in the testing and development of the plugin, was able to successfully port the scrippetize function to Javascript, and, seriously, if it works in freakin’ Javascript you should be able to port it to any other programming language known to man. Good luck with that.

CUT TO: Awesome 80’s Training Montage

That’s about it. If you’re interested, there’s more info at scrippets.org, and a forum there where you can communicate with John or myself about Scrippet related issues. This will also be the place to file bug reports, or get some help porting the code to another platform.

Many thanks go to John August for conceiving, designing, testing, and managing the development of this plugin; many thanks to Will Carlough for showing that my program design wasn’t totally insane; and many thanks to me, for being really good looking (it makes programming easier).

Please enjoy Scrippets.

FADE TO BLACK.

Leave a comment, or trackback from your own site.

There have been 2 comments

[...] I’m excited this works. Now I can show some of my work for people to tear apart. Checkout the plug in here and here. [...]

Thank you so much. It works in Portuguese too.

João Nunes

Leave a Reply

π