cats en tags

This commit is contained in:
Peter Kleiweg
2026-04-01 19:30:10 +02:00
parent 1fb1867550
commit e550b58889
14 changed files with 61 additions and 22 deletions

View File

@@ -211,11 +211,11 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
return false
}
cats := make([]string, 0)
tags := make([]string, 0)
var buffer bytes.Buffer
for _, i := range doc.Graph {
p(buffer.WriteString(html.UnescapeString(i.ArticleBody)))
cats = append(cats, i.ArticleSection...)
tags = append(tags, i.ArticleSection...)
}
text := buffer.String()
@@ -245,11 +245,11 @@ func doArticle(filename string, url string, timestamp time.Time, needUpdate bool
fp, err := os.Create(filename + ".txt")
p(err)
if len(cats) == 0 {
p(fmt.Fprintln(fp, "##META text cat ="))
if len(tags) == 0 {
p(fmt.Fprintln(fp, "##META text tag ="))
} else {
for _, cat := range cats {
p(fmt.Fprintf(fp, "##META text cat = %s\n", fixSpace(cat)))
for _, tag := range tags {
p(fmt.Fprintf(fp, "##META text tag = %s\n", fixSpace(tag)))
}
}
p(fp.WriteString(text))