tweaking table css, adding slugify filter

This commit is contained in:
evilchili 2023-12-15 21:51:57 -08:00
parent 3f75ac9ef6
commit 91fa27b86e
4 changed files with 32 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

@ -713,35 +713,21 @@ a.disabled:hover {
margin: 2em 0; margin: 2em 0;
} }
.statblock table.stats { .statblock table td {
border: 1px solid #000; text-align: left;
} }
.statblock table tr, .statblock table tr td { .statblock table tr td:first-of-type {
text-align: center;
background: inherit;
}
.statblock table tr th,
.statblock table tr td {
vertical-align: top;
padding-right: 2em;
}
.statblock table.properties td {
text-align: left
}
.statblock table.properties tr td:first-of-type {
font-weight: bold; font-weight: bold;
width: 10%; width: 10%;
white-space: nowrap; white-space: nowrap;
} }
.statblock table.properties tr td:first-of-type:last-of-type { .statblock table tr td:first-of-type:last-of-type {
font-weight: normal; font-weight: normal;
white-space: wrap;
} }
.statblock table tr:last-child,
.statblock table.properties tr:last-child, .statblock table tr:last-child {
.statblock table.properties tr:last-child {
padding-right: 1em; padding-right: 1em;
} }
.statblock table tr:nth-child(even) { .statblock table tr:nth-child(even) {
@ -750,21 +736,36 @@ a.disabled:hover {
.statblock table tr:nth-child(odd) { .statblock table tr:nth-child(odd) {
background: rgba(255,255,255, 0.3); background: rgba(255,255,255, 0.3);
} }
.statblock table.stats {
border: 1px solid #000;
}
.statblock dl { .statblock table.stats tr, .statblock table.stats tr td {
background: inherit;
}
.statblock table.stats tr th,
.statblock table.stats tr td {
text-align: center !important;
vertical-align: top;
padding-right: 2em;
}
.location dl {
display: flex; display: flex;
flex-flow: row; flex-flow: row;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: 100%;
overflow: visible; overflow: visible;
} }
.statblock dl dt { .location dl dt {
flex: 0 0 25%; flex: 0 0 25%;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
margin-bottom: 2em; margin-bottom: 2em;
} }
.statblock dl dd { .location dl dd {
flex:0 0 75%; flex:0 0 75%;
margin-left: auto; margin-left: auto;
margin-bottom: 3em; margin-bottom: 3em;

View File

@ -28,7 +28,7 @@
{% set target = article.title.replace(' ', '_') %} {% set target = article.title.replace(' ', '_') %}
{% if self.is_dm() or article.show_dm_content %} {% if self.is_dm() or article.show_dm_content %}
<div class='statblock'> <div class='location'>
<div style='cursor: pointer;' <div style='cursor: pointer;'
onclick="document.getElementById('{{target}}').style.display=((document.getElementById('{{ target }}').style.display=='none')?'':'none');" ><h3>{{ article.title }}</h3></div> onclick="document.getElementById('{{target}}').style.display=((document.getElementById('{{ target }}').style.display=='none')?'':'none');" ><h3>{{ article.title }}</h3></div>
<div id="{{ target }}" style='display:none;'> <div id="{{ target }}" style='display:none;'>

View File

@ -9,6 +9,10 @@ from pprint import pprint as print
from site_tools import SETTINGS from site_tools import SETTINGS
def _slugify(s):
return slugify(s, regex_subs=SETTINGS["SLUG_REGEX_SUBSTITUTIONS"])
def create( def create(
content_type: str, content_type: str,
title: str, title: str,
@ -23,8 +27,6 @@ def create(
""" """
base_path = Path.cwd() base_path = Path.cwd()
def _slugify(s):
return slugify(s, regex_subs=SETTINGS["SLUG_REGEX_SUBSTITUTIONS"])
template_path = Path(template_dir) template_path = Path(template_dir)
template_name = f"{template or content_type}.md" template_name = f"{template or content_type}.md"
if not (template_path / template_name).exists(): if not (template_path / template_name).exists():
@ -34,6 +36,8 @@ def create(
loader=FileSystemLoader(template_path), loader=FileSystemLoader(template_path),
trim_blocks=True, trim_blocks=True,
) )
env.filters['slugify'] = _slugify
env.add_extension("site_tools.extensions.RollTable") env.add_extension("site_tools.extensions.RollTable")
template_source = env.get_template(template_name) template_source = env.get_template(template_name)
@ -44,7 +48,6 @@ def create(
target_path = base_path / SETTINGS["PATH"] / relpath target_path = base_path / SETTINGS["PATH"] / relpath
dest = sanitised_join(str(target_path / target_filename)) dest = sanitised_join(str(target_path / target_filename))
#SETTINGS["WRITE_SELECTED"].append(dest)
writer = Writer(target_path, settings=SETTINGS) writer = Writer(target_path, settings=SETTINGS)
writer.write_file( writer.write_file(
name=target_filename, name=target_filename,