Changed the styling for generate_pdf_emoji_support.py

main
David 2 days ago
parent 79ca7ab62a
commit 4bc2190d27

@ -29,6 +29,7 @@ def main():
# Read the TSV data
with open(input_tsv, 'r', encoding='utf-8-sig') as f:
reader = csv.DictReader(f, delimiter='\t')
rows = list(reader)
rows = sorted(rows, key=lambda r: r.get("Sending locality:", "").strip())
pdf = FPDF(format='Letter', unit='pt')

@ -102,102 +102,143 @@ def main():
<html lang="en">
<head>
<meta charset="UTF-8">
""" + rf"""
<title>{os.path.basename(output_pdf)}</title>
""" + r"""
<title>Data Report</title>
<style>
@page {
size: Letter;
margin: 50px;
}
body {
font-family: sans-serif;
font-size: 12pt;
line-height: 1.3; /* Slightly tighter than 1.4 */
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 11pt;
line-height: 1.5;
margin: 0;
padding: 0;
color: #2c3e50;
}
.trainee-page {
margin-bottom: 1em;
page-break-after: always; /* Force new page for each trainee */
margin-bottom: 2em;
page-break-after: always;
}
h1 {
font-size: 16pt;
margin: 0 0 0.3em 0; /* reduced bottom margin */
font-size: 18pt;
margin: 0 0 0.5em 0;
color: #1a365d;
}
h2 {
font-size: 14pt;
margin: 0 0 0.7em 0; /* reduced bottom margin */
margin: 0 0 1em 0;
color: #4a5568;
}
/* General paragraph spacing reduced */
p {
margin: 0.2em 0; /* Very small vertical margin */
white-space: pre-wrap; /* preserve any line breaks from the data */
margin: 0.5em 0;
white-space: pre-wrap;
}
.comments-label {
font-weight: 500;
margin-top: 1em;
margin-bottom: 0.2em;
color: #7c3aed;
font-size: 10.5pt;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.comments-value {
margin-top: 0;
margin-bottom: 1em;
color: #6c757d;
font-style: italic;
margin-top: 0.4em; /* smaller gap before comments label */
}
.bold {
font-weight: bold;
color: #2d3748;
}
.italic {
font-style: italic;
.evaluation-header {
font-weight: bold;
margin: 1em 0 0.5em 0;
color: #2d3748;
font-size: 11pt;
}
.evaluation-item {
margin: 0.2em 0;
}
.inline-answer {
margin-top: 0.4em; /* smaller top margin */
margin-bottom: 0.4em; /* smaller bottom margin */
.evaluation-item .bold {
color: #1a365d;
font-weight: 600;
min-width: 110px;
display: inline-block;
font-size: 10.5pt;
text-transform: uppercase;
letter-spacing: 0.3px;
}
.block-label {
font-weight: bold;
margin-top: 0.4em; /* smaller top margin */
margin-bottom: 0.1em; /* smaller bottom margin */
margin-top: 1em;
margin-bottom: 0.3em;
}
.block-value {
margin-left: 1em;
margin-bottom: 0.2em; /* smaller bottom margin */
margin-bottom: 0.5em;
color: #4a5568;
}
.entry-value {
color: #059669;
font-weight: 600;
font-size: 12pt;
}
</style>
</head>
<body>
{% for row in rows %}
<div class="trainee-page">
<!-- Name first -->
<h1>{{ row.name }}</h1>
<!-- Locality second -->
<h2>Sending Locality: {{ row.locality }}</h2>
{% for entry in row.entries %}
{% if entry.type == "comments" %}
<!-- Comments label in italic, value in normal font -->
<p class="comments-label">Comments:</p>
<p>{{ entry.value }}</p>
{% elif entry.type == "inline" %}
<!-- Numeric: label + value on one line -->
<p class="inline-answer">
<span class="bold">{{ entry.label }}</span> {{ entry.value }}
</p>
{% else %}
<!-- label on one line, value on next -->
<p class="block-label">{{ entry.label }}</p>
<p class="block-value">{{ entry.value }}</p>
{% endif %}
<body>
{% for row in rows %}
<div class="trainee-page">
<h1>{{ row.name }}</h1>
<h2>Sending Locality: {{ row.locality }}</h2>
{% for entry in row.entries %}
{% if entry.type == "comments" %}
<p class="comments-label">Comments:</p>
<p class="comments-value">{{ entry.value }}</p>
{% elif entry.type == "inline" %}
<div class="inline-answer">
{% if "Truth" in entry.label %}
<p class="evaluation-header">Please evaluate your progress for this past term (1-5, 5 indicating the most progress):</p>
<p class="evaluation-item"><span class="bold">Truth:</span> <span class="entry-value">{{ entry.value }}</span></p>
{% elif "Life" in entry.label %}
<p class="evaluation-item"><span class="bold">Life:</span> <span class="entry-value">{{ entry.value }}</span></p>
{% elif "Gospel" in entry.label %}
<p class="evaluation-item"><span class="bold">Gospel:</span> <span class="entry-value">{{ entry.value }}</span></p>
{% elif "Character" in entry.label %}
<p class="evaluation-item"><span class="bold">Character:</span> <span class="entry-value">{{ entry.value }}</span></p>
{% elif "Service" in entry.label %}
<p class="evaluation-item"><span class="bold">Service:</span> <span class="entry-value">{{ entry.value }}</span></p>
{% else %}
<span class="bold">{{ entry.label }}</span>
<p class="entry-value">{{ entry.value }}</p>
{% endif %}
</div>
{% else %}
<p class="block-label">{{ entry.label }}</p>
<p class="comments-value block-value">{{ entry.value }}</p>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</body>
</html>
"""

Loading…
Cancel
Save