1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import { join } from "@std/path";
import { renderToDOM } from "../jsx/render.ts";
import SlidePage from "../pages/SlidePage.tsx";
import { Config } from "../config.ts";
import { Page } from "../page.ts";
import { Date, Revision } from "../revision.ts";
import { Slide } from "../slide/slide.ts";
import { getPostPublishedDate, getPostUpdatedDate } from "./post.ts";
export interface SlidePage extends Page {
title: string;
description: string;
event: string;
talkType: string;
slideLink: string;
tags: string[];
revisions: Revision[];
published: Date;
updated: Date;
uuid: string;
}
export async function generateSlidePage(
slide: Slide,
config: Config,
): Promise<SlidePage> {
const html = await renderToDOM(
SlidePage(slide, config),
);
const cwd = Deno.cwd();
const contentDir = join(cwd, config.locations.contentDir);
const destFilePath = join(
slide.sourceFilePath.replace(contentDir, "").replace(".toml", ""),
"index.html",
);
return {
root: html,
renderer: "html",
destFilePath: destFilePath,
href: destFilePath.replace("index.html", ""),
title: slide.title,
description: `登壇: ${slide.event} (${slide.talkType})`,
event: slide.event,
talkType: slide.talkType,
slideLink: slide.slideLink,
tags: slide.tags,
revisions: slide.revisions,
published: getPostPublishedDate(slide),
updated: getPostUpdatedDate(slide),
uuid: slide.uuid,
};
}
|