diff --git a/internal/epub/templates/epub_templates.go b/internal/epub/templates/epub_templates.go deleted file mode 100644 index 12cbd52..0000000 --- a/internal/epub/templates/epub_templates.go +++ /dev/null @@ -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 -) diff --git a/internal/epubtemplates/epubtemplates.go b/internal/epubtemplates/epubtemplates.go new file mode 100644 index 0000000..18ce268 --- /dev/null +++ b/internal/epubtemplates/epubtemplates.go @@ -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 +) diff --git a/internal/epub/templates/epub_templates_applebooks.xml.tmpl b/internal/epubtemplates/epubtemplates_applebooks.xml.tmpl similarity index 100% rename from internal/epub/templates/epub_templates_applebooks.xml.tmpl rename to internal/epubtemplates/epubtemplates_applebooks.xml.tmpl diff --git a/internal/epub/templates/epub_templates_blank.xhtml.tmpl b/internal/epubtemplates/epubtemplates_blank.xhtml.tmpl similarity index 100% rename from internal/epub/templates/epub_templates_blank.xhtml.tmpl rename to internal/epubtemplates/epubtemplates_blank.xhtml.tmpl diff --git a/internal/epub/templates/epub_templates_container.xml.tmpl b/internal/epubtemplates/epubtemplates_container.xml.tmpl similarity index 100% rename from internal/epub/templates/epub_templates_container.xml.tmpl rename to internal/epubtemplates/epubtemplates_container.xml.tmpl diff --git a/internal/epub/templates/epub_templates_content.go b/internal/epubtemplates/epubtemplates_content.go similarity index 96% rename from internal/epub/templates/epub_templates_content.go rename to internal/epubtemplates/epubtemplates_content.go index 2d6c267..b7698a7 100644 --- a/internal/epub/templates/epub_templates_content.go +++ b/internal/epubtemplates/epubtemplates_content.go @@ -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)}, ""}, ) diff --git a/internal/epub/templates/epub_templates_style.css.tmpl b/internal/epubtemplates/epubtemplates_style.css.tmpl similarity index 100% rename from internal/epub/templates/epub_templates_style.css.tmpl rename to internal/epubtemplates/epubtemplates_style.css.tmpl diff --git a/internal/epub/templates/epub_templates_text.xhtml.tmpl b/internal/epubtemplates/epubtemplates_text.xhtml.tmpl similarity index 100% rename from internal/epub/templates/epub_templates_text.xhtml.tmpl rename to internal/epubtemplates/epubtemplates_text.xhtml.tmpl diff --git a/internal/epub/templates/epub_templates_toc.go b/internal/epubtemplates/epubtemplates_toc.go similarity index 93% rename from internal/epub/templates/epub_templates_toc.go rename to internal/epubtemplates/epubtemplates_toc.go index 54966e2..837d66b 100644 --- a/internal/epub/templates/epub_templates_toc.go +++ b/internal/epubtemplates/epubtemplates_toc.go @@ -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")