mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-06-28 08:09:56 +02:00
add at least one child in the toc
This commit is contained in:
parent
bc19e5e4ce
commit
4a43760535
@ -20,8 +20,8 @@ func NewGift(options *ImageOptions) *gift.GIFT {
|
|||||||
}
|
}
|
||||||
g.Add(
|
g.Add(
|
||||||
filters.Resize(options.ViewWidth, options.ViewHeight, gift.LanczosResampling),
|
filters.Resize(options.ViewWidth, options.ViewHeight, gift.LanczosResampling),
|
||||||
filters.Pixel(),
|
|
||||||
filters.Position(options.ViewWidth, options.ViewHeight, filters.PositionCenter),
|
filters.Position(options.ViewWidth, options.ViewHeight, filters.PositionCenter),
|
||||||
|
filters.Pixel(),
|
||||||
)
|
)
|
||||||
return g
|
return g
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,14 @@ func (e *ePub) getToc(title string, images []*Image) string {
|
|||||||
if len(ol.ChildElements()) == 1 && e.StripFirstDirectoryFromToc {
|
if len(ol.ChildElements()) == 1 && e.StripFirstDirectoryFromToc {
|
||||||
ol = ol.ChildElements()[0]
|
ol = ol.ChildElements()[0]
|
||||||
}
|
}
|
||||||
if len(ol.ChildElements()) > 0 {
|
|
||||||
nav.AddChild(ol)
|
beginning := etree.NewElement("li")
|
||||||
}
|
beginningLink := beginning.CreateElement("a")
|
||||||
|
beginningLink.CreateAttr("href", images[0].TextPath())
|
||||||
|
beginningLink.CreateText("Start of the book")
|
||||||
|
ol.InsertChildAt(0, beginning)
|
||||||
|
|
||||||
|
nav.AddChild(ol)
|
||||||
|
|
||||||
doc.Indent(2)
|
doc.Indent(2)
|
||||||
r, _ := doc.WriteToString()
|
r, _ := doc.WriteToString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user