Compare commits

...

3 Commits

Author SHA1 Message Date
8ba526f186
add helper for layout blank 2023-04-28 18:01:32 +02:00
1119101f65
fix space require detection 2023-04-28 17:49:29 +02:00
e8613b0cce
add space before title in landscape 2023-04-28 17:49:16 +02:00
2 changed files with 14 additions and 5 deletions

View File

@ -261,6 +261,10 @@ func (e *ePub) Write() error {
"PageWidth": e.Image.View.Width,
"PageHeight": e.Image.View.Height,
})},
{"OEBPS/Text/space_title.xhtml", e.render(epubtemplates.Blank, map[string]any{
"Title": "Blank Page Title",
"ViewPort": fmt.Sprintf("width=%d,height=%d", e.Image.View.Width, e.Image.View.Height),
})},
{"OEBPS/Text/title.xhtml", e.render(epubtemplates.Text, map[string]any{
"Title": title,
"ViewPort": fmt.Sprintf("width=%d,height=%d", e.Image.View.Width, e.Image.View.Height),

View File

@ -142,6 +142,7 @@ func getManifest(o *ContentOptions) []tag {
items := []tag{
{"item", tagAttrs{"id": "toc", "href": "toc.xhtml", "properties": "nav", "media-type": "application/xhtml+xml"}, ""},
{"item", tagAttrs{"id": "css", "href": "Text/style.css", "media-type": "text/css"}, ""},
{"item", tagAttrs{"id": "space_title", "href": "Text/space_title.xhtml", "media-type": "application/xhtml+xml"}, ""},
{"item", tagAttrs{"id": "page_title", "href": "Text/title.xhtml", "media-type": "application/xhtml+xml"}, ""},
{"item", tagAttrs{"id": "img_title", "href": "Images/title.jpg", "media-type": "image/jpeg"}, ""},
}
@ -165,9 +166,9 @@ func getManifest(o *ContentOptions) []tag {
// spine part of the content
func getSpine(o *ContentOptions) []tag {
isOnTheRight := !o.ImageOptions.Manga
getSpread := func(doublePageNoBlank bool) string {
getSpread := func(isDoublePage bool) string {
isOnTheRight = !isOnTheRight
if doublePageNoBlank {
if isDoublePage {
// Center the double page then start back to comic mode (mange/normal)
isOnTheRight = !o.ImageOptions.Manga
return "rendition:page-spread-center"
@ -178,15 +179,19 @@ func getSpine(o *ContentOptions) []tag {
return "rendition:page-spread-left"
}
}
getSpreadBlank := func() string {
return fmt.Sprintf("%s layout-blank", getSpread(false))
}
spine := []tag{
{"itemref", tagAttrs{"idref": "page_title", "properties": getSpread(true)}, ""},
{"itemref", tagAttrs{"idref": "space_title", "properties": getSpreadBlank()}, ""},
{"itemref", tagAttrs{"idref": "page_title", "properties": getSpread(false)}, ""},
}
for _, img := range o.Images {
if img.DoublePage && isOnTheRight {
if img.DoublePage && o.ImageOptions.Manga == isOnTheRight {
spine = append(spine, tag{
"itemref",
tagAttrs{"idref": img.SpaceKey(), "properties": getSpread(false) + " layout-blank"},
tagAttrs{"idref": img.SpaceKey(), "properties": getSpreadBlank()},
"",
})
}