diff --git a/docs/character_files.rst b/docs/character_files.rst index 710e449..f5120f0 100644 --- a/docs/character_files.rst +++ b/docs/character_files.rst @@ -11,7 +11,8 @@ Dungeonsheets expects one file per character, with a ``.py`` extension. This file is a python module, most likely with a series of -variables set describing the character. They are roughly grouped into +variables set describing the character. Any attribute beginning with +an underscore ('_') will be ignored. They are roughly grouped into sections, which are documented below. Additionally, some :ref:`examples` may be useful. diff --git a/dungeonsheets/make_sheets.py b/dungeonsheets/make_sheets.py index a9e8859..6b42a57 100755 --- a/dungeonsheets/make_sheets.py +++ b/dungeonsheets/make_sheets.py @@ -282,8 +282,15 @@ def make_gm_sheet( except exceptions.LatexNotFoundError: log.warning(f"``pdflatex`` not available. Skipping {basename}") elif output_format == "epub": + chapters = {session_title: "".join(content)} + # Make sheets in the epub for each party member + for char in party: + char_html = make_character_content(char, "html", + fancy_decorations=fancy_decorations) + chapters[char.name] = "".join(char_html) + # Create the combined HTML file epub.create_epub( - chapters={session_title: "".join(content)}, + chapters=chapters, basename=basename, title=session_title, use_dnd_decorations=fancy_decorations, diff --git a/dungeonsheets/readers.py b/dungeonsheets/readers.py index a548d67..b75d6d0 100644 --- a/dungeonsheets/readers.py +++ b/dungeonsheets/readers.py @@ -55,6 +55,10 @@ def read_sheet_file(filename: Union[str, Path]) -> dict: # Remove imported dungeonsheets modules char_props.pop("import_homebrew", None) char_props.pop("mechanics", None) + # Remove private variables (start with a '_') + for attr in list(char_props.keys()): + if attr[0] == "_": + char_props.pop(attr) return char_props diff --git a/examples/homebrew.py b/examples/homebrew.py index 61c08ca..f2ef0d4 100644 --- a/examples/homebrew.py +++ b/examples/homebrew.py @@ -9,7 +9,7 @@ sheet by running ``makesheets`` from the command line. from dungeonsheets import mechanics, import_homebrew # Load the module containing the homebrew content. -campaign = import_homebrew("homebrew_campaign.py") +_campaign = import_homebrew("homebrew_campaign.py") dungeonsheets_version = "0.9.4" @@ -96,10 +96,10 @@ class LegoShield(mechanics.Shield): base_armor_class = 114 -weapons = (DullSword, "rusty_shiv", campaign.BrightSword) # Example: ('shortsword', 'longsword') +weapons = (DullSword, "rusty_shiv", _campaign.BrightSword) # Example: ('shortsword', 'longsword') magic_items = (RobeOfBreadSummoning, "staff_of_the_arbor_abode") armor = PlasticArmor # Eg "leather armor" -shield = LegoShield # Eg "shield" +shield = LegoShield # Eg "shield" equipment = """TODO: list the equipment and magic items your character carries"""