aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/docbook/to_html.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-03-17 02:29:37 +0900
committernsfisis <nsfisis@gmail.com>2023-03-17 02:29:37 +0900
commitee142efa60d6d934a52988fd43ea1f316543473b (patch)
tree5412881dadec76d1b279f46f1dd2f5d8ac09f4c2 /nuldoc-src/docbook/to_html.ts
parentec2ae41b815c4c465a856d800709de6147e5e54f (diff)
downloadblog.nsfisis.dev-ee142efa60d6d934a52988fd43ea1f316543473b.tar.gz
blog.nsfisis.dev-ee142efa60d6d934a52988fd43ea1f316543473b.tar.zst
blog.nsfisis.dev-ee142efa60d6d934a52988fd43ea1f316543473b.zip
refactor: simplify class manipulation
Diffstat (limited to 'nuldoc-src/docbook/to_html.ts')
-rw-r--r--nuldoc-src/docbook/to_html.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/nuldoc-src/docbook/to_html.ts b/nuldoc-src/docbook/to_html.ts
index 0672ea6..7c21036 100644
--- a/nuldoc-src/docbook/to_html.ts
+++ b/nuldoc-src/docbook/to_html.ts
@@ -2,6 +2,7 @@ import hljs from "hljs/highlight.min.js";
import { Document } from "./document.ts";
import { DocBookError } from "../errors.ts";
import {
+ addClass,
Element,
findFirstChildElement,
forEachChild,
@@ -195,8 +196,7 @@ function transformProgramListingElement(doc: Document) {
}
n.name = "pre";
- const preClass = n.attributes.get("class");
- n.attributes.set("class", preClass ? preClass + " highlight" : "highlight");
+ addClass(n, "highlight");
const codeElement: Element = {
kind: "element",
name: "code",
@@ -214,8 +214,7 @@ function transformLiteralLayoutElement(doc: Document) {
}
n.name = "pre";
- const preClass = n.attributes.get("class");
- n.attributes.set("class", preClass ? preClass + " highlight" : "highlight");
+ addClass(n, "highlight");
const codeElement: Element = {
kind: "element",
name: "code",