diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-01 02:28:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-01 02:28:10 +0900 |
| commit | cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a (patch) | |
| tree | 0e00d7caf3031fa86decaa0cbc226cc1e521b914 /services/nuldoc/nuldoc-src/generators/post.ts | |
| parent | d08e3edb65b215152aa26e3518fb2f2cd7071c4b (diff) | |
| parent | 1964f77d03eb647dcf46d63dde68d7ae7301604f (diff) | |
| download | nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.tar.gz nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.tar.zst nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.zip | |
Merge branch 'feat/ruby-rewrite'
Diffstat (limited to 'services/nuldoc/nuldoc-src/generators/post.ts')
| -rw-r--r-- | services/nuldoc/nuldoc-src/generators/post.ts | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/services/nuldoc/nuldoc-src/generators/post.ts b/services/nuldoc/nuldoc-src/generators/post.ts deleted file mode 100644 index 87205624..00000000 --- a/services/nuldoc/nuldoc-src/generators/post.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { join } from "@std/path"; -import PostPage from "../pages/PostPage.ts"; -import { Config } from "../config.ts"; -import { Document } from "../markdown/document.ts"; -import { Page } from "../page.ts"; -import { Date, Revision } from "../revision.ts"; - -export interface PostPage extends Page { - title: string; - description: string; - tags: string[]; - revisions: Revision[]; - published: Date; - updated: Date; - uuid: string; - sourceFilePath: string; -} - -export function getPostPublishedDate(page: { revisions: Revision[] }): Date { - for (const rev of page.revisions) { - if (!rev.isInternal) { - return rev.date; - } - } - return page.revisions[0].date; -} - -export function getPostUpdatedDate(page: { revisions: Revision[] }): Date { - return page.revisions[page.revisions.length - 1].date; -} - -export function postHasAnyUpdates(page: { revisions: Revision[] }): boolean { - return 2 <= page.revisions.filter((rev) => !rev.isInternal).length; -} - -export async function generatePostPage( - doc: Document, - config: Config, -): Promise<PostPage> { - const html = await PostPage(doc, config); - - const cwd = Deno.cwd(); - const contentDir = join(cwd, config.locations.contentDir); - const destFilePath = join( - doc.sourceFilePath.replace(contentDir, "").replace(".md", ""), - "index.html", - ); - return { - root: html, - renderer: "html", - site: "blog", - destFilePath: destFilePath, - href: destFilePath.replace("index.html", ""), - title: doc.title, - description: doc.description, - tags: doc.tags, - revisions: doc.revisions, - published: getPostPublishedDate(doc), - updated: getPostUpdatedDate(doc), - uuid: doc.uuid, - sourceFilePath: doc.sourceFilePath, - }; -} |
