Restore verified programmer archive with search, provenance and legacy URLs
Build and deploy / deploy (push) Successful in 1m5s
Build and deploy / deploy (push) Successful in 1m5s
This commit is contained in:
1 parent
089b949f4d
commit
681502465a
82 files changed
+8142
-5566
No files matched your search
+3
-32
@@ -1,33 +1,4 @@
|
||||
import articles from '../data/articles.json';
|
||||
import { editorialRevisions } from '../data/editorial-revisions.mjs';
|
||||
import { cleanReaderHtml } from './editorial-content.mjs';
|
||||
|
||||
const revisionBySlug = new Map(
|
||||
editorialRevisions.map((revision) => [revision.slug, revision]),
|
||||
);
|
||||
|
||||
const publishedArticles = articles.map((article) => ({
|
||||
...article,
|
||||
...(() => {
|
||||
const revision = revisionBySlug.get(article.slug);
|
||||
return revision
|
||||
? { ...revision, contentHtml: cleanReaderHtml(revision.contentHtml) }
|
||||
: {};
|
||||
})(),
|
||||
}));
|
||||
|
||||
export function getArticles() {
|
||||
return publishedArticles;
|
||||
}
|
||||
|
||||
export function getArticleBySlug(slug) {
|
||||
return publishedArticles.find((article) => article.slug === slug);
|
||||
}
|
||||
|
||||
export function formatDate(date) {
|
||||
return new Intl.DateTimeFormat('ru-RU', {
|
||||
day: '2-digit',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
}).format(new Date(date));
|
||||
}
|
||||
export function getArticles() { return articles; }
|
||||
export function getArticleBySlug(slug) { return articles.find(a => a.slug === slug); }
|
||||
export function formatDate(date) { return new Intl.DateTimeFormat('ru-RU', {day:'2-digit',month:'long',year:'numeric'}).format(new Date(date)); }
|
||||
Reference in new issue
Block a user