Reworked fixers and NNTP output: now later does dehtmlifying, not fixers. They work with HTML data.
This commit is contained in:
+10
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user