rnkn / fountain-mode Goto Github PK
View Code? Open in Web Editor NEWEmacs major mode for screenwriting in Fountain plain-text markup
Home Page: https://fountain-mode.org
License: GNU General Public License v3.0
Emacs major mode for screenwriting in Fountain plain-text markup
Home Page: https://fountain-mode.org
License: GNU General Public License v3.0
Using font-lock
for export is inefficient and limits extensibility. Switching to a lisp data model for parsing elements will greatly improve what Fountain Mode can do in the future.
A parsed Fountain element takes the form:
(TYPE PROPERTIES CONTENTS)
TYPE
is a symbol describing the Fountain elementPROPERTIES
is a property list taking the form (:beg INT :end INT &rest)
CONTENTS
is the string content or list of other elementsThis is in the works, currently adapting the macros in John Pate's screenplay LaTeX class.
Most of this is done, but getting MORE and CONT'D to work with splitting dialog across pages is a bit of a head-scratcher since I'm far from an expert in TeX. If anyone has any ideas, I've posted an outline of the problem on the XeTeX mailing list and on the TeX Stack Exchange. I'm all ears.
Sluglines should be automatically upcased while typing.
According to the spec, multiline values on the title page can be indented with tabs, but currently fountain-mode doesn't parse them correctly (using this test file: https://gist.github.com/anonymous/334a634d774a994b9266).
Mac OS 10.11.3, Emacs 25.0.91, commit 45db55a
Is it possible to make org-mode export fountain to HTML when it's in a larger org-mode file containing fountain-mode blocks here and there? I have a document that's mostly written in org-mode, with headings etc, but here and there I have source code blocks like this:
* Conflict and Character
This monologue from /The Social Network/ is another great example of a monologue
that defines the character's values at the same time as deepening the conflict
with his antagonists.
#+BEGIN_SRC fountain
GAGE
Do you think I deserve your full attention?
MARK
I had to swear an oath before we began this deposition, and I don't want to
perjure myself, so I have a legal obligation to say no.
GAGE
Okay... "No," you don't think I deserve your attention?
MARK
I think if your clients want to sit on my shoulders and call themselves tall
they have a right to give it a try. But there's no requirement that I enjoy
sitting here listening to people lie. You have _part_ of my attention--you have
the minimum amount. The rest of my attention is back at the offices of Facebook
where my colleagues and I are doing things that no one in this room, including
and especially your clients, are intellectually or creatively capable of doing.
Did I adequately answer your condescending question?
#+END_SRC
It would be great to be able to export the entire org-mode document to HTML, with org-mode syntax and fountain-mode syntax each converted to their corresponding HTML format.
The current boneyard syntax seems to mimic commenting syntax of C or (unofficial) CSS. In keeping with this format lineage, my suggestion is to also add the per-line commenting syntax:
/* This text is in a boneyard. */
// This text
// is in a boneyard,
this text is not,
// but this text is.
The reason for this is the same as for C: that if the user accidentally nests boneyard syntax there will be problems, i.e. that the nested opening comment will be ignored, while the nested closing comment will unintentionally close the first (forgotten) opening comment. Conversely, it becomes programmatically difficult to know when a user wishes to uncomment a line within a boneyard. (Highland's behavior appears to be try to nest comments, and, in doing so, introduces problems.)
Emacs gets around this by commenting each line individually when commenting is called interactively:
/* This text /
/ is in a boneyard, /
this text is not,
/ but this text is. */
This prevents any mistakes, but readability takes a big hit.
By allowing both styles of boneyard syntax, if the user is accustomed to commenting out long swaths of text, then selectively uncommenting a line here and there, this becomes very easy (either programmatically or manually). Developers would, at their option, include a preference for the default method of interactive commenting, however this would not dictate any difference in output if the combined syntax were used in parsing, i.e. anything commented out will be commented out regardless.
From the Take Fountain Glassboard
The UUID function currently only works with uuidgen
. It would be nice if it could work with any custom shell command.
I installed fountain-mode 20150618.116
in emacs 24.3.1
from melpa, and immediately after installation got the following warnings:
Compiling file /.../.emacs.d/elpa/fountain-mode-20150618.116/fountain-mode.el at Thu Dec 3 21:44:15 2015
In fountain-outline-cycle:
fountain-mode.el:1746:15:Warning: `<' called with 3 args, but requires 2
fountain-mode.el:1785:31:Warning: < called with 3 arguments, but accepts only
2
In fountain-set-font-lock-decoration:
fountain-mode.el:2460:13:Warning: `<=' called with 3 args, but requires 2
fountain-mode.el:2460:13:Warning: <= called with 3 arguments, but accepts only
2
Currently the exporter will skip over multiple blank lines, only ever exporting a single blank line. I think this is the right way to go (see https://github.com/rnkn/fountain-mode/wiki/Specification-Additions#multiple-blank-lines) however the current implementation only allows forcing a blank line by using two or more spaces. No one likes trailing whitespace, so I don't consider this a satisfactory solution.
Instead I'm proposing forcing blank lines with a single \
blackslash. Of course, if you really wanted a backslash on a line by itself, such a backslash could be escaped with another backslash \\
.
Make CSS mobile friendly, possibly employing percentage-based responsive design (inspired by Scrippets).
It seems that visual-line-mode
does not play nice with long text blocks (over 1400 characters) with a wrap-prefix
text property. This means that line navigation can become erratic in a moderately long block of dialog.
This appears to be a problem with visual-line-mode
but I will endeavour to find a workaround.
Proposed additions to the spec include:
~
prefix@
prefix!
prefixProposed depreciations to the spec include:
For more info: http://johnaugust.com/2014/fountain-1-1-use-the-force
Emphasis markup should create overlays (e.g. underline, bold). Since overlays are ignored on export, this will not interfere with elements, and emphasis spans are created through regexp replacement.
Unfortunately, outline.el
seems to have a bug when attempting to move the last outline subtree up, or the second-last subtree down. I've reported it to the maintainers here: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19102
I will endeavour for a workaround. In the meantime you can just use fountain-outline-cycle-global
then <C-S-backspace>
to kill the section or scene, re-position the point, then yank (C-y
) the text back.
Text properties applied by fountain-format-refresh
are not removed when switching to another major mode, resulting in text remaining aligned to indent columns.
Notes and metadata will use custom templates.
The list of content is as follows:
${longtime} Long date format (defined in `fountain-long-time-format')
${time} Short date format (defined in `fountain-short-time-format')
${fullname} User full name (defined in `user-full-name')
${nick} User first name (defined in `user-login-name')
${email} User email (defined in `user-mail-address')
${uuid} Insert a UUID (defined in `fountain-uuid-function')"
With the coming inclusion of scene numbers, the scene heading regular expression ought to include OMIT\(TED\)?
to pick up intentionally omitted scenes, e.g.
OMIT #17
OMITTED #18
This would technically be an extension to the Fountain spec.
As regexp grouping becomes more complex, it will be easier to just assoc the match-group integer rather than keep changing things throughout.
The current element predicate functions, e.g. fountain-dialog-p
, rely on the existing syntax for enforcing soft-unwrapping. As this is likely to change as the Fountain markup matures, preemptive rewriting of these functions should occur to allow for hard-wrapped lines.
Currently templates are defined then populated internally. This could be more user-friendly as an interactive skeleton.
Due to the way outline
is written (half of it recognises invisible headings, the other half doesn't), there's an incompatibility that means pressing TAB
within a scene with a forced scene heading will collapse the enclosing section (if there is one) or previous scene (if there is one).
If anyone runs into this bug, delete line 2539 in fountain-mode.el
, save, and reload Emacs.
https://github.com/rnkn/fountain-mode/blob/master/fountain-mode.el#L2539
Until I come up with a fix, this workaround will mean that hiding syntax characters (C-c C-x ! fountain-toggle-hide-syntax-chars
) will not hide the leading dot in forced scene headings, but outlining will work as expected.
At the moment, line-prefix
and wrap-prefix
are used to indent elements, but these only affect indentation from the left margin. This works as a helpful visual reference, but does not approximate a screenplay as well as I'd like.
It is possible to autofill text at an arbitrary fill-column, but this would affect the final PDF output, since the Fountain syntax does not treat explicit line-breaks properly.
As line-prefix
and wrap-prefix
are text properties, they do not affect the file contents and thus avoid the limitations of the syntax, however it is unfortunately not clear how to achieve non-destructive line-wrapping at an arbitrary column number in Emacs Lisp.
Suggestions welcome.
The continuing dialogue marker (CONT'D)
should be automatically added when the prior character in the same scene is equal to the current character. Conversely the marker should be removed when this becomes not the case.
The automatically called function fountain-font-lock-extend-region
works by extending the region for fontification to the next blank line. A buffer with a lot of text without any blank lines may hang Emacs.
I've changed the function to silently fail if it cannot find a blank line within 1000 characters, or throw an error when explicitly called (e.g. M-o M-o
). Update pushed out soon.
A difficult but not insurmountable task.
Ref #27
According to the fountain syntax, you can include empty lines within Dialogue by doing <RET><space<space><RET>
. From the documentation:
...However, fountain-mode does not seem to be exporting this correctly. The following text in fountain-mode:
VOICE
From the secret palaces of the Orient....from the modern masters at Hollywood Vividcolor ...comes the most alluring, most entrapping, most reality-altering lipstick ever.
<space><space>
Hypnotic Honeydew. It's not just a lipstick...it's pharmacological entrapment. Try it on that one special guy... He'll never know what hit him.
<space><space>
One kiss and he's helpless; one kiss and he's yours forever!
<space><space>
Remember, if you don't use it on, someone else will! Act now while there's still time!
<space><space>
Hypnotic Honeydew. Try it. Your life will never be the same again.
...exports HTML that looks like this:
...and exports PDF that looks like this:
Is there a way to make this work?
Hi there
I can't seem to get draft info and date to go on the title page when exporting to LaTeX.
I have something like this at the top of my .fountain file:
title: Pirates of the Pacific
credit: written by
author: me
draft: first draft
date: April 28, 2016
contact: [email protected]
I tried with the default variables. And I've tried adding this both to fountain-export-contact-template and fountain-title-contact-template:
${draft}
${date}
Cheers!
I'm currently working on a rewrite of the exporter to include automatic MORE and CONT'D when dialog splits over a page. This will obviously only apply to PDF output, but since HTML acts as an intermediary it's all being done with HTML/CSS.
You can see some progress here: http://www.princexml.com/forum/topic/2691/screenplay-dialog-formatting
Line breaks in title causes titling
package to seemingly forget \thetitle
, which adds a \par
at a line start, and results:
LATEX ERROR: THERE'S NO LINE HERE TO END.
apologies, but emacs noob.
When I start fountain mode under Aquamacs, my file is displayed in a non-fixed font, despite setting Courier-Prime as my default font everywhere.
How do I fix this?
thanks.
Supporting scene numbers is a multifaceted issue. There needs support for:
Please?
Given that ePub 3 is based on HTML5, it should not be a stretch to augment the exporter to create an ePub file with appropriate CSS for reflowable screenplay formatting.
Something for the roadmap.
Reference: https://github.com/idpf/epub3-samples
According to fountain.io, the character setting can be forced with the @
character, like this:
THOMPSON
Mr. MacDuff wants to see you.
O'BREEN
Oh, he's in town?
MacDUFF walks through the door.
@MacDUFF
Hi, how nice to see you!
It'd be nice if you implemented that in the WYSIWYG.
Thanks.
If scene headings can have an individual identifier (scene number), make the scene heading HTML element a hyperlink to itself, thus allowing bookmarking and sharing specific scenes.
Hello! Your Fountain mode is incredibly awesome... It may just actually pull me away from fountain with Sublime Text. Two quick questions. First, can the alignment of action elements be set? I see options for other elements (character, dialogue, etc.), but not action. I use Fountain for playwriting, which usually has wide dialogue and narrow narration (basically the opposite of screenwriting). Also, can I hack the alignment for PDF/HTML export for the same reasons? Thanks much!
All major modes should have imenu
integration.
Adding boneyard or note elements immediately above or onto character or parenthetical elements will interfere with the latter being properly recognised.
Complete compatibility with the Fountain specification requires support for dual dialogue. Requirements:
Instead of a single integer for each element, use an association list of ((FORMAT INT) ...)
.
Fountain Mode should read the format:
metadata value, look for a match in the association list and apply the corresponding INT as the element alignment column.
A line break in the title
metadata will show a <BR>
in the HTML page title.
Furthermore, if a writer is silly enough to use emphasis formatting in metadata, it will still export and look nice, but it will show up as something like <span class="underline"><strong>BRICK & STEEL</strong></span><br><span class="underline"><strong>FULL RETIRED</strong></span>
as the document title.
Depending on where Prince chooses to break a dialog block, sometimes the MORE dialog string will not sit flush with the last hanging line of dialog and you'll get an unattractive gap of whitespace. This is a limitation with Prince that they're working on fixing, but I don't have any estimate when.
It would be nice to have an option to export directty to pdf, that is, via LaTeX but without creating a tex buffer or file.
Something akin to org-latex-export-to-pdf
in orgmode.
In addition, there would probably have to be a couple of variables to customize the file name used and whether an existing pdf should be overwritten.
There is a bug in outline
that prevents outline headings from beginning with a character that has any invisible
text property, see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24073
Due to the workaround to fix #25 the forced scene heading .
currently are not hidden when setting fountain-hide-syntax-chars
to non-nil.
High on the agenda is the ability to export to PDF. Current forerunner method is via PrinceXML. LaTeX is the obvious choice, but may cause pagination issues.
I ran into problems exporting parentheticals with rainbow-delimiters-mode enabled in a fountain-mode buffer.
In the pdf output parenthetical text would be formatted correctly, but the surrounding parentheses would be left-aligned on their own lines, e.g.:
(
a parenthetical.
)
I think this happens because the export code looks for face transitions to format the exported document. Disabling rainbow-delimiters-mode in the fountain-mode-hook fixed the problem.
Thanks for the useful mode.
Currently fountain-font-lock-keywords
only highlights elements matching relatively few regexp matches. This is because many elements are recognised by functions that aren't compatible with Font Lock's search function.
Rewriting functions to work as Font Lock search functions will enable syntax highlighting of all elements.
Two or more spaces, recognised as an escaped paragraph break, will also be recognised as a character. This behaviour is undesirable.
Running Slackware Linux 14.1 and Emacs 24.3. Installed fountain-mode 1.5.0 from MELPA.
As soon as I enter the mode using M-x fountain-mode, every time a character is inserted into the buffer (typing text, pasting, etc) the following warning appears in the minibuffer:
Warning: defvar ignored because font-lock-end is let-bound
Looking at Messages, the full sequence of errors seems to be:
Warning: defvar ignored because font-lock-beg is let-bound
Warning: defvar ignored because font-lock-end is let-bound
I've tested it in emacs-24.3-no-x11 in an xterm (which I normally use), emacs-24.3-with-x11 as an X application, and on a true TTY... same warning. I tried using root, to see if it was a problem with my specific .emacs file / a conflict of packages I have installed... same warning. And finally, I created a new user on my system, with a completely clean .emacs and $HOME, set up MELPA, reinstalled, and then tried all three ways again... same warning. So, I am reasonably sure it isn't my emacs setup.
I am unfamiliar with both of those variables, and they don't seem to show up when I try to describe them (they are auto-corrected to font-lock-beginning-of-syntax-function and font-lock-comment-end-skip, respectively). I'm not very familiar with elisp or emacs packages (kind of a neophyte in that area, to be honest), so that could easily be the reason I don't know what the issue is.
Googling the issue didn't reveal anything useful on the first few tries, partly because this is usually not a repetitive warning: it usually shows up once, and either throws an exception or quiets down after (at least from what I have read). I'm not entirely sure what the long-ranging effects of the ignored defvar are, but if I could suppress the warning I might be able to work around them. As it stands, I can't really use the mode if I lose my minibuffer: it breaks my workflow.
Sorry if I am missing something obvious! I did a quick scan of both the open and closed issues here, and didn't see something similar to the problem I am having. I re-read the README, to see if there were more steps to be taken after installing from MELPA (aside from adding the file extension associations), and didn't see any listed.
I'm kind of at a loss at where to go from here. Any ideas?
Given that Mountain syntax is 100% compatible with Fountain, there's no need to do anything special to support it.
However, I'd like to implement at least a partial Mountain workflow in lisp, e.g. the user sets fountain-export-mountain
to non-nil and exports Fountain => Fountain, which inserts segments as per Mountain include:
directives, wrapped in appropriate reference: ... /reference
directives.
Going the other direction should be easy enough.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.