mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 00:02:37 +02:00
move epubtemplate
This commit is contained in:
parent
3a0f37d5f4
commit
18a31c43f7
@ -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
|
||||
)
|
23
internal/epubtemplates/epubtemplates.go
Normal file
23
internal/epubtemplates/epubtemplates.go
Normal 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
|
||||
)
|
@ -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)}, ""},
|
||||
)
|
@ -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")
|
Loading…
x
Reference in New Issue
Block a user