nathanhoad/fountain-js — pull request #3 by ottumm (2014-12-27 21:21:56+00:00)
Title: Support EventEmitter-based interface

If the option ``events: true`` is passed to fountain.parse, then return an event emitter that fires an event on every token type. The existing interface is not changed at all and all existing tests pass successfully.

The purpose of this change is to support more fine-grained control. For instance, an application could use this library to output in JSON, or XML, or a different HTML format. This decouples the parsing from the actual output.

Note: the default view of this diff is ugly, but if you view it ignoring whitespace it becomes much clearer and is much more minimal than it first appears. I'm definitely open to suggestions of how to make the change cleaner.