From b98d324fe7eb37e7004926843feede7e636c3301 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Mar 2023 17:17:11 +0900 Subject: refactor: move shared codes to templates/utils.ts --- nuldoc-src/templates/post.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'nuldoc-src/templates/post.ts') 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, -- cgit v1.2.3-70-g09d2