Closed mkasberg closed 3 years ago
Let me know what you think! Happy to work with you on any changes needed :slightly_smiling_face:
One more thing: there should be a simple integration test making sure that (non-empty) output of SanctoraleWriter
is accepted by SanctoraleLoader
.
Thank you very much, merging.
SanctoraleLoader
is a class that already exists to read a txt file into aSanctorale
instance. It would be nice to also have aSanctoraleWriter
class to do this operation in reverse, writingSanctorale
data to a txt file in the same format.The
SanctoraleWriter
is probably less complicated than the loader because we don't need to do any regex or other pattern matching. We simply iterate the celebrations in theSanctorale
and write a line for each.There was some room for judgement here because the file format allows for a couple different variations of the way months or ranks could be serialized. I opted to serialize using the preferences that
universal-en.txt
was already using, which also seemed to make the file the most readable. (E.g. We serialize month headings rather than writing the month on every line). An added benefit is that we can deserialize and then serializeuniversal-en.txt
and compare the results. I've done this, and the results are identical, except for the comment in the YAML frontmatter (which isn't stored in the Sanctorale).This fixes #60.