Closed sigrunixia closed 1 year ago
I've actually been tinkering with this, as I'd noticed that some don't render correctly. That was specifically for 'special_abilities' though. I'll try and replicate what I did for all of the other items changed above and recreate the markdown for all of the monsters.
What I'm doing is:
s=str(monster_in['special_abilities'][sa]).encode('unicode_escape').decode('ASCII')
print(' desc:', '"'+s+'"', file=f)
If anyone knows a better way - shout please. What's the pythonic way to write a string that may contain newlines and other things so it gets correctly escaped?
I'll have to check how yaml likes it's newlines escaped, but I took the current and intended outputs and put them in a diff checker.
It appears that there are some places where the values have special yaml characters, and quotes have to be used to escape them. It seems like the easiest way to solve this is to wrap every string in quotes (which doesn't hurt anything in yaml) and only bothering to check for quotes to escape.
(I haven't used ttrpg statblocks before, so if there are quirks to how it works with yaml I wouldn't know about them)
The rule of thumb is if it has a special character, wrap it in a quote (or bracket style if using brackets, but quotes are more consistent).
While regular YAML is fine with the YAML as listed, Statblocks is doing an absurd amount of regex to search for dice rollers, spells, etc. The special characters unescaped and somethimes not wrapped in quotes breaks its ability to parse out what it should be rendering. Really, we expect statblocks to do too much, but it is what it is.
Wouldn't the best solution still be to wrap all values in quotes?
Some integers are fine, but it seems more and more a safe solution if its not a table array, is to just wrap everything. 👍🏻
@djbrock or @Craftidore
The script used to pull the data.
I am hoping one of you may be able to take point here. We're about to release a major update to IT Builder, and there is some file formatting issues with the bestiary that prevents IT from reading it. Specifically, there are about 1000 files that need to be re-pulled and wrapped to contain their special characters.
For example in Monster Babba Yaga.
needs to become