diff options
Diffstat (limited to 'nuldoc-src/templates')
| -rw-r--r-- | nuldoc-src/templates/about.ts | 21 | ||||
| -rw-r--r-- | nuldoc-src/templates/post.ts | 20 | ||||
| -rw-r--r-- | nuldoc-src/templates/post_list.ts | 21 | ||||
| -rw-r--r-- | nuldoc-src/templates/tag.ts | 21 | ||||
| -rw-r--r-- | nuldoc-src/templates/utils.ts | 16 |
5 files changed, 44 insertions, 55 deletions
diff --git a/nuldoc-src/templates/about.ts b/nuldoc-src/templates/about.ts index ccd7b1a..2f20aa9 100644 --- a/nuldoc-src/templates/about.ts +++ b/nuldoc-src/templates/about.ts @@ -1,19 +1,12 @@ -import { Element } from "../dom.ts"; import { Document } from "../docbook/document.ts"; import { Config } from "../config.ts"; -import { el, stylesheetLinkElement, text } from "./utils.ts"; - -function metaElement(attrs: [string, string][]): Element { - return el("meta", attrs); -} - -function linkElement(rel: string, href: string, type: string | null): Element { - const attrs: [string, string][] = [["rel", rel], ["href", href]]; - if (type !== null) { - attrs.push(["type", type]); - } - return el("link", attrs); -} +import { + el, + linkElement, + metaElement, + stylesheetLinkElement, + text, +} from "./utils.ts"; export default async function generateAbout( config: Config, diff --git a/nuldoc-src/templates/post.ts b/nuldoc-src/templates/post.ts index 9a89a73..51b9aa9 100644 --- a/nuldoc-src/templates/post.ts +++ b/nuldoc-src/templates/post.ts @@ -1,19 +1,13 @@ import { Element } from "../dom.ts"; import { Document } from "../docbook/document.ts"; import { Config } from "../config.ts"; -import { el, stylesheetLinkElement, text } from "./utils.ts"; - -function metaElement(attrs: [string, string][]): Element { - return el("meta", attrs); -} - -function linkElement(rel: string, href: string, type: string | null): Element { - const attrs: [string, string][] = [["rel", rel], ["href", href]]; - if (type !== null) { - attrs.push(["type", type]); - } - return el("link", attrs); -} +import { + el, + linkElement, + metaElement, + stylesheetLinkElement, + text, +} from "./utils.ts"; export default async function convertPost( doc: Document, diff --git a/nuldoc-src/templates/post_list.ts b/nuldoc-src/templates/post_list.ts index cdd2253..f75b8e1 100644 --- a/nuldoc-src/templates/post_list.ts +++ b/nuldoc-src/templates/post_list.ts @@ -1,19 +1,12 @@ -import { Element } from "../dom.ts"; import { Document } from "../docbook/document.ts"; import { Config } from "../config.ts"; -import { el, stylesheetLinkElement, text } from "./utils.ts"; - -function metaElement(attrs: [string, string][]): Element { - return el("meta", attrs); -} - -function linkElement(rel: string, href: string, type: string | null): Element { - const attrs: [string, string][] = [["rel", rel], ["href", href]]; - if (type !== null) { - attrs.push(["type", type]); - } - return el("link", attrs); -} +import { + el, + linkElement, + metaElement, + stylesheetLinkElement, + text, +} from "./utils.ts"; export default async function convertPostList( posts: Document[], diff --git a/nuldoc-src/templates/tag.ts b/nuldoc-src/templates/tag.ts index 1cbc2c5..8aeac58 100644 --- a/nuldoc-src/templates/tag.ts +++ b/nuldoc-src/templates/tag.ts @@ -1,19 +1,12 @@ -import { Element } from "../dom.ts"; import { Document } from "../docbook/document.ts"; import { Config } from "../config.ts"; -import { el, stylesheetLinkElement, text } from "./utils.ts"; - -function metaElement(attrs: [string, string][]): Element { - return el("meta", attrs); -} - -function linkElement(rel: string, href: string, type: string | null): Element { - const attrs: [string, string][] = [["rel", rel], ["href", href]]; - if (type !== null) { - attrs.push(["type", type]); - } - return el("link", attrs); -} +import { + el, + linkElement, + metaElement, + stylesheetLinkElement, + text, +} from "./utils.ts"; export default async function convertTag( tag: string, diff --git a/nuldoc-src/templates/utils.ts b/nuldoc-src/templates/utils.ts index 65dd506..018c460 100644 --- a/nuldoc-src/templates/utils.ts +++ b/nuldoc-src/templates/utils.ts @@ -33,3 +33,19 @@ export async function stylesheetLinkElement( const hash = toHashString(await crypto.subtle.digest("MD5", content), "hex"); return el("link", [["rel", "stylesheet"], ["href", `${fileName}?h=${hash}`]]); } + +export function metaElement(attrs: [string, string][]): Element { + return el("meta", attrs); +} + +export function linkElement( + rel: string, + href: string, + type: string | null, +): Element { + const attrs: [string, string][] = [["rel", rel], ["href", href]]; + if (type !== null) { + attrs.push(["type", type]); + } + return el("link", attrs); +} |
