UPDATED. See below.
For the past four years, I’ve been including little blocks of formatted screenplay examples in my posts, such as…
INT. LIVING ROOM – DAY
As the phone RINGS, Gary dozily reaches one dirty-socked foot off the couch to sit up — and suddenly finds himself falling. He lands hard, dazed. We REVEAL that the couch is propped up by cinder blocks, five feet off the floor.
Gary staggers to his feet, bewildered. Realizing who must be behind the prank…
I call these little blocks scrippets, and they’ve proved to be very useful. They’re made with some custom CSS code I wrote in 2004,1 which several other screenwriting bloggers have implemented with their own tweaks and changes.
If you’re reasonably familiar with HTML and CSS, it’s not hard to do the same: you paste the CSS into your stylesheet, and mark up your script section with the proper tags. For the example above, the code reads…
<p class="sceneheader"> INT. LIVING ROOM – DAY</p>
<p class="action"> As the phone RINGS, Gary dozily reaches one dirty-socked foot off the couch to sit up — and suddenly finds himself falling. He lands hard, dazed. We REVEAL that the couch is propped up by cinder blocks, five feet off the floor.</p>
<p class="action"> Gary staggers to his feet, bewildered. Realizing who must be behind the prank…</p>
<p class="character"> GARY</p>
<p class="dialogue"> Grandma!</p>
Each line is wrapped in a class tag identifying its function, and the whole thing is wrapped in a div. 2 A human can read it, but it’s a pain to write.
Fortunately, I do all my blog writing in TextMate, so it was relatively trivial to modify its “Wrap Each Selected Line In…” command to speed the process. For a few years, I just saved the scrippet formatting until last, and it was bearable.
Then, during the strike, I had the time and inclination to find a more elegant solution. I wrote a script in Ruby that would let me write the above example without any spacing, markup or attempt at formatting, and then with one command wrap it in the proper format. It’s made my blog life a lot easier. But it’s no help to other bloggers who want to include scrippets, or readers who want to post a scrippet in the comments section. It’s too home-brewed and specific.
Ultimately, I’d like every blogger to be able to include scrippets, both in posts and comments. (And forums, though that’s its own beast.) But that’s a hell of a lot of work to support multiple systems and scenarios. So let’s start a little smaller.
I want to create a WordPress plug-in that would let a blogger or commenter write…
MARY Anything you want to tell me?
I swear, honey, I don't know how mayonnaise got in the piano.
…and end up with…
Anything you want to tell me?
I swear, honey, I don’t know how mayonnaise got in the piano.
However, that’s simply beyond my coding prowess. WordPress is built around PHP, and while I can understand it well enough to modify a simple template, I fail to grok it the way I do Ruby and Python. But I have a feeling some of my readers could write the PHP equivalent of my script while half-watching Battlestar Galactica.
If that sounds like you, and you’re up for the challenge, I encourage you to muck around with the code and share your progress. WordPress is trivial to install, with a big developer community. See what you can get working, and include a link to let me and others see your progress.
Here are some caveats, pitfalls and other bits of advice to help you out:
- Since you’ll be setting hooks to filter the text, you need to play nice with other plugins that do the same, such as Markdown. Michel Fortin has a useful post about some of the challenges in doing Markdown for WordPress.3
- While my script shows the scope of what I’m looking for, Dwayne Bent has already created a much more sophisticated version for DokuWiki in PHP. He’s busy with school, and unfamiliar with WordPress, but offers up his code under the GPL if it’s helpful.
- <scrippet> may be a terrible delimiter, prone to wonkiness. So other options are welcome. One I’ve considered is +- and -+, which coveys the idea of creating a box around something.
- The CSS actually does quite a bit of the work. Let your code identify and label the elements, but leave the formatting to the CSS.
- The plugin should include the CSS — yet make it easy to modify the CSS to suit an individual blog. Specifically, a blogger will want to be able to control the box width, background color, text color and padding. A straightforward admin screen in WordPress seems doable.
I have no timetables or deadlines for the project, but I will offer up a signed Nines poster to a coder who comes up with a viable and elegant version of the plug-in — and of course, heaps of praise and bragging rights.
And if WordPress isn’t your bag, but you feel the calling to take on a similar version for another platform (Movable Type, bbPress, vBulletin), by all means go for it. If this comment thread gets out of control, I’ll move it to a different forum.
UPDATE: Just over 24 hours in, there’s been a lot of progress. Thanks to everyone who’s given a chunk of their weekend to the cause.
By Monday or Tuesday, I’ll be posting a link to a test blog where readers can try out the plug-in for themselves. Before releasing it into the wild, we want to make sure it works with a range of stock themes and feels intuitive to readers leaving comments.
- If you look at the example in the original post, it comes from the script for The Nines, which I was writing at the time. ↩
- As originally implemented, I used an unordered list instead of a div, and styled list items for the individual lines. It was trendy, but two issues made me switch. First, blog comments are also list items, so nesting another list inside kept creating issues. Second, feed readers don’t get any CSS styling — they got a bullet list. So, for now, it’s divs and p’s. ↩
- And yes, I asked Michel if he wanted to write a scrippet plug-in, but he declined. ↩