diff --git a/docs/gm_notes.rst b/docs/gm_notes.rst index 7a7d0a5..4b739c9 100644 --- a/docs/gm_notes.rst +++ b/docs/gm_notes.rst @@ -65,20 +65,25 @@ Adding Arbitrary Content ======================== Additional content can be included in arbitrary sections that get -added to the end of the GM notes output. In addition to the attributes -described above, suitable extra attributes in the notes (``.py``) file -will be rendered as a new section, with a heading based on the name of -the attribute and a body with the content parsed as restructured -text. Attributes that begin with an underscore ("_") or those that are -not a string will be ignored. +added after the summary of the GM notes output. The ``extra_content`` +attribute can accept a list of content that will be rendered as +sections in the output document. Any subclass of *mechanics.Content* +can be used. The section heading will be the *name* attribute of each +piece of content, and the body will be the docstring. For example, the following entry will be rendered as a new section with the heading "The Bar Fight": .. code-block:: python - the_bar_fight = ( - "If the characters decide to go to the *Alliance Friendly Bar*, " - "they will probably have to fight their way out against 5 enemies " - "(3 Veteran, 2 Soldier)." - ) + from dungeonsheets import mechanics + + class BarFight(mechanics.Content): + """If the characters decide to go to the *Alliance Friendly Bar*, + they will probably have to fight their way out against 5 enemies + (3 Veteran, 2 Soldier). + + """ + name = "The Bar Fight" + + extra_content = [BarFight, ] diff --git a/dungeonsheets/make_sheets.py b/dungeonsheets/make_sheets.py index 50d9be0..fccf809 100644 --- a/dungeonsheets/make_sheets.py +++ b/dungeonsheets/make_sheets.py @@ -239,6 +239,12 @@ def make_gm_sheet( use_dnd_decorations=fancy_decorations, ) ) + # Parse any extra homebrew sections, etc. + content.append( + create_extra_gm_content(sections=gm_props.pop("extra_content", []), + suffix=content_suffix, + use_dnd_decorations=fancy_decorations) + ) # Add the monsters monsters_ = [] for monster in gm_props.pop("monsters", []): @@ -272,12 +278,6 @@ def make_gm_sheet( use_dnd_decorations=fancy_decorations, ) ) - # Parse any extra homebrew sections, etc. - content.append( - create_extra_gm_content(sections=gm_props.pop("extra_sections", []), - suffix=content_suffix, - use_dnd_decorations=fancy_decorations) - ) # Add the closing TeX content.append( jinja_env.get_template(f"postamble.{format_suffixes[output_format]}").render( diff --git a/examples/gm-session-notes.py b/examples/gm-session-notes.py index 6fedc86..7e0dbac 100644 --- a/examples/gm-session-notes.py +++ b/examples/gm-session-notes.py @@ -56,4 +56,4 @@ class BarFight(mechanics.Content): name = "The Bar Fight" -extra_sections = [BBEGMotivation, BarFight] +extra_content = [BBEGMotivation, BarFight]