I'm writing a screenplay using Fountain mode. My org file is set up so there are multiple screenplays in a given file, for example
* Number one! #+begin_src fountain INT A PARK IN SAN FRANCISCO EMPEROR NORTON Being desirous of allaying the dissensions of party strife now existing within our realm, I do hereby dissolve and abolish the Democratic and Republican parties. #+end_src * Number two! #+begin_src fountain INT LETTERS DISPLAYED OVER A DESK PHILIP II OF MACEDON You are advised to submit without further delay, for if I bring my army into your land, I will destroy your farms, slay your people, and raze your city. letter is replaced SPARTA If. #+end_src
I want to run an external command to convert one of these screenplays into a pdf. Fountain mode does not have the export functionality I want. It currently has some, but it is being removed in a future release.
If I had the screenplay in a file by itself, I could run a command in bash using wrap:
wrap pdf my-screenplay.fountain. But it's not in a file by itself; it's a single source block.
So I'd like to be able to run a command on this single source block.
No org feature I've looked at seems to do this cleanly, although I might be missing something. I've looked at Org export, Org tangle, and Org publish, but as far as I can tell, they only act on a file as a whole.
How can I pass the contents of a single source block to an external command? Ideally I'd also be able to get the name of the headline before the command, so I can name each exported pdf differently.