Coder Social home page Coder Social logo

rnkn / fountain-mode Goto Github PK

View Code? Open in Web Editor NEW
390.0 15.0 16.0 4.42 MB

Emacs major mode for screenwriting in Fountain plain-text markup

Home Page: https://fountain-mode.org

License: GNU General Public License v3.0

Emacs Lisp 98.86% Makefile 1.14%
emacs screenwriting writing fountain emacs-lisp scriptwriting

fountain-mode's People

Contributors

monnier avatar rnkn avatar snan avatar sten0 avatar syohex avatar zungbang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fountain-mode's Issues

Use lisp data model for export

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 element
  • PROPERTIES is a property list taking the form (:beg INT :end INT &rest)
  • CONTENTS is the string content or list of other elements

Per-line commenting with //

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

Auto-indent both margins

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.

Complete support for dual dialogue

Complete compatibility with the Fountain specification requires support for dual dialogue. Requirements:

  • syntax highlighting
  • element parsing
  • Fountain output
  • HTML output
  • Final Draft output
  • text output
  • PDF output

Support for forced character names

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.

line breaks in dialogue

According to the fountain syntax, you can include empty lines within Dialogue by doing <RET><space<space><RET>. From the documentation:

line breaks in dialogue

...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:
HTML

...and exports PDF that looks like this:

PDF

Is there a way to make this work?

Forcing blank lines

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 \\.

possible to export from an org-mode document with code blocks in fountain format?

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.

font-lock-extend-region bug

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.

Use custom templates for notes and metadata

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')"

non courier font on Aquamacs

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.

Make CSS mobile friendly

Make CSS mobile friendly, possibly employing percentage-based responsive design (inspired by Scrippets).

Inherited bug from outline.el

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.

Complete Support for scene numbers

Supporting scene numbers is a multifaceted issue. There needs support for:

  • syntax highlighting
  • align scene numbers to right margin
  • HTML export formatting
  • PDF export formatting
  • Final Draft export formatting
  • redisplaying scene numbers in the buffer margin
  • adding correct scene numbers with respect to existing surrounding scene numbers

Automatically add/remove continuing dialogue markers

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.

Scene heading regexp should include omitted scenes

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.

Support for Mountain include workflow

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.

Allow format-specific element alignment

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.

Export problem with rainbow-delimiters-mode

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.

Error while loading fountain-mode: called with 3 args, but requires 2

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

Forced scene headings do not collapse

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.

MORE dialog does not sit flush with dialog block

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.

Setting Action Alignment / Customizing Export Alignment

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!

Export to ePub

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

Overlays for emphasis markup

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.

Warning in Minibuffer on Every Insert

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?

Add Font Lock search functions

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.

visual-line-mode and wrap-prefix bug

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.

Export to PDF

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.

Export directly to pdf (via LaTeX)

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.

Date and draft on LaTeX title page

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!

Hyperlink HTML scene headings

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.

Create regexp group alist

As regexp grouping becomes more complex, it will be easier to just assoc the match-group integer rather than keep changing things throughout.

Line breaks in title cause <br> in HTML title

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.

Rewrite element predicate function for hard wrapping

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.