GM notes EPUB now contains monster spell descriptions.

This commit is contained in:
Mark Wolfman
2021-07-13 21:43:28 -05:00
parent d26f520666
commit 3df1906156
5 changed files with 64 additions and 40 deletions
+9 -4
View File
@@ -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 */
+12 -1
View File
@@ -68,7 +68,10 @@
<dl class="monster-spell-list">
[% for level, spells in monster.spells | groupby('level') %]
<dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt>
<dd>[[ spells | map(attribute='name') | join(', ') ]]</dd>
<dd>
[% for spell in spells %][% if not loop.first %], [% endif %]
<a href="#monster-spells-[[ spell.name | to_heading_id ]]">[[ spell.name ]]</a>[% endfor %]
</dd>
[% endfor %]
</dl>
[% endif %]
@@ -77,4 +80,12 @@
[% endfor %]
<h1 id="monster-spells">Monster Spells</h1>
[% from "spellblock.html" import spellblock %]
[% for spell in spell_list | sort(attribute="name") %]
[[ spellblock(spell, id_base="monster-spells") ]]
[% endfor %]
+38
View File
@@ -0,0 +1,38 @@
[% macro spellblock(spell, id_base="spells", heading_level=2) -%]
<h[[ heading_level ]] id="[[ id_base ]]-[[ spell.name | to_heading_id ]]">[[ spell.name ]]</h[[ heading_level ]]>
<p class="spell-school">
<!-- Spell school and level -->
[% if spell.level > 0 %]
[[ spell.magic_school ]] Level [[ spell.level ]]
[% else %]
[[ spell.magic_school ]] Cantrip
[% endif %]
<!-- Ritual and/or concentration -->
[% if spell.ritual and spell.concentration %]
(ritual, concentration)
[% elif spell.ritual %]
(ritual)
[% elif spell.concentration %]
(concentration)
[% endif %]
</p>
<dl class="spell-details details">
<dt>Casting Time</dt>
<dd>[[ spell.casting_time ]]</dd>
<dt>Duration</dt>
<dd>[[ spell.duration ]]</dd>
<dt>Range</dt>
<dd>[[ spell.casting_range ]]</dd>
<dt>Components</dt>
<dd>[[ spell.component_string ]]</dd>
</dl>
<div class="spell-description">
[[ spell.__doc__ | rst_to_html(top_heading_level=1) ]]
</div>
[%- endmacro %]
+2 -34
View File
@@ -63,41 +63,9 @@
<!-- Spell descriptions -->
[% from "spellblock.html" import spellblock %]
[% for spl in character.spells %]
<h2 id="spells-[[ spl.name | to_heading_id ]]">[[ spl.name ]]</h2>
<p class="spell-school">
<!-- Spell school and level -->
[% if spl.level > 0 %]
[[ spl.magic_school ]] Level [[ spl.level ]]
[% else %]
[[ spl.magic_school ]] Cantrip
[% endif %]
<!-- Ritual and/or concentration -->
[% if spl.ritual and spl.concentration %]
(ritual, concentration)
[% elif spl.ritual %]
(ritual)
[% elif spl.concentration %]
(concentration)
[% endif %]
</p>
<dl class="spell-details details">
<dt>Casting Time</dt>
<dd>[[ spl.casting_time ]]</dd>
<dt>Duration</dt>
<dd>[[ spl.duration ]]</dd>
<dt>Range</dt>
<dd>[[ spl.casting_range ]]</dd>
<dt>Components</dt>
<dd>[[ spl.component_string ]]</dd>
</dl>
<div class="spell-description">
[[ spl.__doc__ | rst_to_html(top_heading_level=1) ]]
</div>
[[ spellblock(spl, id_base="spells") ]]
[% endfor %]
+3 -1
View File
@@ -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(