Revert "1.1.0 release: get rid of utcOffset"
Why? Turns out that Pleroma logs dates in UTC...
This reverts commit 6c9c5ff1e1
.
This commit is contained in:
parent
6c9c5ff1e1
commit
942406a566
11
README.md
11
README.md
|
@ -6,10 +6,6 @@ Published at https://www.npmjs.com/package/jam-my-stack
|
||||||
|
|
||||||
[![npm version](https://badge.fury.io/js/jam-my-stack.svg)](https://badge.fury.io/js/jam-my-stack)
|
[![npm version](https://badge.fury.io/js/jam-my-stack.svg)](https://badge.fury.io/js/jam-my-stack)
|
||||||
|
|
||||||
Release notes: see `RELEASE.md`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
These simple scripts **enrich your Jamstack-site** by adding/manipulating/whatever (meta)data, such as extra posts, indexing, and so forth. A primary example of these tools in action is my own site https://brainbaking.com - inspect how it's used at https://github.com/wgroeneveld/brainbaking
|
These simple scripts **enrich your Jamstack-site** by adding/manipulating/whatever (meta)data, such as extra posts, indexing, and so forth. A primary example of these tools in action is my own site https://brainbaking.com - inspect how it's used at https://github.com/wgroeneveld/brainbaking
|
||||||
|
|
||||||
**Are you looking for a way to receive webmentions?** See https://github.com/wgroeneveld/serve-my-jams !
|
**Are you looking for a way to receive webmentions?** See https://github.com/wgroeneveld/serve-my-jams !
|
||||||
|
@ -33,6 +29,7 @@ Usage example:
|
||||||
await mastodon.parseFeed({
|
await mastodon.parseFeed({
|
||||||
notesdir: `${__dirname}/content/notes`,
|
notesdir: `${__dirname}/content/notes`,
|
||||||
url: "https://chat.brainbaking.com/users/wouter/feed",
|
url: "https://chat.brainbaking.com/users/wouter/feed",
|
||||||
|
utcOffset: 60,
|
||||||
titleCount: 50,
|
titleCount: 50,
|
||||||
titlePrefix: "Note: "
|
titlePrefix: "Note: "
|
||||||
})
|
})
|
||||||
|
@ -40,6 +37,7 @@ Usage example:
|
||||||
|
|
||||||
Options and their default values:
|
Options and their default values:
|
||||||
|
|
||||||
|
- `utcOffset`: `60` (= GMT+1, that's where I am!) (in **minutes**, see [day.js docs](https://day.js.org/docs/en/manipulate/utc-offset)
|
||||||
- `titleCount`: `50`. Will add "..." and trim if title length bigger.
|
- `titleCount`: `50`. Will add "..." and trim if title length bigger.
|
||||||
- `titlePrefix`: `""`. Will add before title (e.g. "Note: ")
|
- `titlePrefix`: `""`. Will add before title (e.g. "Note: ")
|
||||||
- `ignoreReplies`: `false`. If true, will not process `in-reply-to` items.
|
- `ignoreReplies`: `false`. If true, will not process `in-reply-to` items.
|
||||||
|
@ -70,13 +68,13 @@ Example feed entry:
|
||||||
</entry>
|
</entry>
|
||||||
```
|
```
|
||||||
|
|
||||||
This generates the file `01h19m03s35.md` with contents:
|
This generates the file `01h20m03s35.md` (it assumes UTC times in the feed and adjusts according to specified `utcOffset`, such as GMT+1 in this example), with contents:
|
||||||
|
|
||||||
```md
|
```md
|
||||||
---
|
---
|
||||||
source: "https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac"
|
source: "https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac"
|
||||||
title: "I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri..."
|
title: "I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri..."
|
||||||
date: "2021-03-01T19:03:35+01:00"
|
date: "2021-03-01T19:03:35"
|
||||||
---
|
---
|
||||||
|
|
||||||
I pulled the Google plug and installed LineageOS: <a href="https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/" rel="ugc">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class="hashtag" data-tag="lineageos" href="https://chat.brainbaking.com/tag/lineageos" rel="tag ugc">#lineageos</a> for privacy reasons?
|
I pulled the Google plug and installed LineageOS: <a href="https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/" rel="ugc">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class="hashtag" data-tag="lineageos" href="https://chat.brainbaking.com/tag/lineageos" rel="tag ugc">#lineageos</a> for privacy reasons?
|
||||||
|
@ -88,7 +86,6 @@ See implementation for more details and features.
|
||||||
|
|
||||||
- `<link rel="enclosure"/>` image types (see `render-enclosures.ejs`) [ejs template](https://ejs.co/), that is appended to the Markdown file if any are found. Styling is up to you...
|
- `<link rel="enclosure"/>` image types (see `render-enclosures.ejs`) [ejs template](https://ejs.co/), that is appended to the Markdown file if any are found. Styling is up to you...
|
||||||
- `... @https://blah.com/blie hi there` - this is a **in-reply-to** toot which adds `context` frontmatter, so your html renderer can use the correct IndieWeb classes. This should also enable webmention sending since you mention the URL. If you "at" a valid Mastodon user, it will automatically do this.
|
- `... @https://blah.com/blie hi there` - this is a **in-reply-to** toot which adds `context` frontmatter, so your html renderer can use the correct IndieWeb classes. This should also enable webmention sending since you mention the URL. If you "at" a valid Mastodon user, it will automatically do this.
|
||||||
- On the `published` date: Mastodon feeds generate **ISO8601** timestamps with timezones. This is preserved in the resulting frontmatter using [dayjs](https://day.js.org/docs/en/display/format).
|
|
||||||
|
|
||||||
### 2. Goodreads
|
### 2. Goodreads
|
||||||
|
|
||||||
|
|
15
RELEASE.md
15
RELEASE.md
|
@ -1,15 +0,0 @@
|
||||||
|
|
||||||
# Jam-my-stack release notes
|
|
||||||
|
|
||||||
### 1.1.0
|
|
||||||
|
|
||||||
- Finally get rid of `utcOffset` and include timezone in proper ISO8601 format in `date` front-matter.
|
|
||||||
- This means this release will probably cause filenames to change so watch out!
|
|
||||||
|
|
||||||
### 1.0.17
|
|
||||||
|
|
||||||
- Implement @http... translation to `context` front-matter in Markdown output.
|
|
||||||
|
|
||||||
### 1.0.16
|
|
||||||
|
|
||||||
- All the rest!
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jam-my-stack",
|
"name": "jam-my-stack",
|
||||||
"version": "1.1.0",
|
"version": "1.0.17",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.com/wgroeneveld/jam-my-stack",
|
"url": "https://github.com/wgroeneveld/jam-my-stack",
|
||||||
"type": "git"
|
"type": "git"
|
||||||
|
|
|
@ -26,8 +26,6 @@ function convertAtomItemToMd(item, notesdir) {
|
||||||
if(!existsSync(`${notesdir}/${item.year}`)) mkdirSync(`${notesdir}/${item.year}`)
|
if(!existsSync(`${notesdir}/${item.year}`)) mkdirSync(`${notesdir}/${item.year}`)
|
||||||
if(!existsSync(path)) mkdirSync(path)
|
if(!existsSync(path)) mkdirSync(path)
|
||||||
|
|
||||||
// dates are formatted using dayjs.format() in ISO8601
|
|
||||||
// see https://day.js.org/docs/en/display/format
|
|
||||||
let mddata = ejs.render(templates.markdown, { item })
|
let mddata = ejs.render(templates.markdown, { item })
|
||||||
|
|
||||||
if(item.media?.length > 0) {
|
if(item.media?.length > 0) {
|
||||||
|
@ -66,12 +64,13 @@ function detectContext(item, content) {
|
||||||
// opts:
|
// opts:
|
||||||
// notesdir = `${__dirname}/content/notes`
|
// notesdir = `${__dirname}/content/notes`
|
||||||
// url = "https://chat.brainbaking.com/users/wouter/feed";
|
// url = "https://chat.brainbaking.com/users/wouter/feed";
|
||||||
|
// utcOffset = 60 (in minutes)
|
||||||
// titleCount = 50
|
// titleCount = 50
|
||||||
// titlePrefix = "Note: "
|
// titlePrefix = "Note: "
|
||||||
// ignoreReplies = false
|
// ignoreReplies = false
|
||||||
|
|
||||||
async function parseMastoFeed(options) {
|
async function parseMastoFeed(options) {
|
||||||
const { notesdir, url, titleCount = 50, titlePrefix = "", ignoreReplies = false } = options
|
const { notesdir, url, utcOffset = 60, titleCount = 50, titlePrefix = "", ignoreReplies = false } = options
|
||||||
|
|
||||||
const notesroot = await getFiles(notesdir)
|
const notesroot = await getFiles(notesdir)
|
||||||
const notes = notesroot
|
const notes = notesroot
|
||||||
|
@ -93,10 +92,7 @@ async function parseMastoFeed(options) {
|
||||||
|
|
||||||
const items = entries.map(item => {
|
const items = entries.map(item => {
|
||||||
const content = ent.decode(ent.decode(item.content['#text'])) // format: <span class="h-card....
|
const content = ent.decode(ent.decode(item.content['#text'])) // format: <span class="h-card....
|
||||||
let date = dayjs(item.published)
|
const date = dayjs.utc(item.published).utcOffset(utcOffset)
|
||||||
if(!date.isValid()) {
|
|
||||||
date = dayjs.utc()
|
|
||||||
}
|
|
||||||
const year = date.format("YYYY")
|
const year = date.format("YYYY")
|
||||||
const month = date.format("MM")
|
const month = date.format("MM")
|
||||||
const day = date.format("DD")
|
const day = date.format("DD")
|
||||||
|
@ -118,7 +114,7 @@ async function parseMastoFeed(options) {
|
||||||
id: stripBeforeLastSlash(item.id),
|
id: stripBeforeLastSlash(item.id),
|
||||||
media,
|
media,
|
||||||
hash: `${day}h${date.format("HH")}m${date.format("mm")}s${date.format("ss")}`,
|
hash: `${day}h${date.format("HH")}m${date.format("mm")}s${date.format("ss")}`,
|
||||||
date, // format: 2021-03-02T16:18:46.658056Z - KEEP timezones!
|
date, // format: 2021-03-02T16:18:46.658056Z
|
||||||
year,
|
year,
|
||||||
month,
|
month,
|
||||||
day
|
day
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
// warning, without explicitly providing the ISO8601 format, dayjs.utc() formats differently!!
|
|
||||||
const markdown = `---
|
const markdown = `---
|
||||||
source: "<%- item.url %>"
|
source: "<%- item.url %>"
|
||||||
<% if (item.context) { -%>
|
<% if (item.context) { -%>
|
||||||
context: "<%- item.context %>"
|
context: "<%- item.context %>"
|
||||||
<% } -%>
|
<% } -%>
|
||||||
title: "<%- item.title %>"
|
title: "<%- item.title %>"
|
||||||
date: "<%- item.date.format('YYYY-MM-DDTHH:mm:ssZ') %>"
|
date: "<%- item.year %>-<%- item.month %>-<%- item.day %>T<%- item.date.format('HH:mm:ss') %>"
|
||||||
---
|
---
|
||||||
|
|
||||||
<%- item.content %>
|
<%- item.content %>
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<feed
|
|
||||||
xmlns="http://www.w3.org/2005/Atom"
|
|
||||||
xmlns:thr="http://purl.org/syndication/thread/1.0"
|
|
||||||
xmlns:activity="http://activitystrea.ms/spec/1.0/"
|
|
||||||
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
|
||||||
xmlns:ostatus="http://ostatus.org/schema/1.0">
|
|
||||||
|
|
||||||
<id>https://chat.brainbaking.com/users/wouter/feed.atom</id>
|
|
||||||
<title>wouter's timeline</title>
|
|
||||||
<updated>2021-03-02T16:18:46</updated>
|
|
||||||
<logo>https://chat.brainbaking.com/media/f39bcd85-5098-45e2-b395-e274b712d512/headshot_2020.jpg</logo>
|
|
||||||
<link rel="self" href="https://chat.brainbaking.com/users/wouter/feed.atom" type="application/atom+xml"/>
|
|
||||||
|
|
||||||
<author>
|
|
||||||
<id>https://chat.brainbaking.com/users/wouter</id>
|
|
||||||
<activity:object>http://activitystrea.ms/schema/1.0/person</activity:object>
|
|
||||||
<uri>https://chat.brainbaking.com/users/wouter</uri>
|
|
||||||
<poco:preferredUsername>wouter</poco:preferredUsername>
|
|
||||||
<poco:displayName>Wouter Groeneveld</poco:displayName>
|
|
||||||
<poco:note>Level 35 Brain Baker. Loving the smell of freshly baked thoughts (and bread) in the morning 🍞. Sometimes convincing others to bake their brain (and bread) too 🧠. </poco:note>
|
|
||||||
<summary>Level 35 Brain Baker. Loving the smell of freshly baked thoughts (and bread) in the morning 🍞. Sometimes convincing others to bake their brain (and bread) too 🧠. </summary>
|
|
||||||
<name>wouter</name>
|
|
||||||
<link rel="avatar" href="https://chat.brainbaking.com/media/f39bcd85-5098-45e2-b395-e274b712d512/headshot_2020.jpg"/>
|
|
||||||
|
|
||||||
<link rel="header" href="https://chat.brainbaking.com/media/3399cd78-4fd4-40ab-a174-c7805576a826/boekcover2.jpg"/>
|
|
||||||
|
|
||||||
|
|
||||||
<ap_enabled>true</ap_enabled>
|
|
||||||
|
|
||||||
</author>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="next" href="https://chat.brainbaking.com/users/wouter/feed.atom?max_id=A4fIjNa6N1OJmaSMAS" type="application/atom+xml"/>
|
|
||||||
|
|
||||||
<entry>
|
|
||||||
<activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
|
|
||||||
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
|
|
||||||
<id>https://chat.brainbaking.com/objects/b5b67e88-eda8-45dd-ab8f-54443b62e250</id>
|
|
||||||
<title>some title</title>
|
|
||||||
<content type="html"><span class="h-card">@<a class="u-url mention" href="https://reply-to-stuff" rel="ugc"> in reply to previous url test</content>
|
|
||||||
<published>fuck</published>
|
|
||||||
<updated>me</updated>
|
|
||||||
<ostatus:conversation ref="tag:mastodon.social,2021-03-20:objectId=227433498:objectType=Conversation">
|
|
||||||
tag:mastodon.social,2021-03-20:objectId=227433498:objectType=Conversation
|
|
||||||
</ostatus:conversation>
|
|
||||||
|
|
||||||
</entry>
|
|
||||||
</feed>
|
|
|
@ -5,7 +5,7 @@ exports[`mastodon feed parser tests parse creates MD with context if in-reply-to
|
||||||
source: \\"https://chat.brainbaking.com/objects/2e58289c-f5f0-415c-b2e1-62c74662aa16\\"
|
source: \\"https://chat.brainbaking.com/objects/2e58289c-f5f0-415c-b2e1-62c74662aa16\\"
|
||||||
context: \\"https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793\\"
|
context: \\"https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793\\"
|
||||||
title: \\"@StampedingLonghorn I tried to chase him away, but you know how that turned out... 😼 There's ...\\"
|
title: \\"@StampedingLonghorn I tried to chase him away, but you know how that turned out... 😼 There's ...\\"
|
||||||
date: \\"2021-03-02T17:18:46+01:00\\"
|
date: \\"2021-03-02T16:18:46\\"
|
||||||
---
|
---
|
||||||
|
|
||||||
<span class=\\"h-card\\"><a class=\\"u-url mention\\" data-user=\\"A4nwg4LYyh4WgrJOXg\\" href=\\"https://social.linux.pizza/@StampedingLonghorn\\" rel=\\"ugc\\">@<span>StampedingLonghorn</span></a></span> I tried to chase him away, but you know how that turned out... 😼 There's even cat hair inside the cases... (to be clear: also unintentional)
|
<span class=\\"h-card\\"><a class=\\"u-url mention\\" data-user=\\"A4nwg4LYyh4WgrJOXg\\" href=\\"https://social.linux.pizza/@StampedingLonghorn\\" rel=\\"ugc\\">@<span>StampedingLonghorn</span></a></span> I tried to chase him away, but you know how that turned out... 😼 There's even cat hair inside the cases... (to be clear: also unintentional)
|
||||||
|
@ -16,7 +16,7 @@ exports[`mastodon feed parser tests parse creates correct MD structure 1`] = `
|
||||||
"---
|
"---
|
||||||
source: \\"https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac\\"
|
source: \\"https://chat.brainbaking.com/objects/77a3ecfb-47e1-4d7a-a24a-8b779d80a8ac\\"
|
||||||
title: \\"I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri...\\"
|
title: \\"I pulled the Google plug and installed LineageOS: https://brainbaking.com/post/2021/03/getting-ri...\\"
|
||||||
date: \\"2021-03-01T20:03:35+01:00\\"
|
date: \\"2021-03-01T19:03:35\\"
|
||||||
---
|
---
|
||||||
|
|
||||||
I pulled the Google plug and installed LineageOS: <a href=\\"https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/\\" rel=\\"ugc\\">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class=\\"hashtag\\" data-tag=\\"lineageos\\" href=\\"https://chat.brainbaking.com/tag/lineageos\\" rel=\\"tag ugc\\">#lineageos</a> for privacy reasons?
|
I pulled the Google plug and installed LineageOS: <a href=\\"https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/\\" rel=\\"ugc\\">https://brainbaking.com/post/2021/03/getting-rid-of-tracking-using-lineageos/</a> Very impressed so far! Also rely on my own CalDAV server to replace GCalendar. Any others here running <a class=\\"hashtag\\" data-tag=\\"lineageos\\" href=\\"https://chat.brainbaking.com/tag/lineageos\\" rel=\\"tag ugc\\">#lineageos</a> for privacy reasons?
|
||||||
|
@ -27,7 +27,7 @@ exports[`mastodon feed parser tests parse embedded images 1`] = `
|
||||||
"---
|
"---
|
||||||
source: \\"https://chat.brainbaking.com/objects/a51e13ce-d618-4602-84f7-f398126510ff\\"
|
source: \\"https://chat.brainbaking.com/objects/a51e13ce-d618-4602-84f7-f398126510ff\\"
|
||||||
title: \\"Enjoyed an afternoon of oldskool Diablo II on the ...\\"
|
title: \\"Enjoyed an afternoon of oldskool Diablo II on the ...\\"
|
||||||
date: \\"2021-03-14T17:41:53+01:00\\"
|
date: \\"2021-03-14T17:41:53\\"
|
||||||
---
|
---
|
||||||
|
|
||||||
Enjoyed an afternoon of oldskool Diablo II on the Europebattle servers. We did a few Mephisto runs, managed to hit Hell, and I re-converetd my druid into a windy one. Good times!
|
Enjoyed an afternoon of oldskool Diablo II on the Europebattle servers. We did a few Mephisto runs, managed to hit Hell, and I re-converetd my druid into a windy one. Good times!
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
const MockDate = require('mockdate')
|
|
||||||
const dayjs = require('dayjs')
|
|
||||||
|
|
||||||
describe("mastodon feed parser tests", () => {
|
describe("mastodon feed parser tests", () => {
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const fsp = require('fs').promises;
|
const fsp = require('fs').promises;
|
||||||
|
@ -15,7 +12,6 @@ describe("mastodon feed parser tests", () => {
|
||||||
const dumpdir = `${__dirname}/dump`
|
const dumpdir = `${__dirname}/dump`
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
MockDate.reset()
|
|
||||||
if(fs.existsSync(dumpdir)) {
|
if(fs.existsSync(dumpdir)) {
|
||||||
rmdir(dumpdir)
|
rmdir(dumpdir)
|
||||||
}
|
}
|
||||||
|
@ -55,23 +51,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test("uses now in UTC zone if published date is invalid", async () => {
|
|
||||||
MockDate.set(dayjs('2021-03-11T19:01:03+00:00').toDate())
|
|
||||||
|
|
||||||
await parseMastoFeed({
|
|
||||||
url: "masto-feed-invalid-publishedDate",
|
|
||||||
notesdir: dumpdir
|
|
||||||
})
|
|
||||||
|
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/11h19m01s03.md`)
|
|
||||||
const md = frontMatterParser.parseSync(actualMd.toString())
|
|
||||||
expect(md.data.date).toBe('2021-03-11T19:01:03+00:00')
|
|
||||||
})
|
|
||||||
|
|
||||||
test("parse embedded images", async () => {
|
test("parse embedded images", async () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-images",
|
url: "masto-feed-images",
|
||||||
notesdir: dumpdir
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 1
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/14h17m41s53.md`)).toString()
|
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/14h17m41s53.md`)).toString()
|
||||||
|
@ -81,10 +65,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
test("parse prepends double quotes with backlash to escape in frontmatter", async () => {
|
test("parse prepends double quotes with backlash to escape in frontmatter", async () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-quote",
|
url: "masto-feed-quote",
|
||||||
notesdir: dumpdir
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/02h17m18s46.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("\"wow this sucks\" with quotes")
|
expect(md.data.title).toBe("\"wow this sucks\" with quotes")
|
||||||
|
@ -94,11 +79,12 @@ describe("mastodon feed parser tests", () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-sample",
|
url: "masto-feed-sample",
|
||||||
notesdir: dumpdir,
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0,
|
||||||
titleCount: 5,
|
titleCount: 5,
|
||||||
titlePrefix: "Note: "
|
titlePrefix: "Note: "
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/02h17m18s46.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("Note: @Stam...")
|
expect(md.data.title).toBe("Note: @Stam...")
|
||||||
|
@ -108,10 +94,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-sample",
|
url: "masto-feed-sample",
|
||||||
notesdir: dumpdir,
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0,
|
||||||
titleCount: 5000
|
titleCount: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/02h17m18s46.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 ...")
|
||||||
|
@ -133,10 +120,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-sample",
|
url: "masto-feed-sample",
|
||||||
notesdir: dumpdir,
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0,
|
||||||
titleCount: 5000
|
titleCount: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/01h20m03s35.md`)).toString()
|
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/01h19m03s35.md`)).toString()
|
||||||
expect(actualMd).toMatchSnapshot()
|
expect(actualMd).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -145,10 +133,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-sample",
|
url: "masto-feed-sample",
|
||||||
notesdir: dumpdir,
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0,
|
||||||
titleCount: 5000
|
titleCount: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/02h17m18s46.md`)).toString()
|
const actualMd = (await fsp.readFile(`${dumpdir}/2021/03/02h16m18s46.md`)).toString()
|
||||||
expect(actualMd).toMatchSnapshot()
|
expect(actualMd).toMatchSnapshot()
|
||||||
const expectedReplyTo = "https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793"
|
const expectedReplyTo = "https://social.linux.pizza/users/StampedingLonghorn/statuses/105821099684887793"
|
||||||
|
|
||||||
|
@ -160,10 +149,11 @@ describe("mastodon feed parser tests", () => {
|
||||||
await parseMastoFeed({
|
await parseMastoFeed({
|
||||||
url: "masto-feed-at-url",
|
url: "masto-feed-at-url",
|
||||||
notesdir: dumpdir,
|
notesdir: dumpdir,
|
||||||
|
utcOffset: 0,
|
||||||
titleCount: 5000
|
titleCount: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/20h12m12s08.md`)
|
const actualMd = await fsp.readFile(`${dumpdir}/2021/03/20h11m12s08.md`)
|
||||||
const expectedReplyTo = "https://reply-to-stuff"
|
const expectedReplyTo = "https://reply-to-stuff"
|
||||||
|
|
||||||
const md = frontMatterParser.parseSync(actualMd.toString())
|
const md = frontMatterParser.parseSync(actualMd.toString())
|
||||||
|
|
Loading…
Reference in New Issue