Resources for developers who want to incorporate Fountain in their applications
To encourage and ease integration of Fountain into your own apps we’re making our own Fountain code available to you under a permissive MIT license. The code was designed for our own use, so your mileage may vary, but we’re hoping this will at least help you get going with Fountain.
The Xcode project includes files to read and write Fountain files, and stores the file in a fairly generic data model. If this model is insufficent for your needs, or you have your own model you’d like to use, we recommend using a converter to bridge the two models.
One important note: we do not deal with text styling (bold, italic, underline, etc) in the parser or data model. We retain the styling and pass it along for downstream use. That is, whatever is supposed to display or print the Fountain file should handle text styling and clean up of the styling markup. We think that’s just easier on everyone. We’ve included regular expressions for text styling, in case you need them.
This implementation of Fountain make heavy use of regular expressions. For this, we apologize. But, this should make it fairly easy to port our implementation to other platforms. FountainRegexes holds all the regular expressions used by the other classes, and then some.
FNScript is intended to make it easy to drop Fountain support into new apps. FNScript handles reading and writing of Fountain files, and holds the script content. The content of the script is represented as an NSArray of FNElements, and the title page is an NSArray of NSDictionary items.
This is the data model for the script elements.
FountainParser provides class methods to read a Fountain script’s title page and script body separately. The body is returned as an NSArray of FNElements, and the title page is returned as an NSArray of NSDictionary items.
FountainWriter provides class methods to convert an FNScript into a Fountain NSString.
-licucorelinker flag to be added to your project. See http://regexkit.sourceforge.net/RegexKitLite/#AddingRegexKitLitetoyourProject for help enabling RegexKitLite in your project.
If you don’t want to use RegexKitLite you can remove the references to it in FountainParser.m and FountainWriter.m. You shouldn’t have to change much code outside those files to change the regex library. While the regular expressions should be compatible with most standard regex implementation, you might have to massage them to work with a different library. Good luck with that.
The Xcode project includes unit tests, along with sample files to play around with.
All code is copyright Nima Yousefi & John August. Released under an MIT license. Do whatever you want with this code, but it would be super cool if you shared your improvements with the world.
See the included LICENSE file for legal jargon.
Fountain comes from several sources. John August and Nima Yousefi developed Scrippets, which used simple markup to embed screenplay-formatted material in websites. Stu Maschwitz drafted a more extensive spec known as Screenplay Markdown or SPMD, designed for full-length screenplays.
Stu and John discovered that they were simultaneously working on similar text-based screenplay formats, and merged them into what you see here. Other contributors to the spec include Martin Vilcans, Brett Terpstra, Jonathan Poritsky, and Clinton Torres.
The code included here was developed by Nima Yousefi and John August, with copious emotional and spiritual support by Ryan Nelson and Stuart Friedel. However, all invectives should be directly solely at Nima Yousefi (don’t worry, he has it coming).