diff --git a/kjvstudy_org/server.py b/kjvstudy_org/server.py index e05370e..7b9ac48 100644 --- a/kjvstudy_org/server.py +++ b/kjvstudy_org/server.py @@ -2236,11 +2236,15 @@ def book_pdf(request: Request, book: str): detail=f"No verses found for the book '{book}'." ) + # Get book introduction data if available + book_intro = get_book_data(book) if has_book_data(book) else None + html_content = templates.get_template("book_pdf.html").render( book=book, chapters=chapters_data, chapter_count=len(chapters_data), verse_count=total_verses, + book_intro=book_intro, ) pdf_buffer = render_html_to_pdf(html_content) diff --git a/kjvstudy_org/templates/book_pdf.html b/kjvstudy_org/templates/book_pdf.html index 690101c..f078995 100644 --- a/kjvstudy_org/templates/book_pdf.html +++ b/kjvstudy_org/templates/book_pdf.html @@ -84,12 +84,157 @@ color: #888; text-align: center; } + + /* Introduction sections */ + .intro-section { + margin-bottom: 0.3in; + page-break-inside: avoid; + } + + .intro-section h2 { + font-size: 14pt; + margin: 0.2in 0 0.1in 0; + font-weight: normal; + } + + .intro-section p { + margin: 0 0 0.12in 0; + text-align: justify; + } + + .intro-section ul { + margin: 0.1in 0; + padding-left: 0.25in; + } + + .intro-section li { + margin-bottom: 0.08in; + } + + .intro-section blockquote { + margin: 0.15in 0.2in; + padding-left: 0.15in; + border-left: 2px solid #ddd; + } + + .intro-section blockquote p { + font-style: italic; + margin-bottom: 0.05in; + } + + .intro-section blockquote footer { + font-size: 9pt; + color: #666; + } + + .chapters-divider { + margin: 0.4in 0; + border-bottom: 2px solid #333; + page-break-before: always; + }

{{ book }}

Authorized King James Version (KJV)

-

{{ chapter_count }} chapters · {{ verse_count }} verses

+

+ {% if book_intro and book_intro.author %}Author: {{ book_intro.author }}{% endif %} + {% if book_intro and book_intro.date_written %} · Written: {{ book_intro.date_written }}{% endif %} + {% if book_intro and book_intro.category %} · Category: {{ book_intro.category }}{% endif %} +

+ + {% if book_intro %} + + {% if book_intro.introduction %} +
+

Introduction

+ {{ book_intro.introduction|md|safe }} +
+ {% endif %} + + {% if book_intro.outline %} +
+

Book Outline

+ +
+ {% endif %} + + {% if book_intro.key_themes %} +
+

Key Themes

+ +
+ {% endif %} + + {% if book_intro.key_verses %} +
+

Key Verses

+ {% for verse in book_intro.key_verses %} +
+

{{ verse.text|mdi|safe }}

+ +
+ {% endfor %} +
+ {% endif %} + + {% if book_intro.historical_context %} +
+

Historical Context

+ {{ book_intro.historical_context|md|safe }} +
+ {% endif %} + + {% if book_intro.literary_style %} +
+

Literary Style

+ {{ book_intro.literary_style|md|safe }} +
+ {% endif %} + + {% if book_intro.theological_significance %} +
+

Theological Significance

+ {{ book_intro.theological_significance|md|safe }} +
+ {% endif %} + + {% if book_intro.christ_in_book %} +
+

Christ in {{ book }}

+ {{ book_intro.christ_in_book|md|safe }} +
+ {% endif %} + + {% if book_intro.relationship_to_new_testament %} +
+

Relationship to the New Testament

+ {{ book_intro.relationship_to_new_testament|md|safe }} +
+ {% endif %} + + {% if book_intro.practical_application %} +
+

Practical Application

+ {{ book_intro.practical_application|md|safe }} +
+ {% endif %} + + +
+ {% endif %} {% for chapter in chapters %}