start signer
This commit is contained in:
@ -8,10 +8,11 @@ import (
|
||||
)
|
||||
|
||||
type Feed struct {
|
||||
HeaderTitle string
|
||||
ArticlesSet []string
|
||||
EntriesHTMLPath string
|
||||
doc soup.Root
|
||||
HeaderTitle string
|
||||
ArticlesSet []string
|
||||
EntriesHTMLPath string
|
||||
BaseEntriesHTMLPath string
|
||||
doc soup.Root
|
||||
}
|
||||
|
||||
func (f *Feed) LoadHTML() error {
|
||||
@ -25,6 +26,18 @@ func (f *Feed) LoadHTML() error {
|
||||
for _, article := range articles {
|
||||
f.ArticlesSet = append(f.ArticlesSet, article.HTML())
|
||||
}
|
||||
if f.BaseEntriesHTMLPath != "" {
|
||||
data, err := ioutil.ReadFile(f.BaseEntriesHTMLPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("LoadHTML: error", err)
|
||||
}
|
||||
f.doc = soup.HTMLParse(string(data))
|
||||
f.HeaderTitle = f.doc.Find("header").FullText()
|
||||
articles := f.doc.FindAll("article")
|
||||
for _, article := range articles {
|
||||
f.ArticlesSet = append(f.ArticlesSet, article.HTML())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
4
main.go
4
main.go
@ -159,6 +159,10 @@ func Build(newsFile string) {
|
||||
news.BACKUPFEED = *backupurl
|
||||
news.SUBTITLE = *subtitle
|
||||
news.URNID = *urn
|
||||
base := filepath.Join(*newsfile, "entries.html")
|
||||
if newsFile != base {
|
||||
news.Feed.BaseEntriesHTMLPath = base
|
||||
}
|
||||
if feed, err := news.Build(); err != nil {
|
||||
log.Printf("Build error: %s", err)
|
||||
} else {
|
||||
|
1
signer/signer.go
Normal file
1
signer/signer.go
Normal file
@ -0,0 +1 @@
|
||||
package newssigner
|
Reference in New Issue
Block a user