I write in Fountain markdown
http://fountain.io/ in Google Docs. Fountain is used for writing screenplays. I want to make writing in fountain a little friendlier by auto-capitalizing certain elements (on open or with a button, whatever).
Here is a correctly formatted screenplay (in fountain):
EXT. GAS STATION - DAY
Susie steps out of her car and walks toward the station attendant.
SUSIE
Hey, Tommy.
TOMMY
Where you been, Sue? Come on in.
They walk toward the station entrance together.
INT. GAS STATION - NIGHT
etc...
As you can see there is a ton of CAPS-LOCK and SHIFT business in screenwriting, and it gets tedious.
Which is why I want to write in lower-case (ie. int. gas station - day
) and have javascript/GAS find that text and uppercase it. Same with when a character speaks:
susie
Hey, Tommy.
would become
SUSIE
Hey, Tommy.
Characters speaking always have an empty line above their name and text on the next line. And scene headings ALWAYS start with either EXT. or INT.
I have had some kind help so far on Stackoverflow, but I'm still struggling to get this to work at all. I was given a great regex string that finds character names but GAS has a limited regex implementation. That regex is [\n][\n]([^\n]+)[\n][^\n|\s]/gi
. I have had no luck replacing text with regex. My JS skill is newborn baby, but I have completed CodeAcademy's beginner's JS course for what that's worth.
I would be grateful for any help in the right direction.