Giter VIP home page Giter VIP logo

Comments (1)

jonnygreenwald avatar jonnygreenwald commented on May 30, 2024 1

Heya! Apologies for the late response, but I've been thinking on your question while offline.

Version 1.0.0 of this library is a fork of Matt Daly's Fountain.js and originally was just a pet project for me to try out a Typescript conversion. So, to answer your question, that's how Matt designed the token schema, so I preserved it for those who wanted to continue to use his library.

As these things go, it's obviously grown somewhat beyond that original intention and perhaps it's time to modernize. To do this would require a major bump (version 2.0.0).

I'm for it and was considering, if going for a major, to also implement an options object akin to marked.js.

let output = fountain.parse('string', {
    extensions: true,
    tokens: true
});

My thinking here is, it opens the door for additional options, like expanding rendering, or adding helpful additions that may b out of Fountain's intended spec such as parsing extensions like (O.S.) or V.O..

Regarding token structure, I'd like to be thoughtful here and think about how to organize blocks and tokens, perhaps taking some notes from CommonMark on organization, etc.

Here's an initial example:

{
type: 'script',
title: { ... },
tokens: [
...
  { type: 'action', text: 'Jen runs into directly into AMELIA.</br>Coffee goes everywhere.'}
  // a `dual-dialogue` block would hold two dialogue blocks, etc.
  {
    type: 'dialogue',
    name: 'Jen',
    tokens: [
      { type: 'speech', text: 'Nice --',
      { type: 'parenthetical', text: '(through gasps of air)'},
      { type: 'speech', text: 'to meet you...'},
    ]
  }
...
]}

This keeps the structure somewhat similar to how the parser works now, like I'm not putting action or speech into a block like you could, but it creates a more recognizable AST that (hopefully) addresses your question.

I'd like to take a crack at it initially and flesh out the idea, but would love initial input from you or past contributors like @zenibako and @rezonant as well as would like reviews of the PR before push.

from fountain-js.

Related Issues (7)

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.