BlitzKraig / fvtt-EasyTable

Super simple CSV to rollable table creator for Foundry VTT
MIT License
15 stars 20 forks source link

Added ability to pull from PDF (hacky) #4

Closed JackDCondon closed 3 years ago

JackDCondon commented 3 years ago

So i added this for support for grabbing tables with heavy formatting inside of PDF. it works for both DCC and MCC. Im not expert at Regex so the code is.... Bad- but i thought id share as this will help me get spell results in! Thanks for your work!

BlitzKraig commented 3 years ago

Hi Jack,

Can you send me an example of some input data this helps with so I can check it out?

Thanks

JackDCondon commented 3 years ago

So the main issues are dealing with line breaks due to PDF formatting (graphics or other) as well as PDF tables being AWFUL! GASGEN As you can see here, the image cuts into each roll text causing issues. They will currently appear on new roll lines.

This pull request basically handles that by splitting each entry up, and then removing all line breaks.

Data can be seen here:

1 Failure, mutation may not be used again that day, roll on defects table. 2-11 Failure, mutation may not be used again that day. 12-13 The mutant releases a single puff of dense opaque gas that blinds a single target for 1d6 rounds, save to avoid. 14-17 The mutant releases a single puff of anesthetic gas that blinds and stuns a single target for 1d6 rounds, save to avoid. 18-19 The mutant releases a jet of poisonous gas that blinds a single target for 1d6 rounds and does 2d6 of damage from toxic fumes, save for half.

Cut off content here for Copy Right reasons.

Im not sure if this is out of scope or too specific- im not sure even if a PDF read option should be a feature of easy table at all, PDF can throw other curve balls but this is working for me pretty well and i thought id share.

BlitzKraig commented 3 years ago

Thanks for that, hopefully I'll find some time to take a look at it this week.

And thank you for your contribution! Do you mind if I make some changes on it myself, or would you rather I commented and left them to you?

JackDCondon commented 3 years ago

Not at all! No need for a credit at all as well! I think it's underserved. love your module and your work and it's motives and just wanted to point out a area I thought it could be even more powerful! Not sure if supporting pdf is a safe thing for the reasons above, my solution may be to simple to scale, and there may be no one glove fits all. But I didanage to provide tables for all mcc in a hour based off your work!

On Thu, 6 Aug 2020, 00:13 Craig C, notifications@github.com wrote:

Thanks for that, hopefully I'll find some time to take a look at it this week.

And thank you for your contribution! Do you mind if I make some changes on it myself, or would you rather I commented and left them to you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BlitzKraig/fvtt-EasyTable/pull/4#issuecomment-669217731, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWMJL3PXR4NQALMTP6XSVTR7FSI3ANCNFSM4PTMCCDQ .

BlitzKraig commented 3 years ago

Well this has been dormant for a long while, apologies for that!

I've added this in to 1.3.0, which will be releasing today. I was having a lot of trouble with it, before realising the other table I was testing it with was not using a hyphen, but a character that looked very close to one.

I've added this functionality in, along with the fake-hyphen. I've also tweaked the regex to check for tabs too, as the implementation in the PR does not work for entries that map to a single roll, and it appears to be working for all tested table types.

I've added a checkbox for a 'safemode' to skip this step, just in case it causes any problems.

Thanks again for your help with this, and sorry it took so long for me to get into it properly!