Files
kjvstudy.org/kjvstudy_org/templates/story_pdf.html
kennethreitz ffd9e8c187 Add PDF export for stories using WeasyPrint
- Add WeasyPrint dependency and system libs to Docker image
- Create PDF templates for adult and kids stories
- Add /stories/{slug}/pdf and /stories/{slug}/kids/pdf routes
- Add Download PDF button to story pages
- Add stories API endpoints: /api/stories and /api/stories/{slug}
- Gracefully handle missing WeasyPrint system libraries

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 00:26:25 -05:00

120 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ story.title }} - KJV Study</title>
<style>
@page {
size: letter;
margin: 1in;
@bottom-center {
content: counter(page);
font-family: "et-book", Georgia, serif;
font-size: 10pt;
color: #666;
}
}
body {
font-family: "et-book", Georgia, "Times New Roman", serif;
font-size: 12pt;
line-height: 1.6;
color: #111;
max-width: 100%;
}
h1 {
font-size: 24pt;
margin: 0 0 0.25in 0;
color: #111;
font-weight: normal;
}
.subtitle {
font-style: italic;
font-size: 11pt;
color: #555;
margin-bottom: 0.3in;
}
.scripture {
font-size: 10pt;
color: #666;
margin-bottom: 0.15in;
}
.meta {
font-size: 10pt;
color: #666;
margin-bottom: 0.4in;
border-bottom: 1px solid #ddd;
padding-bottom: 0.2in;
}
.meta-label {
font-variant: small-caps;
letter-spacing: 0.05em;
}
.divider {
text-align: center;
margin: 0.3in 0;
color: #888;
letter-spacing: 0.3em;
}
.narrative p {
text-align: justify;
text-indent: 0.25in;
margin: 0 0 0.15in 0;
}
.narrative p:first-of-type {
text-indent: 0;
}
.newthought {
font-variant: small-caps;
font-size: 1.1em;
letter-spacing: 0.05em;
}
.footer {
margin-top: 0.5in;
padding-top: 0.2in;
border-top: 1px solid #ddd;
font-size: 9pt;
color: #888;
text-align: center;
}
</style>
</head>
<body>
<h1>{{ story.title }}</h1>
<p class="subtitle">{{ story.description }}</p>
<p class="scripture">
{% for verse in story.verses %}{{ verse }}{% if not loop.last %} &bull; {% endif %}{% endfor %}
</p>
<p class="meta">
<span class="meta-label">Characters:</span> {{ story.characters | join(', ') }}<br>
<span class="meta-label">Themes:</span> {{ story.themes | join(', ') }}
</p>
<div class="narrative">
{% for paragraph in story.narrative.split('\n\n') %}
{% if loop.first %}
<p><span class="newthought">{{ paragraph.split(' ')[:3] | join(' ') }}</span> {{ paragraph.split(' ')[3:] | join(' ') }}</p>
{% else %}
<p>{{ paragraph }}</p>
{% endif %}
{% endfor %}
</div>
<div class="footer">
From KJV Study &bull; kjvstudy.org
</div>
</body>
</html>