diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-29 08:10:30 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-30 07:59:40 -0400 |
commit | eb8b316bb9af7d34720de1fa8f8dbd4b81513b32 (patch) | |
tree | 22d435e702b89344304928b7a860a5326357f192 /src/data/things/news-entry.js | |
parent | b30585187480a270826767eaf97e1acc66126072 (diff) |
data, yaml: store data step info on Thing constructors
Diffstat (limited to 'src/data/things/news-entry.js')
-rw-r--r-- | src/data/things/news-entry.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/data/things/news-entry.js b/src/data/things/news-entry.js index 5a02244..658453b 100644 --- a/src/data/things/news-entry.js +++ b/src/data/things/news-entry.js @@ -1,4 +1,7 @@ +export const NEWS_DATA_FILE = 'news.yaml'; + import Thing from '#thing'; +import {sortChronologically} from '#wiki-data'; import {parseDate} from '#yaml'; import {contentString, directory, name, simpleDate} @@ -43,4 +46,22 @@ export class NewsEntry extends Thing { 'Content': {property: 'content'}, }, }; + + static [Thing.getYamlLoadingSpec] = ({ + documentModes: {allInOne}, + thingConstructors: {NewsEntry}, + }) => ({ + title: `Process news data file`, + file: NEWS_DATA_FILE, + + documentMode: allInOne, + documentThing: NewsEntry, + + save(newsData) { + sortChronologically(newsData); + newsData.reverse(); + + return {newsData}; + }, + }); } |