move epubtemplate

This commit is contained in:
Celogeek 2024-01-05 17:54:25 +01:00
parent 3a0f37d5f4
commit 18a31c43f7
Signed by: celogeek
SSH Key Fingerprint: SHA256:DEDfxIK2nUWXbslbRkww3zsauDjhWHlTXar+ak4lDJ4
9 changed files with 30 additions and 30 deletions

View File

@ -1,23 +0,0 @@
/*
Templates use to create xml files of the EPUB.
*/
package epubtemplates
import _ "embed"
var (
//go:embed "epub_templates_container.xml.tmpl"
Container string
//go:embed "epub_templates_applebooks.xml.tmpl"
AppleBooks string
//go:embed "epub_templates_style.css.tmpl"
Style string
//go:embed "epub_templates_text.xhtml.tmpl"
Text string
//go:embed "epub_templates_blank.xhtml.tmpl"
Blank string
)

View File

@ -0,0 +1,23 @@
/*
Templates use to create xml files of the EPUB.
*/
package epubtemplates
import _ "embed"
var (
//go:embed "epubtemplates_container.xml.tmpl"
Container string
//go:embed "epubtemplates_applebooks.xml.tmpl"
AppleBooks string
//go:embed "epubtemplates_style.css.tmpl"
Style string
//go:embed "epubtemplates_text.xhtml.tmpl"
Text string
//go:embed "epubtemplates_blank.xhtml.tmpl"
Blank string
)

View File

@ -4,8 +4,8 @@ import (
"fmt"
"github.com/beevik/etree"
epubimage "github.com/celogeek/go-comic-converter/v2/internal/epub/image"
epuboptions "github.com/celogeek/go-comic-converter/v2/internal/epub/options"
"github.com/celogeek/go-comic-converter/v2/internal/epubimage"
"github.com/celogeek/go-comic-converter/v2/pkg/epuboptions"
)
type ContentOptions struct {
@ -16,8 +16,8 @@ type ContentOptions struct {
Publisher string
UpdatedAt string
ImageOptions *epuboptions.Image
Cover *epubimage.Image
Images []*epubimage.Image
Cover *epubimage.EPUBImage
Images []*epubimage.EPUBImage
Current int
Total int
}
@ -140,7 +140,7 @@ func getMeta(o *ContentOptions) []tag {
func getManifest(o *ContentOptions) []tag {
var imageTags, pageTags, spaceTags []tag
addTag := func(img *epubimage.Image, withSpace bool) {
addTag := func(img *epubimage.EPUBImage, withSpace bool) {
imageTags = append(imageTags,
tag{"item", tagAttrs{"id": img.ImgKey(), "href": img.ImgPath(), "media-type": fmt.Sprintf("image/%s", o.ImageOptions.Format)}, ""},
)

View File

@ -5,11 +5,11 @@ import (
"strings"
"github.com/beevik/etree"
epubimage "github.com/celogeek/go-comic-converter/v2/internal/epub/image"
"github.com/celogeek/go-comic-converter/v2/internal/epubimage"
)
// create toc
func Toc(title string, hasTitle bool, stripFirstDirectoryFromToc bool, images []*epubimage.Image) string {
func Toc(title string, hasTitle bool, stripFirstDirectoryFromToc bool, images []*epubimage.EPUBImage) string {
doc := etree.NewDocument()
doc.CreateProcInst("xml", `version="1.0" encoding="UTF-8"`)
doc.CreateDirective("DOCTYPE html")