Skip to content

Code cleanups and cornercase bugfixes - #179

Open
PJBrs wants to merge 10 commits into
canismarko:masterfrom
PJBrs:cleanup
Open

Code cleanups and cornercase bugfixes#179
PJBrs wants to merge 10 commits into
canismarko:masterfrom
PJBrs:cleanup

Conversation

@PJBrs

@PJBrs PJBrs commented May 22, 2025

Copy link
Copy Markdown
Contributor

This PR includes a couple of fixes and some removal of unused / unnecessary code:

  • No more docutils warnings
  • Code removals include an unused variable, some unnecessary spell sorting, and fighting style in character.py
  • Fixes to the halfcaster pages, where a small bug could cause the latex character template to crash (when adding a spell of a higher level than the character's highest level spell slot)
  • Making sure to package all html forms, which otherwise might cause some tests to fail.

PJBrs added 10 commits May 22, 2025 22:19
Docutils spews a truckload of FutureWarnings:

The default for the setting "use_latex_citations" will change to "True" in
Docutils 1.0.
The default for the setting "legacy_column_widths" will change to "False" in
Docutils 1.0.

This patch sets both use_latex_citations to True, which means that it might
be necessary in the future to set legacy_column_widths to False. However,
at present that causes various latex errors.
Docutils are planning to set legacy_column_widths to False in the
future. Follow suit, add the required DUcolumnwidth definition to
our latex preamble, and make our own code a bit simpler as well!
Feature options have long been treated using the
FeatureSelector class. This also holds for fighting styles.
Remove the redundant code from the Features property in
character.py
Spells were sorted in various places where it wasn't really
necessary. Probably doesn't make a lot of difference, but it
is a little cleaner.
Previously, dungeonsheets assumed a halfcaster sheet when the character
didn't have any spell slots of sixth level and higher. However, there
are cases when a player would add such a spell to their character sheet
despite not having associated spell slots, for instance when granted
through a magic item. This would cause a bug in the latex character
template (cpu go to 100%, compilation never finishes). This patch
instead checks whether no such spells have been added.

Incidentally, the fillable forms have a similar problem. However, they
will just forget about spells at levels for which the player doesn't
have spell slots and finish compilation.
Previously, dungeonsheets assumed a halfcaster sheet when the character
didn't have any spell slots of sixth level and higher. However, there
are cases when a player would add such a spell to their character sheet
despite not having associated spell slots, for instance when granted
through a magic item. This patch instead checks whether no such spells
have been added.
Pytest complains about missing preamble.html. Make
sure that it gets packaged by explicitly adding all
html files to pyproject.toml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant