GithubHelp home page GithubHelp logo

Comments (21)

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024 1

Thanks a lot! However the problem with this is that although vscode is built on electron (and so nodejs) node isn't actually installed "system-wide" when you just install vscode (I think? I'm not super knowledgeable about how electron and nodejs work). Regardless, running exec('node') won't work on a clean install of vscode+betterfountain.

Unfortunately I think the only option to get this working "out of the box" is completely integrating afterwriting into betterfountain :/

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024 1

Work on integrating afterwriting is being done on the feature/afterwriting branch.

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024 1

So I've successfully ported the pdf export functionality from afterwriting right into this extension in the feature/newparser branch. The only problem left to figure out is error handling when exporting the PDF.

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

This is the relevant line.

The export to PDF function relies on an npm package called afterwriting. It's marked as a dependency in the extension's package.json, so normally it should get installed with the extension.

I'm pretty new to node.js and typescript, so I'm gonna assume i'm doing something really stupid. Any help is indeed welcome :)

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

I'll start looking into it. Are you able to export your .fountain files to PDF?

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

Worked when I ran npm install -g afterwriting.

I wonder why it didn't work "out of the box." I'll close this one since I'm set, but I'll see if I can't duplicate the issue on another computer tomorrow.

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

Ok so it turns out this issue isn't fixed, i'm going to try and directly integrate the required tools from afterwriting into the extension, to avoid all of this somewhat hacky cli stuff.

from betterfountain.

shazron avatar shazron commented on August 30, 2024

npm install is not run for a vscode extension: microsoft/vscode#23300 (comment)

But if you vsce pack it after running npm install, it should be included (unless specifically excluded in .vscodeignore)

Instead of using a globally pathed afterwriting, in your activation handler (where you call the afterwriting cli) get the absolute path to your bundled ./node_modules/afterwriting/awc.js and substitute your call to afterwriting with that.

Before (pseudocode):

exec(`afterwriting --source <other_options_here>...`)

After (pseudocode):

let afterwritingPath = context.asAbsolutePath(path.join('node_modules', 'afterwriting', 'awc.js'))
exec(`node ${afterwritingPath} --source <other_options_here>...` )

I haven't had a chance to test it yet and/or send a PR...

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

Found your next sprint, @piersdeseilligny. ^^lol

from betterfountain.

shazron avatar shazron commented on August 30, 2024

@piersdeseilligny You're right about node. Perusing the afterwriting code, it seems simple (famous last words! haha) since the code is basically in https://github.com/ifrost/afterwriting-labs/blob/master/js/client/client-controller.js

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

@shazron yup, simple until you run into protoplast everywhere, which is a custom library written by the dev of afterwriting with zero documentation :/

from betterfountain.

shazron avatar shazron commented on August 30, 2024

Thanks for this work! Much appreciated

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

I sent an email about afterwriting to Piotr Jamróz (the author), and basically the only way to correctly integrate afterwriting into betterfountain is to completely extract the logic to a separate library.

Therefore, the plan is to make fountain-js (powering the live preview) as good as afterwriting at parsing fountain, and then use the tokens obtained for the live preview to create the pdf, reusing code from afterwriting.

Gonna remove the breaking changes from the feature/afterwriting branch, merge the smaller ones to master, and simultaneously work on the pdf export in feature/pdf and improve fountain-js in master.

from betterfountain.

shazron avatar shazron commented on August 30, 2024

@piersdeseilligny thanks for this, makes sense. If you have architected this out and you need assistance writing some parts, let me know!

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

@shazron will do :) I'm still busy figuring out how exactly this is gonna work, but i'il let you know if I need help.

The current plan has changed since my last message: I'm going to replace the fountain-js parser with a port of the afterwriting one (just here), which is actually way better designed.

That requires slightly rewriting the way the html is obtained from the tokens, but it will be significantly easier to add the pdf export code from afterwriting once that's done. Also, consistency between the live preview and the rendered pdf is kind of a good thing.

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

Do you have a Patreon or something? I'd love to throw you $1/month for this.

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

@Quinncuatro Thanks a lot! I don't have a Patreon, but I just added a "Support via PayPal" button to README.md

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

@piersdeseilligny What kind of percentage is PayPal taking?

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

@Quinncuatro It depends on where you are, any currency conversion involved, and if you're paying by debit/credit or via a paypal balance/linked bank account. From what I can tell, it can be anywhere between 0% and 4%, which is still less than the 5% that Patreon takes.

from betterfountain.

Quinncuatro avatar Quinncuatro commented on August 30, 2024

@piersdeseilligny - https://github.com/sponsors

from betterfountain.

piersdeseilligny avatar piersdeseilligny commented on August 30, 2024

@Quinncuatro I know this is almost a year-old thread, but thanks for letting me know about that! My Github sponsors profile has been accepted, so it's now an option for anyone wishing to support this project.

from betterfountain.

Related Issues (20)

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.