From 6444eb65a36d74ea22d1e5e6f069aca894b0f8b7 Mon Sep 17 00:00:00 2001
From: celogeek <65178+celogeek@users.noreply.github.com>
Date: Tue, 27 Dec 2022 20:10:41 +0100
Subject: [PATCH] add part text
---
internal/epub/core.go | 1 +
internal/epub/templates.go | 3 +++
internal/epub/templates/content.opf.tmpl | 6 ++++--
internal/epub/templates/part.xhtml.tmpl | 14 ++++++++++++++
4 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 internal/epub/templates/part.xhtml.tmpl
diff --git a/internal/epub/core.go b/internal/epub/core.go
index c3618ea..06bf251 100644
--- a/internal/epub/core.go
+++ b/internal/epub/core.go
@@ -307,6 +307,7 @@ func (e *EPub) Write() error {
{"OEBPS/toc.ncx", e.Render(TEMPLATE_TOC, map[string]any{"Info": e, "Images": part.Images})},
{"OEBPS/nav.xhtml", e.Render(TEMPLATE_NAV, map[string]any{"Info": e, "Images": part.Images})},
{"OEBPS/Text/style.css", TEMPLATE_STYLE},
+ {"OEBPS/Text/part.xhtml", e.Render(TEMPLATE_PART, map[string]any{"Info": e, "Part": part})},
{"OEBPS/Text/cover.xhtml", e.Render(TEMPLATE_TEXT, map[string]any{
"Id": "cover",
"Width": part.Cover.Width,
diff --git a/internal/epub/templates.go b/internal/epub/templates.go
index a86f26b..484dfde 100644
--- a/internal/epub/templates.go
+++ b/internal/epub/templates.go
@@ -20,5 +20,8 @@ var TEMPLATE_NAV string
//go:embed "templates/style.css.tmpl"
var TEMPLATE_STYLE string
+//go:embed "templates/part.xhtml.tmpl"
+var TEMPLATE_PART string
+
//go:embed "templates/text.xhtml.tmpl"
var TEMPLATE_TEXT string
diff --git a/internal/epub/templates/content.opf.tmpl b/internal/epub/templates/content.opf.tmpl
index 3fe65c0..d460f80 100644
--- a/internal/epub/templates/content.opf.tmpl
+++ b/internal/epub/templates/content.opf.tmpl
@@ -24,6 +24,7 @@