ebullient / ttrpg-convert-cli

Utility to convert JSON data (for content you own) from 5etools or pf2etools into Obsidian-friendly Markdown.
https://www.ebullient.dev/projects/ttrpg-convert-cli/
Apache License 2.0
152 stars 35 forks source link

Add bestiary support #423

Closed miscoined closed 2 months ago

miscoined commented 3 months ago

This is the start of an attempt to help out with adding bestiary conversion support. Most of this is from the commit you had in your other branch - I've just added the remaining bits required to get the export working.

I thought I'd share my progress early so you can chime in with any feedback - I'm still planning on adding support for the other fields.

ebullient commented 2 months ago

How ready is this? The PR build, atm, is a sniff test, it doesn't have full data present (which is something I'll fix shortly)

PR builds will now work against cached data. In the meanwhile, I caught broken pf2e image paths (Image paths have been whack-a-mole for me...), which I've hopefully fixed.

miscoined commented 2 months ago

Most of the tests are passing and what's implemented so far seems to work (mostly via spot checking for odd cases when I implement each one).

The current failing test is due to an unresolved ^statblock link for Unseen Servant, where the Unseen Servant spell links to the creature. I'm guessing it's easy enough to fix by adding a ^statblock block label to the creature template, but at the moment the template isn't using a fantasy-statblocks entry just to make the initial implementation easier.

Other than that, it's pretty much ready provided that you're alright with currently only supporting a subset of the fields (and I can open another PR for the others).

ebullient commented 2 months ago

Other than that, it's pretty much ready provided that you're alright with currently only supporting a subset of the fields (and I can open another PR for the others).

Piecewise is the way to go. Tests have to pass, though. ;)

The current failing test is due to an unresolved ^statblock link for Unseen Servant, where the Unseen Servant spell links to the creature. I'm guessing it's easy enough to fix by adding a ^statblock block label to the creature template, but at the moment the template isn't using a fantasy-statblocks entry just to make the initial implementation easier.

Fantasy statblocks is not a requirement. The default 5e monster template uses a plain markdown statblock. You should also be able to reuse the existing monster template w/ embedded template (or however I did that, I forget). As an example, the feat template is reused as an embedded template. There is a special line demarcating the standalone note header from the reusable/embeddable content: https://github.com/ebullient/ttrpg-convert-cli/blob/7eea3bc5e261d5b0eb64a62d122a0d821a86d4e1/src/main/resources/templates/toolsPf2e/feat2md.txt#L13 .. you can follow that to include the OOTB creature template w/ a plain markdown statblock

Make sure you rebase, additional eyes on the Pf2e content (especially copied images) will be appreciated. ;)

ebullient commented 2 months ago

one thing for the statblock: I do use admonitions so the hover will grab the whole thing, https://github.com/ebullient/ttrpg-convert-cli/blob/7eea3bc5e261d5b0eb64a62d122a0d821a86d4e1/src/main/resources/templates/tools5e/monster2md.txt#L22

If you test that out, I think you'll see what I mean. That does start to look weird with inline/embedded reference, so you'll want to play with that a bit.

miscoined commented 2 months ago

I'm fairly new to using git forks, so apologies if the history is particularly messy. Let me know if there's anything I can do to fix it. Am happy to squash it all into single commit also.

ebullient commented 2 months ago

oh dear. You merged rather than rebased

miscoined commented 2 months ago

Did I? Sorry, I'm fairly new to open source contribution with git - I ran git rebase upstream/main, but I think something went wrong afterwards when trying to push back to my branch, and I don't see any merge commits in there. Although I don't know why one of my commits appears to have duplicated. If it's easier I'm happy to scrap this one and remake the changes over in a new branch.

ebullient commented 2 months ago

a) make a backup branch just in case. ;) b) reset --hard to this (I fixed the history so it matches) c) make sure we didn't drop anything by accident

If we're all good, I'll squash and merge.