Reworked fixers and NNTP output: now later does dehtmlifying, not fixers. They work with HTML data.

This commit is contained in:
2026-08-09 07:46:06 +05:00
parent 7b13dce342
commit dd0e1e9f4a
5 changed files with 22 additions and 29 deletions
+10 -1
View File
@@ -9,6 +9,7 @@ import (
"strings"
"time"
"github.com/prodigeris/html2text"
"go.dev.pztrn.name/rsser/configuration"
"go.dev.pztrn.name/rsser/outputs"
)
@@ -110,7 +111,15 @@ func (c *nntp) Do(dest, feedName, url, title, body string) error {
"Content-Transfer-Encoding": "7bit",
}
body = "URL: " + url + "\n\n" + body
// NNTP/Usenet do not want HTML things.
plainTextBody, err := html2text.FromString(body, html2text.Options{
PrettyTables: true,
})
if err != nil {
return fmt.Errorf("failed to de-HTMLify body: %s", err)
}
body = "URL: " + url + "\n\n" + plainTextBody
if err := c.postArticle(headers, body); err != nil {
return fmt.Errorf("Do: %w", err)