fix htmldecode: do in two passes
This commit is contained in:
parent
8598a898f4
commit
24f6d1a8e3
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jam-my-stack",
|
"name": "jam-my-stack",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.com/wgroeneveld/jam-my-stack",
|
"url": "https://github.com/wgroeneveld/jam-my-stack",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
|
|
|
@ -73,9 +73,10 @@ async function parseMastoFeed(options) {
|
||||||
// format: <thr:in-reply-to ref='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793' href='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793'/>
|
// format: <thr:in-reply-to ref='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793' href='https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793'/>
|
||||||
const context = item['thr:in-reply-to'] ? item['thr:in-reply-to']['@_ref'] : ""
|
const context = item['thr:in-reply-to'] ? item['thr:in-reply-to']['@_ref'] : ""
|
||||||
|
|
||||||
|
// WHY double decode? " = &#34; - first decode '&', then the other char.'
|
||||||
return {
|
return {
|
||||||
title: trimIfNeeded(ent.decode(item.title), titleCount, titlePrefix), // summary (cut-off) of content
|
title: trimIfNeeded(ent.decode(ent.decode(item.title)), titleCount, titlePrefix), // summary (cut-off) of content
|
||||||
content: ent.decode(item.content['#text']), // format: <span class="h-card....
|
content: ent.decode(ent.decode(item.content['#text'])), // format: <span class="h-card....
|
||||||
url: item.id, // format: https://chat.brainbaking.com/objects/0707fd54-185d-4ee7-9204-be370d57663c
|
url: item.id, // format: https://chat.brainbaking.com/objects/0707fd54-185d-4ee7-9204-be370d57663c
|
||||||
context,
|
context,
|
||||||
id: stripBeforeLastSlash(item.id),
|
id: stripBeforeLastSlash(item.id),
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe("mastodon feed parser tests", () => {
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/02h16m18s46.md`)
|
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/02h16m18s46.md`)
|
||||||
|
|
||||||
const md = frontMatterParser.parseSync(actualMd.toString())
|
const md = frontMatterParser.parseSync(actualMd.toString())
|
||||||
expect(md.data.title).toBe("@StampedingLonghorn I tried to chase him away, but you know how that turned out... 😼 There's ...")
|
expect(md.data.title).toBe("@StampedingLonghorn I tried to chase him away, but you know how that turned out... 😼 There's ...")
|
||||||
})
|
})
|
||||||
|
|
||||||
test("parse creates separate notes in each month subdir", async () => {
|
test("parse creates separate notes in each month subdir", async () => {
|
||||||
|
|
Loading…
Reference in New Issue