diff options
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 5a022449..658453b0 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}; + }, + }); } |