Closed Caedis closed 1 year ago
Your willingness to attempt debugging is awesome. ;)
p2fe and 5e are two separate (but akin) code paths. The roads diverge at src/main/java/dev/ebullient/convert/tools .. (dnd5e and pf2e).
There is a crazy inheritance structure for parsing (and it is done recursively). JsonTextConverter (in tools itself) is extended in pf2e by JsonTextReplacement (which handles {@thing.. }
and creating links), which itself is extended by JsonSource, which does most of the recursive parsing of entry text.
Within IntelliJ or VSCode, you can debug individual tests by type using tests from src/test/java/dev/ebullient/convert/tools/[dnd5e or pf2e]. There are three input variants (none: no sources (whatever the default is; subset: some sources; all: all the sources). These tests require content in a sources
directory (a symlink to where you've cloned Pf2e data, or the cloned directory itself would work).
Go right to item processing to debug variants: src/main/java/dev/ebullient/convert/tools/pf2e/Json2QuteItem.java
.. buildQuteResource
is where the individual json entry is torn into a million pieces and set as template data.
Probably need to gather variants separately, and then.. send the data as an attribute to src/main/java/dev/ebullient/convert/tools/pf2e/qute/QuteItem.java
, or merge it sensibly with other text headed that way. I'll let you see what feels right. ;)
Let me know if you have questions. ;)
Thanks!
Do you have any ideas on how to handle linking to item variants?
That is a good question. Have to look at how items are referenced in text (for when a variant should be used), and then: we either need sub-headings (###) or a block reference (^...) to link to the right place.
This is probably why I didn't do then out of the gate.. I wasn't sure which would work better.. a heading or a block reference, especially as I am not encumbered by making markdown look like a book. (I would go for a sub-heading first)
Good thing I already have the variants in my PR as sub-headings
How difficult would it be to show variants of items like how PF2eTools shows them?
Also, if I wanted to attempt adding it and submitting a PR, how do you debug this project in jetbrains idea?
Example JSON codeblocks