Open scripting opened 2 years ago
@scripting I believe the Wordle results are just Unicode characters with line breaks. Does the rendering strip out the line breaks?
@scotthansonde -- that's one of the things i'm looking into. i don't think that FL is respecting the Markdown-ness of the twitter feeds. I should've posted a screen shot of what i'm seeing. (My bad.)
I see something similar in both NetNewsWire and Reeder. Here's what NetNewsWire presents:
And this is where the data button in the river item comes in handy. Here's the data that the river displayer got from the server. And right there you can see the problem. The markdown version of the text is not being transmitted. It was there in the feed, but it isn't being used. Now let's see if I can fix that. ;-)
{ "feedUrl": "http://tweetfeed.org/gwthompson/rss.xml", "guid": "https://twitter.com/gwthompson/status/1562657137394069506", "link": "https://twitter.com/gwthompson/status/1562657137394069506", "description": "Wordle 432 3/6\n⬛⬛⬛⬛⬛\n⬛⬛🟩⬛⬛\n🟩🟩🟩🟩🟩", "id": 44579, "ctLikes": 0, "pubDate": "Thu, 25 Aug 2022 04:24:28 GMT", "whenReceived": "Thu, 25 Aug 2022 04:47:23 GMT", "whenUpdated": "Thu, 25 Aug 2022 04:47:23 GMT" }
@scripting -- I went into the dev tools and added a baseline return after each line to see what happens and got this result:
I just posted this tweet as a test case.
Going deeper, this is what the database record for the Wordle post looks like..
So the problem is one step deeper, FeedLand itself does not appear to be where the problem is.
{ "feedUrl": "http://tweetfeed.org/gwthompson/rss.xml", "guid": "https://twitter.com/gwthompson/status/1562657137394069506", "title": null, "link": "https://twitter.com/gwthompson/status/1562657137394069506", "description": "Wordle 432 3/6\n⬛⬛⬛⬛⬛\n⬛⬛🟩⬛⬛\n🟩🟩🟩🟩🟩", "pubDate": "2022-08-25T04:24:28.000Z", "enclosureUrl": null, "enclosureType": null, "enclosureLength": null, "id": 44579, "whenCreated": "2022-08-25T04:47:23.000Z", "whenUpdated": "2022-08-25T04:47:23.000Z", "flDeleted": 0, "markdowntext": null, "outlineJsontext": null, "ctLikes": 0 }
So how do you go deeper from here? This is how..
http://feeder.scripting.com/returnjson?feedurl=http%3A%2F%2Ftweetfeed.org%2Fgwthompson%2Frss.xml
This shows what the reallySimple package returns when asked to parse that feed. Look, the markdowntext isn't coming through. Now we know where to look for the problem.
I take that back, reallySimple is working as it should. Look at the <p>s in the description text. That's the result of rendering the markdown text.
@scripting -- I just found this selector and added it to my custom css for my news product and it made the worldle look better:
.divSingularItem{ white-space: pre-line; }
@gwthompson -- interesting, but you may be fixing the CSS of a rendering that is wrong. See my previous posts.
I got to the core of the problem -- it was mostly me having to re-remember how we process feed descriptions.
The problem is, if you look at feeds, the amount of crap they throw into their descriptions, means that we do something brutal, we strip out the HTML markup.
So all the nice rendering that reallySimple does is for naught, we just get rid of it as it enters the FeedLand database.
Here's the actual code.
function getItemDescription (item) { //5/28/22 by DW
var description = item.description;
description = utils.stripMarkup (description);
description = utils.trimWhitespace (description);
return (description);
}
Now's the time when we have to do something smarter than that.
A demo of Markdown text working properly in rivers, as exemplified by the Twitter feeds, the first to generate Markdown text, and hopefully not the last.
Changes:
In reallySimple, we generate an element called markdowntext if the feed supplied markdown for the item.
FeedLand passes the markdowntext value up to the client.
FeedLand also generates the HTML from the Markdown for the description of the item. I think this is kind of clever. You can use limited styles in a river item, as long as they're understood by Markdown. Another good use for Markdown, as a guarantor of safety in marked up text.
In the river, text generated by markdown is enclosed in a <div> with class == divMdText, so you can customize the styling of this text in the style part of your News Product.
Now markdown correctly flows through to rivers. It never has until now.
I feel really good about getting this solved! :smile:
Very cool!!
There's a new version of reallySimple.
Two final things to finish a long programming day...
new verb twitter.getRawTweet.
figured how how to add the tool tip to the more button.
@scripting -- I just tested the new verb in the web version of Drummer and it worked perfectly! Just saw the tweet about Electric Drummer.
After all that, well -- we're no better off with Wordle.
But this version works with markdown and rivers where before today that didn't work at all.
Interestingly when I used the new Twitter.getRawTweet on my Wordle tweet it returned unicode text and not the SVG I had seen in Twitter's HTML when I viewed it in the dev tools.
@gwthompson -- i noticed that too -- i'm guessing that they're doing the new stuff like SVG in their new API which they've been trying to get everyone to move to, but i haven't had the bandwidth to think about it until this thing is done. so we should put aside the wordle thing for now, and come back to it at a later time. one of my favorite mottos is "Pick your battles." This isn't one we can win at this time. ;-)
There are several examples of Wordle strings in @gwthompson's tweetstream.
http://feedland.scripting.com/?river=http%3A%2F%2Ftweetfeed.org%2Fgwthompson%2Frss.xml
It's always bothered me that we don't render these properly. I wonder if anyone has the time to look into this, what I have to do differently to make it work? Or maybe it just doesn't work on my machine (Chrome on a Mac running High Sierra).
Any ideas?