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 @@ + {{ range .Images }} @@ -31,11 +32,12 @@ + {{ range $idx, $ := .Images }} {{ if mod $idx 2 }} - -{{ else }} +{{ else }} + {{ end }} {{ end }} diff --git a/internal/epub/templates/part.xhtml.tmpl b/internal/epub/templates/part.xhtml.tmpl new file mode 100644 index 0000000..f399ef0 --- /dev/null +++ b/internal/epub/templates/part.xhtml.tmpl @@ -0,0 +1,14 @@ + + + + +Part {{ .Part.Idx }} + + + + +

+Part {{ .Part.Idx }} +

+ + \ No newline at end of file