Change spell list importer/spell-lists.json to accept non-hyphenated strings

Issue #67 new
Crater created an issue

This is a very minor suggestion and I’m not sure how many people it’d help (maybe zero, lol), but I ran into this issue when using a custom spell list from the Compendium Browser addon so I’ll throw it here if you think it’s a good thing to implement.

I had a friend write up a python script to convert a spell list from that addon to your spell-lists.json format, but I ran into an issue when using the converted list due to the way that the spell names are parsed. The spells on the old list had no hyphens or spaces between them, and I couldn’t think of any feasible way to add those without manually adding them for each spell.

Line 13 of data.js reads/parses/compares spells from the spell list json (or something along those lines, I forget), replacing spaces with hyphens. Instead I suggest that on that line, replace hyphens with nothing at all (no spaces, no hyphens, etc) so that lists without spaces between the spell names (such as spell lists used by the above mentioned module) are compatible with the Obsidian spell list importer. I did test the change (simply replacing ‘-' with '’) and it seems to work alright so far.

I guess the downside of this would be that the current list would need to be converted to a non-hyphen version, but it’s much easier to Find & Replace hyphens/spaces in an IDE than it is to manually add hyphens/spaces to spell lists that don’t have them already. I might be missing a potential issue this could cause for other users or bugs it might create, but I’m not sure.

Comments (1)

  1. Kim Mantas repo owner

    There might be a possible solution whereby it can handle spell lists formatted in either fashion, since both are just transformations of the real spell name after all. Definitely low priority for now though. I would say for now your best bet is to take the data you had from before it was converted to work with the Compendium Browser, and run a script on it to make it compatible with obsidian because, as you say, it’s pretty much impossible to programmatically re-insert those spaces.

  2. Log in to comment