Haris wrote:
Oliver,
The screencast is very nice! The main problem for me is that I don't know the first thing about what things a screenwriting bundle should be doing. If you ask very particular questions about how certain tasks could be accomplished, I'm sure you'll find that lots of people will be able to help you. But most of us are just not familiar with screenwriting software, and screenplay formats in general. I actually looked at your bundle the last time you posted, but couldn't really understand what most commands are for, since I've never in my life seen a screenplay. Seeing the screencast makes some things click. So please, set some particular goals for commands/conversion tools, and you have a good chance of getting people to help out. For instance, what would you want the conversion tool to do? Give us some examples of how the result should look. You've done a great work so far, and it would be nice to see this bundle pushed even further.
Haris
Okay, I guess most people had no idea what I was doing when I posted my screenwriting bundle because I didn't describe what the bundle does and how it does it. My mistake.
I've posted a new screencast that goes into much more detail regarding what I the bundle to be able to do. Grab it here: http:// www.ollieman.net/files/screencast2.mp4
The ultimate goal is to end up with a PDF which contains text that conforms to the Studio Format. The Studio Format is a industry- standard layout which all professional screenwriters work in and is the very purpose of screenwriting software. Fortunately for us, the format is very strict as it is modeled after what a typewriter is capable of.
You can find more information on the Studio Format and an example of it at http://www.ollieman.net/files/bundles/
---
In another screencast, I intro the bundle and what it's designed to do from a writer's perspective. Grab it here: http://www.ollieman.net/ files/screencast-intro.mp
On 24/1/2006, at 10:08, Oliver Taylor wrote:
[...] I've posted a new screencast that goes into much more detail regarding what I the bundle to be able to do. Grab it here: http:// www.ollieman.net/files/screencast2.mp4
Ah okay -- so basically it's the conversion you want help with?
I assume it's because you are not familiar with any programming language (which I must say, your bundle is pretty impressive if you are not -- even if you are, it still is impressive -- do you mind I link to the intro screencast in the RSS feed as an example of behavioral patterns in TM? I can keep a local cache of the bundle if you're concerned about bandwidth).
But as for the conversion -- you seem to have defined a very simple format for the screenplays which can be converted to HTML simply by doing line-by-line substitutions.
Perl (for example) can do a substitution (replacement) with this command:
s/«regular expression»/«replacement»/«options»
So what you want is to make a regular expression to match each construct in your format, which you already did in the language grammar, and then as the replacement string you specify how it should be transformed. Here you can use $& to refer to the entire match and $1-$n for captures (stuff captured with (…)).
Normally you would loop over each line, and do a transformation to test for each type of construct, but perl has a -p option which basically does that for you, so we can settle with the substitutions.
Looking at your example file (but not the language grammar) I arrived with the script and substitutions shown below (it may look a little complex, though mostly because of the escaping of slashes):
#!/usr/bin/perl -p
s/&/&/g; s/</</g; s///(.*)///<!--$1-->/g; s/^[A-Z].*:$/<h4>$&</h4>/; s/^EXT. .*$/<h2>$&</h2>/; s/^\w.*$/<p>$&</p>/; s/^(\t{4})([^\t].*)$/<dl>$1<dt>$2</dt>/; s/^(\t{3})([^\t].*)$/$1<dd class="parenthetical">$2</dd>/; s/^(\t{2})([^\t].*)$/$1<dd>$2</dd></dl>/; s/^(\t{10})([^\t].*:)$/$1<h3>$2</h3>/;
You can either save this script and run it with a file as stdin and have it output the result to stdout, or you can paste it directly into the bundle editor (as a new command) and set input to selection or document, and output to e.g. replace selection, like shown here:
Actually, after taking the grab, I added two lines to the script to escape & and < (since these are reserved HTML characters).
The ultimate goal is to end up with a PDF which contains text that conforms to the Studio Format [...]
I would suggest using htmldoc [1] for the HTML -> PDF conversion.
If you need further help, let me know (as I have no idea what your shell/programming skills are).