Files
kennethreitz 71d4db055e Add PDF generation support and improve documentation
- Add WeasyPrint dependencies to Dockerfile for server-side PDF generation
- Update README with Quick Start guide for Docker and local development
- Add PDF template for article rendering
- Add error template for better error handling
- Reorganize photography into top-12 subdirectory
- Update pyproject.toml with PDF generation dependencies
- Enhance content.py with PDF rendering capabilities
- Improve directory template with gallery features

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 15:17:43 -04:00

222 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ title }}</title>
<style>
@page {
size: letter;
margin: 1in 1in 1in 1in;
}
body {
font-family: et-book, Palatino, "Palatino Linotype", Georgia, serif;
font-size: 11pt;
line-height: 1.6;
color: #111;
position: relative;
}
h1 {
font-weight: 400;
margin-top: 0;
margin-bottom: 1rem;
font-size: 2.5rem;
line-height: 1.2;
page-break-after: avoid;
}
h2 {
font-style: italic;
font-weight: 400;
margin-top: 1.5rem;
margin-bottom: 1rem;
font-size: 1.8rem;
line-height: 1.2;
page-break-after: avoid;
}
h3 {
font-style: italic;
font-weight: 400;
font-size: 1.4rem;
margin-top: 1.5rem;
margin-bottom: 0.8rem;
line-height: 1.2;
page-break-after: avoid;
}
.metadata {
font-variant: small-caps;
font-size: 10pt;
color: #666;
margin-bottom: 2em;
}
.reading-info {
font-size: 9pt;
color: #888;
margin-bottom: 2em;
}
p {
margin: 0 0 1em 0;
orphans: 3;
widows: 3;
}
code {
font-family: "Courier New", Courier, monospace;
font-size: 10pt;
background: #f5f5f5;
padding: 0.1em 0.3em;
border-radius: 2px;
}
pre {
font-family: "Courier New", Courier, monospace;
font-size: 9pt;
background: #f5f5f5;
padding: 1em;
border-left: 3px solid #ccc;
overflow-x: auto;
page-break-inside: avoid;
margin: 1em 0;
}
pre code {
background: none;
padding: 0;
}
blockquote {
margin: 1em 2em;
padding-left: 1em;
border-left: 3px solid #ccc;
font-style: italic;
color: #555;
page-break-inside: avoid;
}
ul, ol {
margin: 0.5em 0 1em 2em;
}
li {
margin-bottom: 0.3em;
}
a {
color: #2563eb;
text-decoration: none;
}
/* Hide sidenote toggles in PDF */
.margin-toggle {
display: none;
}
/* Counter for sidenotes */
body {
counter-reset: sidenote-counter;
}
/* Increment counter on the label, which comes before the sidenote */
.sidenote-number {
counter-increment: sidenote-counter;
}
/* Display number in superscript after the label */
.sidenote-number:after {
content: counter(sidenote-counter);
font-size: 0.7em;
vertical-align: super;
}
/* Display sidenotes as indented blocks */
.sidenote {
display: block;
font-size: 9pt;
line-height: 1.4;
color: #555;
margin: 0.8em 0 0.8em 2em;
padding: 0.5em 0 0.5em 1em;
border-left: 2px solid #ccc;
page-break-inside: avoid;
}
/* Page footer */
@page {
@bottom-center {
content: counter(page);
font-size: 9pt;
color: #666;
}
}
.header-info {
margin-bottom: 2em;
padding-bottom: 1em;
border-bottom: 1px solid #eee;
}
.themes {
margin-top: 1em;
font-size: 9pt;
color: #666;
}
.theme-tag {
display: inline-block;
background: #f0f0f0;
padding: 0.2em 0.5em;
margin-right: 0.3em;
border-radius: 3px;
}
</style>
</head>
<body>
<div class="header-info">
{% if unique_icon %}
<div style="text-align: center; margin-bottom: 1em;">
<img src="{{ unique_icon }}" alt="Icon for {{ title }}" style="width: 80px; height: 80px;">
</div>
{% endif %}
<h1>{{ title }}</h1>
{% if metadata and metadata.date %}
<div class="metadata">
{{ metadata.date if metadata.date is string else metadata.date[0] }}
</div>
{% endif %}
<div class="reading-info">
{% if reading_time %}
{{ reading_time }} min read
{% endif %}
{% if word_count %}
• {{ "{:,}".format(word_count) }} words
{% endif %}
</div>
{% if article_themes and article_themes|length > 0 %}
<div class="themes">
<strong>Themes:</strong>
{% for theme in article_themes %}
<span class="theme-tag">{{ theme.name|title }}</span>
{% endfor %}
</div>
{% endif %}
</div>
<div class="content">
{{ content | safe }}
</div>
<div style="margin-top: 3em; padding-top: 1em; border-top: 1px solid #eee; font-size: 9pt; color: #666;">
<p>Generated from kennethreitz.org • {{ current_year }}</p>
</div>
</body>
</html>