accept several urls, fix tests, remove unused book struct

This commit is contained in:
lapwat
2023-01-18 00:52:48 +01:00
parent bf3fc65444
commit ab5e2ede07
8 changed files with 73 additions and 114 deletions

View File

@@ -9,6 +9,10 @@ type chapter struct {
config *ScrapeConfig
}
func NewEmptyChapter() chapter {
return chapter{"", "", "", "", []chapter{}, NewScrapeConfigNoInclude()}
}
func NewChapter(body, name, author, content string, subChapters []chapter, config *ScrapeConfig) chapter {
return chapter{body, name, author, content, subChapters, config}
}
@@ -21,6 +25,10 @@ func (c chapter) Name() string {
return c.name
}
func (c *chapter) SetName(name string) {
c.name = name
}
func (c chapter) Author() string {
return c.author
}
@@ -32,3 +40,7 @@ func (c chapter) Content() string {
func (c chapter) SubChapters() []chapter {
return c.subChapters
}
func (c *chapter) AddSubChapter(newChapter chapter) {
c.subChapters = append(c.subChapters, newChapter)
}