sfeed: github connector: force to use text - randomcrap - random crap programs of varying quality
 (HTM) git clone git://git.codemadness.org/randomcrap
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 87600405f11bd425fa628013b6b4604030afee09
 (DIR) parent c6cac85875ff45f9b748100fa9277f817794b502
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 20 Mar 2023 21:14:43 +0100
       
       sfeed: github connector: force to use text
       
       ... else it would sometimes use HTML and sometimes use plain-text/markdown.
       
       Diffstat:
         M config/sfeed/connectors/github      |      17 ++++++++++++++---
       
       1 file changed, 14 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/config/sfeed/connectors/github b/config/sfeed/connectors/github
       @@ -30,6 +30,15 @@ function show(issue) {
                        return;
        
                body = o["body"]; # do not double encode HTML body.
       +        contenttype = "text"; # default
       +        if (body == "") {
       +                body = o["body_text"];
       +                contenttype = "text";
       +        }
       +        if (body == "") {
       +                body = o["body_html"];
       +                contenttype = "html";
       +        }
        
                # XML encode fields.
                for (k in o)
       @@ -37,7 +46,7 @@ function show(issue) {
        
                title = o["title"];
                if (title == "")
       -                title = o["body"];
       +                title = body;
                if (o["number"] != "")
                        title = "#" o["number"] " " title;
                if (o["labels"] != "")
       @@ -53,7 +62,7 @@ function show(issue) {
                print "\t<id>" o["html_url"] "</id>";
                if (o["user.login"] != "")
                        print "\t<author><name>" o["user.login"] "</name></author>";
       -        print "\t<content type=\"text\"><![CDATA[" body "]]></content>";
       +        print "\t<content type=\"" contenttype "\"><![CDATA[" body "]]></content>";
                for (k in labels)
                        print "\t<category term=\"" xmlencode(labels[k]) "\" />";
                print "</entry>";
       @@ -105,6 +114,8 @@ if test "$2" != ""; then
                        u="https://api.github.com/repos/$1/$2/issues/$3/comments?per_page=100&sort=updated"
                fi
                # NOTE: User-Agent must be set, else it is blocked.
       -        hurl -H 'User-Agent: github' "$u" | \
       +        #format="application/vnd.github.html+json"
       +        format="application/vnd.github.text+json"
       +        hurl -H "$(printf 'User-Agent: github\r\nAccept: %s' "$format")" "$u" | \
                        github_json_to_atom
        fi