rnkn / fountain-mode

Emacs major mode for screenwriting in Fountain plain-text markup
https://fountain-mode.org
GNU General Public License v3.0
391 stars 16 forks source link

Adding in one way fdx import (WIP) #148

Closed ghost closed 1 month ago

ghost commented 1 month ago

I just forked a few minutes ago and trying my hand at importing fdx (final draft xml) XML files. I don't know how long this will take, but consider this a WIP draft until then.

I'll have this licensed under the same licensed fountain-mode uses, GPL-3.0. Depending on how big this gets, you can credit/attribute me as matthew polk, not my username because I don't know if I'll keep this account or not. I emailed you a bit ago about this, and wanted to try to see if I could do it myself and then merge with you. fdx export isn't a high need right now, but I would say that given how popular fdx is used, a one way import would be beneficial.

ghost commented 1 month ago

This is getting really ugly right now. But so far so good. Let me know what you think so far. If you like more fdx files, I can provide easily.

rnkn commented 1 month ago

Hi Michael Matthew,

Have a read of the Emacs Elisp manual. That will give you a good idea of the conventions used in Elisp.

Put this in contrib/ as something like fountain-fdx.el that way you're able to shoulder the maintenance burden as I won't be able to. You'll need to (provide 'fountain-fdx) at the end. Using auto-insert will give you all you need re copyright/license. Also remember to prefix your functions with fountain-fdx- to keep the namespace clean.

Thanks for your work.

rnkn commented 1 month ago

Also, just use xml-parse-file. Trying to manually parse an XML file is not advisable.

ghost commented 1 month ago

Hi Michael,

Have a read of the Emacs Elisp manual. That will give you a good idea of the conventions used in Elisp.

Put this in contrib/ as something like fountain-fdx.el that way you're able to shoulder the maintenance burden as I won't be able to. You'll need to (provide 'fountain-fdx) at the end. Using auto-insert will give you all you need re copyright/license. Also remember to prefix your functions with fountain-fdx- to keep the namespace clean.

Thanks for your work.

Thanks for the tip. I got just enough elisp knowledge to get what I did done so far, and still got a lot to learn.

Also, just use xml-parse-file. Trying to manually parse an XML file is not advisable.

Will do. Thanks for reminding me of that ability.

Also, in the possible (You never know), I end up not taking the route of doing writing, we can thankfully keep it as an extension so anyone else can fix it up if necessary. I don't see the xml spec changing much, it's not a binary file like it used to be, so it should be very future proof.

Also, it's matthew, not michael, you made a typo with my name. Keep up the good work with fountain-mode.

rnkn commented 1 month ago

Sorry! Matthew!

ghost commented 1 month ago

I made an effort with the xml parsing capabilities and so far no success. XML is a pain in the arse by nature, so this will be a bit tricky. Any advice? I only wanted a portion of the xml file since fountain doesn't report back statistics or needs the formatting settings in the xml markup.

ghost commented 1 month ago

I'm considering putting this on the backburner for a while and practice my elisp till I know enough to tackle this.

ghost commented 1 month ago

@rnkn Would you be okay if I decided to instead make this a perl script (or maybe python) since you already use groff and other external tools anyways? I feel it be less likely to induce feature creep that way.

ghost commented 1 month ago

@rnkn I think I got something working with a perl script. It appears to return to STDOUT just fine with proper formatting. Let me know what you think. It's very short in fact.

ghost commented 1 month ago

I wanted to add that I decided on an external script (which ended up being perl, I like perl), is because I wanted to detach dependency on emacs so anyone can use it even if they don't use emacs. That is one pro I can definitely list going this way. Plus it means less of a burden to me on everyone.

rnkn commented 1 month ago

Given you're doing this in Perl, why are you doing it as part of Fountain Mode and not as an external tool like Screenplain, TextPlay or afterwriting? Usually only Elisp files are distributed with Emacs packages, and when other executables are included they're not installed in PATH.

ghost commented 1 month ago

Given you're doing this in Perl, why are you doing it as part of Fountain Mode and not as an external tool like Screenplain, TextPlay or afterwriting? Usually only Elisp files are distributed with Emacs packages, and when other executables are included they're not installed in PATH.

I'll just close the pull request and keep what I wanted as a separate component. Thanks for your work on fountain-mode and keep up the good work.