diff --git a/dungeonsheets/forms/dungeonsheets_epub.css b/dungeonsheets/forms/dungeonsheets_epub.css index a98872a..28d76e6 100644 --- a/dungeonsheets/forms/dungeonsheets_epub.css +++ b/dungeonsheets/forms/dungeonsheets_epub.css @@ -47,15 +47,20 @@ ul.spell-list li { padding-left: 17px; position: relative; } +ul.spell-list li.prepared:before { + content: '\2713'; + position: absolute; + left: 0; +} ul.spell-list a { /* Make spell list entries not look like links */ color: inherit; text-decoration: inherit; } -ul.spell-list li.prepared:before { - content: '\2713'; - position: absolute; - left: 0; +dl.monster-spell-list a { + /* Make spell list entries not look like links */ + color: inherit; + text-decoration: inherit; } /* Spell descriptions */ diff --git a/dungeonsheets/forms/monsters_template.html b/dungeonsheets/forms/monsters_template.html index 17d1b87..6d521c3 100644 --- a/dungeonsheets/forms/monsters_template.html +++ b/dungeonsheets/forms/monsters_template.html @@ -68,7 +68,10 @@
[% for level, spells in monster.spells | groupby('level') %]
[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]
-
[[ spells | map(attribute='name') | join(', ') ]]
+
+ [% for spell in spells %][% if not loop.first %], [% endif %] + [[ spell.name ]][% endfor %] +
[% endfor %]
[% endif %] @@ -77,4 +80,12 @@ +[% endfor %] + +

Monster Spells

+ +[% from "spellblock.html" import spellblock %] + +[% for spell in spell_list | sort(attribute="name") %] +[[ spellblock(spell, id_base="monster-spells") ]] [% endfor %] diff --git a/dungeonsheets/forms/spellblock.html b/dungeonsheets/forms/spellblock.html new file mode 100644 index 0000000..0912343 --- /dev/null +++ b/dungeonsheets/forms/spellblock.html @@ -0,0 +1,38 @@ +[% macro spellblock(spell, id_base="spells", heading_level=2) -%] + +[[ spell.name ]] + +

+ + [% if spell.level > 0 %] + [[ spell.magic_school ]] Level [[ spell.level ]] + [% else %] + [[ spell.magic_school ]] Cantrip + [% endif %] + + + [% if spell.ritual and spell.concentration %] + (ritual, concentration) + [% elif spell.ritual %] + (ritual) + [% elif spell.concentration %] + (concentration) + [% endif %] +

+ +
+
Casting Time
+
[[ spell.casting_time ]]
+
Duration
+
[[ spell.duration ]]
+
Range
+
[[ spell.casting_range ]]
+
Components
+
[[ spell.component_string ]]
+
+ +
+ [[ spell.__doc__ | rst_to_html(top_heading_level=1) ]] +
+ +[%- endmacro %] diff --git a/dungeonsheets/forms/spellbook_template.html b/dungeonsheets/forms/spellbook_template.html index f2daf31..8e10a81 100644 --- a/dungeonsheets/forms/spellbook_template.html +++ b/dungeonsheets/forms/spellbook_template.html @@ -63,41 +63,9 @@ +[% from "spellblock.html" import spellblock %] [% for spl in character.spells %] -

[[ spl.name ]]

- -

- - [% if spl.level > 0 %] - [[ spl.magic_school ]] Level [[ spl.level ]] - [% else %] - [[ spl.magic_school ]] Cantrip - [% endif %] - - - [% if spl.ritual and spl.concentration %] - (ritual, concentration) - [% elif spl.ritual %] - (ritual) - [% elif spl.concentration %] - (concentration) - [% endif %] -

- -
-
Casting Time
-
[[ spl.casting_time ]]
-
Duration
-
[[ spl.duration ]]
-
Range
-
[[ spl.casting_range ]]
-
Components
-
[[ spl.component_string ]]
-
- -
- [[ spl.__doc__ | rst_to_html(top_heading_level=1) ]] -
+[[ spellblock(spl, id_base="spells") ]] [% endfor %] diff --git a/dungeonsheets/make_sheets.py b/dungeonsheets/make_sheets.py index 0d99941..235d62f 100755 --- a/dungeonsheets/make_sheets.py +++ b/dungeonsheets/make_sheets.py @@ -86,7 +86,9 @@ def create_monsters_content( ) -> str: # Convert strings to Monster objects template = jinja_env.get_template(f"monsters_template.{suffix}") - return template.render(monsters=monsters, use_dnd_decorations=use_dnd_decorations) + spell_list = [spell for monster in monsters for spell in monster.spells] + return template.render(monsters=monsters, + use_dnd_decorations=use_dnd_decorations, spell_list=spell_list) def create_party_summary_content(