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, armor,
background, background,
classes, classes,
exceptions,
features, features,
infusions, infusions,
magic_items, magic_items,
@@ -270,7 +271,7 @@ class Character(Entity):
self._race = find_content(newrace, valid_classes=[race.Race])( self._race = find_content(newrace, valid_classes=[race.Race])(
owner=self owner=self
) )
except AttributeError: except exceptions.ContentNotFound:
msg = f'Race "{newrace}" not defined. Please add it to ``race.py``' msg = f'Race "{newrace}" not defined. Please add it to ``race.py``'
self._race = race.Race(owner=self) self._race = race.Race(owner=self)
warnings.warn(msg) warnings.warn(msg)
@@ -293,7 +294,7 @@ class Character(Entity):
self._background = find_content( self._background = find_content(
bg, valid_classes=[background.Background] bg, valid_classes=[background.Background]
)(owner=self) )(owner=self)
except AttributeError: except exceptions.ContentNotFound:
msg = ( msg = (
f'Background "{bg}" not defined. Please add it to ``background.py``' f'Background "{bg}" not defined. Please add it to ``background.py``'
) )
@@ -693,9 +694,9 @@ class Character(Entity):
@proficiencies_text.setter @proficiencies_text.setter
def proficiencies_text(self, val): def proficiencies_text(self, val):
try: try:
profs = profiencies_text.split(",") profs = val.split(",")
except AttributeError: except AttributeError:
profs = proficiencies_text profs = val
self._proficiencies_text = profs self._proficiencies_text = profs
@property @property
@@ -2,11 +2,11 @@
[% for shape in character.all_wild_shapes|sort(attribute='challenge_rating') %] [% 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> <h2 id="known-beasts-[[ shape.name | to_heading_id ]]">[[ shape.name ]]</h2>
[% if shape.description %] [% if shape.description %]
<p>[[ shape.description ]]</p> <p class="creature-description">[[ shape.description ]]</p>
[% endif %] [% endif %]
<table> <table>
+28 -6
View File
@@ -5,18 +5,33 @@ h1, h2, h3, h4, h5, h6 {
font-family: sans-serif; font-family: sans-serif;
} }
body { body {
background: #ECDDB4; background: #f4ecdb;
} }
table { table {
background: #ECEEE3; /* background: #ECEEE3; */
border-spacing: 0px;
font-family: sans-serif;
} }
tr:nth-child(even) { tr:nth-child(even) {
background: #CDD290; background: #E0E5C1;
} }
th { .stat-block {
font-family: sans-serif 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 %] [% else %]
/* Without Fancy decorations */ /* Without Fancy decorations */
@@ -62,11 +77,18 @@ dl.monster-spell-list a {
color: inherit; color: inherit;
text-decoration: inherit; text-decoration: inherit;
} }
.creature-description {
font-style: italic;
}
/* Spell descriptions */ /* Spell descriptions */
.spell-school { .spell-school {
margin-top: 0px;
font-style: italic; font-style: italic;
} }
.spell-block h2 {
margin-block: 0px;
}
/* Dictionary lists for showing stats, etc */ /* Dictionary lists for showing stats, etc */
dl.details dt { dl.details dt {
+19 -19
View File
@@ -1,14 +1,15 @@
<h1 id="gm-monsters">Monsters</h1> <h1 id="gm-monsters">Monsters</h1>
[% for monster in monsters|sort(attribute='name') %] [% 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 %] [% if monster.description %]
<h3>[[ monster.description ]]</h3> <p class="creature-description">[[ monster.description ]]</p>
[% endif %] [% endif %]
<!-- Basic properties --> <!-- Basic properties -->
<table> <table class="details">
<tr> <tr>
<th>Armor Class</th> <th>Armor Class</th>
<th>Hit Points</th> <th>Hit Points</th>
@@ -22,10 +23,10 @@
[[ monster.fly_speed ]] fly[% endif %][% if monster.burrow_speed %], [[ monster.fly_speed ]] fly[% endif %][% if monster.burrow_speed %],
[[ monster.burrow_speed ]] burrow[% endif %]</td> [[ monster.burrow_speed ]] burrow[% endif %]</td>
</tr> </tr>
</table> </table>
<!-- Attributes --> <!-- Attributes -->
<table> <table class="details">
<tr> <tr>
<th>STR</th> <th>STR</th>
<th>DEX</th> <th>DEX</th>
@@ -50,9 +51,9 @@
<td>([[ monster.wisdom.modifier|mod_str ]])</td> <td>([[ monster.wisdom.modifier|mod_str ]])</td>
<td>([[ monster.charisma.modifier|mod_str ]])</td> <td>([[ monster.charisma.modifier|mod_str ]])</td>
</tr> </tr>
</table> </table>
<dl class="monster-details details"> <dl class="monster-details details">
[% if monster.skills != "" %]<dt>Skills</dt><dd>[[ monster.skills ]]</dd>[% endif %] [% if monster.skills != "" %]<dt>Skills</dt><dd>[[ monster.skills ]]</dd>[% endif %]
<dt>Senses</dt><dd>[% if monster.senses != "" %][[ monster.senses ]][% else %]--[% endif %]</dd> <dt>Senses</dt><dd>[% if monster.senses != "" %][[ monster.senses ]][% else %]--[% endif %]</dd>
<dt>Languages</dt><dd>[% if monster.languages != "" %][[ monster.languages ]][% else %]--[% endif %]</dd> <dt>Languages</dt><dd>[% if monster.languages != "" %][[ monster.languages ]][% else %]--[% endif %]</dd>
@@ -62,10 +63,10 @@
[% if monster.condition_immunities != "" %]<dt>Condition Immunuties</dt><dd>[[ monster.condition_immunities ]]</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 %] [% if monster.saving_throws != "" %]<dt>Saving Throws</dt><dd>[[ monster.saving_throws ]]</dd>[% endif %]
<dt>Challenge<dd>[[ monster.challenge_rating ]]&nbsp;</dd> <dt>Challenge<dd>[[ monster.challenge_rating ]]&nbsp;</dd>
</dl> </dl>
[% if monster.spells | length > 0 %] [% if monster.spells | length > 0 %]
<dl class="monster-spell-list"> <dl class="monster-spell-list">
[% for level, spells in monster.spells | groupby('level') %] [% for level, spells in monster.spells | groupby('level') %]
<dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt> <dt>[% if level == 0 %]Cantrips[% else %]Level [[ level ]][% endif %]</dt>
<dd> <dd>
@@ -73,13 +74,12 @@
<a href="#monster-spells-[[ spell.name | to_heading_id ]]">[[ spell.name ]]</a>[% endfor %] <a href="#monster-spells-[[ spell.name | to_heading_id ]]">[[ spell.name ]]</a>[% endfor %]
</dd> </dd>
[% endfor %] [% endfor %]
</dl> </dl>
[% endif %] [% endif %]
[[ monster.__doc__ | rst_to_html(top_heading_level=2) ]]
[[ monster.__doc__ | rst_to_html(top_heading_level=2) ]]
</div>
[% endfor %] [% endfor %]
<h1 id="monster-spells">Monster Spells</h1> <h1 id="monster-spells">Monster Spells</h1>
+8 -8
View File
@@ -1,8 +1,8 @@
[% macro spellblock(spell, id_base="spells", heading_level=2) -%] [% 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"> <p class="spell-school">
<!-- Spell school and level --> <!-- Spell school and level -->
[% if spell.level > 0 %] [% if spell.level > 0 %]
[[ spell.magic_school ]] Level [[ spell.level ]] [[ spell.magic_school ]] Level [[ spell.level ]]
@@ -18,9 +18,9 @@
[% elif spell.concentration %] [% elif spell.concentration %]
(concentration) (concentration)
[% endif %] [% endif %]
</p> </p>
<dl class="spell-details details"> <dl class="spell-details details">
<dt>Casting Time</dt> <dt>Casting Time</dt>
<dd>[[ spell.casting_time ]]</dd> <dd>[[ spell.casting_time ]]</dd>
<dt>Duration</dt> <dt>Duration</dt>
@@ -29,10 +29,10 @@
<dd>[[ spell.casting_range ]]</dd> <dd>[[ spell.casting_range ]]</dd>
<dt>Components</dt> <dt>Components</dt>
<dd>[[ spell.component_string ]]</dd> <dd>[[ spell.component_string ]]</dd>
</dl> </dl>
<div class="spell-description"> <div class="spell-description">
[[ spell.__doc__ | rst_to_html(top_heading_level=1) ]] [[ spell.__doc__ | rst_to_html(top_heading_level=1) ]]
</div>
</div> </div>
[%- endmacro %] [%- endmacro %]