Tweaked the style sheets for fancy decorations in epub.

This commit is contained in:
Mark Wolfman
2021-07-13 22:37:13 -05:00
parent 3df1906156
commit 70cb8ae30f
5 changed files with 137 additions and 114 deletions
+5 -4
View File
@@ -12,6 +12,7 @@ from dungeonsheets import (
armor,
background,
classes,
exceptions,
features,
infusions,
magic_items,
@@ -270,7 +271,7 @@ class Character(Entity):
self._race = find_content(newrace, valid_classes=[race.Race])(
owner=self
)
except AttributeError:
except exceptions.ContentNotFound:
msg = f'Race "{newrace}" not defined. Please add it to ``race.py``'
self._race = race.Race(owner=self)
warnings.warn(msg)
@@ -293,7 +294,7 @@ class Character(Entity):
self._background = find_content(
bg, valid_classes=[background.Background]
)(owner=self)
except AttributeError:
except exceptions.ContentNotFound:
msg = (
f'Background "{bg}" not defined. Please add it to ``background.py``'
)
@@ -693,9 +694,9 @@ class Character(Entity):
@proficiencies_text.setter
def proficiencies_text(self, val):
try:
profs = profiencies_text.split(",")
profs = val.split(",")
except AttributeError:
profs = proficiencies_text
profs = val
self._proficiencies_text = profs
@property
@@ -2,11 +2,11 @@
[% for shape in character.all_wild_shapes|sort(attribute='challenge_rating') %]
<div class="[% if not character.can_assume_shape(shape) %]known-beast-disabled[% endif %]">
<div class="stat-block[% if not character.can_assume_shape(shape) %] known-beast-disabled[% endif %]">
<h2 id="known-beasts-[[ shape.name | to_heading_id ]]">[[ shape.name ]]</h2>
[% if shape.description %]
<p>[[ shape.description ]]</p>
<p class="creature-description">[[ shape.description ]]</p>
[% endif %]
<table>
+28 -6
View File
@@ -5,18 +5,33 @@ h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
}
body {
background: #ECDDB4;
background: #f4ecdb;
}
table {
background: #ECEEE3;
/* background: #ECEEE3; */
border-spacing: 0px;
font-family: sans-serif;
}
tr:nth-child(even) {
background: #CDD290;
background: #E0E5C1;
}
th {
font-family: sans-serif
.stat-block {
background: #FDF1DC;
border-color: #E69A28;
border-width: 8px 0px;
border-style: solid;
margin: 16px 0px;
padding: 8px;
}
.stat-block .details {
color: #58180d;
}
.stat-block h2 {
margin-bottom: 0px;
}
.stat-block .creature-description {
margin-top: 0px;
}
[% else %]
/* Without Fancy decorations */
@@ -62,11 +77,18 @@ dl.monster-spell-list a {
color: inherit;
text-decoration: inherit;
}
.creature-description {
font-style: italic;
}
/* Spell descriptions */
.spell-school {
margin-top: 0px;
font-style: italic;
}
.spell-block h2 {
margin-block: 0px;
}
/* Dictionary lists for showing stats, etc */
dl.details dt {
+71 -71
View File
@@ -1,85 +1,85 @@
<h1 id="gm-monsters">Monsters</h1>
[% for monster in monsters|sort(attribute='name') %]
<h2 id="gm-monsters-[[ monster.name|to_heading_id ]]">[[ monster.name ]]</h2>
<div class="stat-block">
<h2 id="gm-monsters-[[ monster.name|to_heading_id ]]">[[ monster.name ]]</h2>
[% if monster.description %]
<h3>[[ monster.description ]]</h3>
[% endif %]
[% if monster.description %]
<p class="creature-description">[[ monster.description ]]</p>
[% endif %]
<!-- Basic properties -->
<table>
<tr>
<th>Armor Class</th>
<th>Hit Points</th>
<th>Speed</th>
</tr>
<tr>
<td>[[ monster.armor_class ]]</td>
<td>[[ monster.hp_max ]] ([[ monster.hit_dice ]])</td>
<td>[[ monster.speed ]][% if monster.swim_speed %],
<!-- Basic properties -->
<table class="details">
<tr>
<th>Armor Class</th>
<th>Hit Points</th>
<th>Speed</th>
</tr>
<tr>
<td>[[ monster.armor_class ]]</td>
<td>[[ monster.hp_max ]] ([[ monster.hit_dice ]])</td>
<td>[[ monster.speed ]][% if monster.swim_speed %],
[[ monster.swim_speed ]] swim[% endif %][% if monster.fly_speed %],
[[ monster.fly_speed ]] fly[% endif %][% if monster.burrow_speed %],
[[ monster.burrow_speed ]] burrow[% endif %]</td>
</tr>
</table>
[[ monster.fly_speed ]] fly[% endif %][% if monster.burrow_speed %],
[[ monster.burrow_speed ]] burrow[% endif %]</td>
</tr>
</table>
<!-- Attributes -->
<table>
<tr>
<th>STR</th>
<th>DEX</th>
<th>CON</th>
<th>INT</th>
<th>WIS</th>
<th>CHA</th>
</tr>
<tr>
<td>[[ monster.strength.value ]]</td>
<td>[[ monster.dexterity.value ]]</td>
<td>[[ monster.constitution.value ]]</td>
<td>[[ monster.intelligence.value ]]</td>
<td>[[ monster.wisdom.value ]]</td>
<td>[[ monster.charisma.value ]]</td>
</tr>
<tr>
<td>([[ monster.strength.modifier|mod_str ]])</td>
<td>([[ monster.dexterity.modifier|mod_str ]])</td>
<td>([[ monster.constitution.modifier|mod_str ]])</td>
<td>([[ monster.intelligence.modifier|mod_str ]])</td>
<td>([[ monster.wisdom.modifier|mod_str ]])</td>
<td>([[ monster.charisma.modifier|mod_str ]])</td>
</tr>
</table>
<!-- Attributes -->
<table class="details">
<tr>
<th>STR</th>
<th>DEX</th>
<th>CON</th>
<th>INT</th>
<th>WIS</th>
<th>CHA</th>
</tr>
<tr>
<td>[[ monster.strength.value ]]</td>
<td>[[ monster.dexterity.value ]]</td>
<td>[[ monster.constitution.value ]]</td>
<td>[[ monster.intelligence.value ]]</td>
<td>[[ monster.wisdom.value ]]</td>
<td>[[ monster.charisma.value ]]</td>
</tr>
<tr>
<td>([[ monster.strength.modifier|mod_str ]])</td>
<td>([[ monster.dexterity.modifier|mod_str ]])</td>
<td>([[ monster.constitution.modifier|mod_str ]])</td>
<td>([[ monster.intelligence.modifier|mod_str ]])</td>
<td>([[ monster.wisdom.modifier|mod_str ]])</td>
<td>([[ monster.charisma.modifier|mod_str ]])</td>
</tr>
</table>
<dl class="monster-details details">
[% if monster.skills != "" %]<dt>Skills</dt><dd>[[ monster.skills ]]</dd>[% endif %]
<dt>Senses</dt><dd>[% if monster.senses != "" %][[ monster.senses ]][% else %]--[% endif %]</dd>
<dt>Languages</dt><dd>[% if monster.languages != "" %][[ monster.languages ]][% else %]--[% endif %]</dd>
[% if monster.damage_resistances != "" %]<dt>Damage Resistances</dt><dd>[[ monster.damage_resistances ]]</dd>[% endif %]
[% if monster.damage_immunities != "" %]<dt>Damage Immunities</dt><dd>[[ monster.damage_immunities ]]</dd>[% endif %]
[% if monster.damage_vulnerabilities != "" %]<dt>Damage Vulnerabilities</dt><dd>[[ monster.damage_vulnerabilities ]]</dd>[% endif %]
[% if monster.condition_immunities != "" %]<dt>Condition Immunuties</dt><dd>[[ monster.condition_immunities ]]</dd>[% endif %]
[% if monster.saving_throws != "" %]<dt>Saving Throws</dt><dd>[[ monster.saving_throws ]]</dd>[% endif %]
<dt>Challenge<dd>[[ monster.challenge_rating ]]&nbsp;</dd>
</dl>
[% if monster.spells | length > 0 %]
<dl class="monster-spell-list">
[% for level, spells in monster.spells | groupby('level') %]
<dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt>
<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 %]
[[ monster.__doc__ | rst_to_html(top_heading_level=2) ]]
<dl class="monster-details details">
[% if monster.skills != "" %]<dt>Skills</dt><dd>[[ monster.skills ]]</dd>[% endif %]
<dt>Senses</dt><dd>[% if monster.senses != "" %][[ monster.senses ]][% else %]--[% endif %]</dd>
<dt>Languages</dt><dd>[% if monster.languages != "" %][[ monster.languages ]][% else %]--[% endif %]</dd>
[% if monster.damage_resistances != "" %]<dt>Damage Resistances</dt><dd>[[ monster.damage_resistances ]]</dd>[% endif %]
[% if monster.damage_immunities != "" %]<dt>Damage Immunities</dt><dd>[[ monster.damage_immunities ]]</dd>[% endif %]
[% if monster.damage_vulnerabilities != "" %]<dt>Damage Vulnerabilities</dt><dd>[[ monster.damage_vulnerabilities ]]</dd>[% endif %]
[% if monster.condition_immunities != "" %]<dt>Condition Immunuties</dt><dd>[[ monster.condition_immunities ]]</dd>[% endif %]
[% if monster.saving_throws != "" %]<dt>Saving Throws</dt><dd>[[ monster.saving_throws ]]</dd>[% endif %]
<dt>Challenge<dd>[[ monster.challenge_rating ]]&nbsp;</dd>
</dl>
[% if monster.spells | length > 0 %]
<dl class="monster-spell-list">
[% for level, spells in monster.spells | groupby('level') %]
<dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt>
<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 %]
[[ monster.__doc__ | rst_to_html(top_heading_level=2) ]]
</div>
[% endfor %]
<h1 id="monster-spells">Monster Spells</h1>
+31 -31
View File
@@ -1,38 +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 ]]>
<div class="spell-block">
<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 %]
<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>
<!-- 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>
<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 class="spell-description">
[[ spell.__doc__ | rst_to_html(top_heading_level=1) ]]
</div>
</div>
[%- endmacro %]